-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 heuristic for extension .yy
(JSON vs Yacc)
#6976
Conversation
FIx .yy heuristic to account for changes in property name in GMStudio 2.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a new sample and updated heuristic test, if necessary, for this too please.
Sure. I've added a sample JSON file with the .yy extension. The test doesn't need any changes: linguist/test/test_heuristics.rb Lines 1087 to 1093 in 39fd5e9
|
I was referring to adding a new GMStudio sample that matches the heuristic change. |
Those The file added matches the heuristic added with the following line: |
🤦 Whoops. I missed that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
Note: this PR will not be merged until close to when the next release is made. See here for more details.
No worries. Let me know if you want me to fix the generated detection as well or if we can keep that for another PR. linguist/lib/linguist/generated.rb Lines 672 to 683 in 916bd8f
|
Yeah, probably best to fix that too. Lets do it in this PR. |
Should be all done now. |
.yy
to account for change in property name in GMStudio 2.3.yy
(JSON vs Yacc)
After looking a little more at the syntax for Yacc, I realize that a Yacc file cannot start with a linguist/lib/linguist/heuristics.yml Lines 353 to 354 in 39fd5e9
And for the generated condition inside generated.rb , we could simply have something like: return lines.first(3).join('').match?(/^\s*[{\[]/) ||
lines[0] =~ /^\d\.\d\.\d.+\|\{/ Thoughts? Corresponding search query: Still 600K files. |
That is actually a much better approach in my opinion :+) Good find! I've seen one other JSON + .yy extension = GM |
13fb117
to
bb34e54
Compare
We should be all good now with the latest changes
Good catch! This actually seems like an unusual Yacc file that skips the directives section going against the convention/documentation, so it would still be correct to categorize them as Yacc technically. However, for this to be a problem, those unconventional Yacc files would need to start with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
Note: this PR will not be merged until close to when the next release is made. See here for more details.
Description
Closes #6517
496k+ files affected
Implements fix suggested by @lildude and backed by @RobQuistNL in #6517 (comment).See this comment for the approach used: #6976 (comment)
Checklist: