[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex in language and locale recognition #490

Closed
wants to merge 1 commit into from

Conversation

aeisenberg
Copy link

This was first mentioned in github/codeql-action#418
Also, raised in #488.

The current regex has an extra ] at the end. This means that schema validation will incorrectly validate strings that should be an error. For example, the following strings are valid according to the regex, but should not be valid:

/^[a-zA-Z]{2}|^[a-zA-Z]{2}-[a-zA-Z]{2}]?$/
ja-JP] true
ja- true
ja-J true
ja-j] true

cc: @lcartey

@lcartey
Copy link
lcartey commented Apr 9, 2021

cc @michaelcfanning - this addresses a small bug a user of the sarif-upload GitHub Action noticed.

aeisenberg added a commit to github/codeql-action that referenced this pull request Apr 9, 2021
See oasis-tcs/sarif-spec#490
See #418

Note that this changes the sarif spec file. Unless this
change is actually merged in the sarif spec repo, the
version used by the action will be slightly different.
aeisenberg added a commit to github/codeql-action that referenced this pull request Apr 14, 2021
See oasis-tcs/sarif-spec#490
See #418

Note that this changes the sarif spec file. Unless this
change is actually merged in the sarif spec repo, the
version used by the action will be slightly different.
@aeisenberg
Copy link
Author

Any chance someone could take a look at this? We are already using this change in production.

@@ -2354,7 +2354,7 @@
"description": "The language of the messages emitted into the log file during this run (expressed as an ISO 639-1 two-letter lowercase culture code) and an optional region (expressed as an ISO 3166-1 two-letter uppercase subculture code associated with a country or region). The casing is recommended but not required (in order for this data to conform to RFC5646).",
"type": "string",
"default": "en-US",
"pattern": "^[a-zA-Z]{2}|^[a-zA-Z]{2}-[a-zA-Z]{2}]?$"
"pattern": "^[a-zA-Z]{2}(-[a-zA-Z]{2})?$"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zA [](start = 39, length = 2)

Looks good! Also, we could consider the pattern below. It's two characters shorter and, I think, a little more readable. As if readability in regex could be easily quantified. :)

(?i)^[a-z]{2}(-[a-z]{2})?$

@eddynake, @yongyan-gh, we need to get this change into an rtm.6 revision of the SARIF schema as published in the SDK and schemastore.org.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddynaka, @yongyan-gh, I don't think we pushed these changes into an rtm.6 revision. Let's discuss this offline today, it would be good to close on this issue asap. @aeisenberg, sorry for the delay. We do have all the SARIF errata prepared but the holidays (and a need to rerender all errata in an OASIS-approved template) has introduced delays. We're picking it up again now, however.

Copy link
Contributor
@michaelcfanning michaelcfanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@aeisenberg
Copy link
Author

Just following up with this. Can someone merge this PR?

aofaof0907 pushed a commit to aofaof0907/codeql-action that referenced this pull request Jul 29, 2021
See oasis-tcs/sarif-spec#490
See github#418

Note that this changes the sarif spec file. Unless this
change is actually merged in the sarif spec repo, the
version used by the action will be slightly different.
@michaelcfanning
Copy link
Contributor

@aeisenberg, I apologize for the delay here, we've had to initiate an actual errata process to accept certain changes. I assume you've long moved forward with what you need for your work. :) The new versions of schema, spec, etc., with these changes will be available in early Oct.

@aeisenberg
Copy link
Author

That's fine. We're handling things locally correctly. It would just be good to have these changes available to the entire community.

@aeisenberg
Copy link
Author

Hi there, @michaelcfanning is there any update me on the status of this change? Is the new version of the specification available somewhere? If so, we can close this PR.

@sthagen
Copy link
Contributor
sthagen commented Jul 19, 2022

@dmk42 @michaelcfanning I wonder if we plan to either provide the information requested by @aeisenberg and close without action or resolve the conflicts and merge this PR. Should we create an agenda item for next meeting to discuss?

@aeisenberg
Copy link
Author

Just cleaning out my backlog. It doesn't look like this PR will ever be merged.

@aeisenberg aeisenberg closed this Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants