-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Linter extensions #18349
Linter extensions #18349
Conversation
5042b60
to
226edc2
Compare
Ready |
@Coolthulhu knowing your on windows at the moment and that there is a need to unblock other PR's do you have any objection to this being merged now. We can monitor the buildbot carefully - it shouldn't be affected at all (beyond producing better diagnostic messages) but if it was we can revert this PR in it's entirety? I am going to work further on windows support (probably a |
I do have a Perl set up on mingw, so I can test it. |
Good stuff. I'm torn between packaging the linter for windows or working out a set of instructions for ActivePerl (does that still exist)? Long term we might rewrite the linter in C but not until coverage is 100% (eg. the JSON corpus could function as one giant unit test) |
This would be helpful, yes. Expanded diagnostics will also be useful, as I have still been getting used to handling some things with regards to pull requests. In my pull request #18346, before I removed my attempt to add a change to Vehicle Additions Pack, all I had to go on was this error:
|
In that case all your fields are valid so you either have a syntax or formatting error. Wait for this PR and it should give you the exact line or better still run |
Thank you. I assume I can run Earlier commits also mention an instance of "unmatched context" regarding |
That message means either you entered an invalid field or the ruleset doesn't cover that. Can you post the offending section? |
It was when I reformatted the blob construction and terrain entries added by Blaze, by outright copy-pasting from valid entries and editing them as needed. In the case of the terrain file:
Placement of Apologies for bringing this up in an unrelated pull request. |
Is |
It does not seem to generate load errors in the game itself, since that field is used to the vanilla terrain entries. It is also strange that my copying presumably badly-formatted entries from vanilla construction and terrain generated linting errors when used in a Blazemod file, but not in the source files, which also received changes in that pull request. |
Doesn't mean it's valid though. May well do absolutely nothing? |
Not sure, to be honest. Later on I will attempt to re-implement the file changes minus num_tests, and test out |
Linter is working as intended. A quick |
I will have to figure out what I did wrong then. Thank you for the help. |
How did you get on? |
@Coolthulhu this PR too if you can, it unblocks a number of other authors PR's |
Missed this somehow. Also, I was supposed to mergetest this yesterday, but then suddenly real life happened. Sorry. |
Hope it was not something serious @Coolthulhu. |
Conflicts with #18342 |
Can we push this one and then rebase #18342 - the latter is a trivial conflict and this one is much more important |
I'm getting segfaults:
Though it could be caused by an exotic environment. Msys supplies it's own |
Do you have |
Yes. Though it might be vulnerable on windows - I got segfaults while trying to concatenate all files (concatenating the files and then parsing them separately worked). |
Comment out the calls to |
It looks like windows and jq don't really like each other... |
Could be worth reporting upstream. FWIW the |
Found the reason: I'm using the 64 bit version, but it seems that same thing happens to me. I managed to get around it by |
I can't really test it right now. The tools have gotten quite complex and require a *nix system to be executed. |
The same definitely applies to Automatic merges afterwards wouldn't work because how do we handle committed JSON that contains bad fields - this happened yesterday in another PR and was detected by the linter. A rewrite in C can happen at some later date but not before the ruleset is complete. Increasing the scope without completing the original goal first is doomed to failure. This should really be merged now... |
I can't test it though. If you want to merge it, it's all on you. |
Fair enough argument although as Jenkins is already broken I don't think I can make it any worse. If for any reason it does we can revert. None of this PR results in code running on user installations. Sorry to ping @narc0tiq but as a separate issue Jenkins appears to have run out of disk space
|
Summary
make lint
target for automatic re-lintingAutomatic re-linting
make lint-check
make lint
Performance
Previously
lint.cache
was global so updating a single entry fromjson_whitelist
forced a full re-lint of all files. This PR only lints changed files which is significantly faster - sufficient to suggest installingmake lint
as a git hook.Diagnostics
JSON syntax errors now include the line and column:
Formatting errors now include this as well as a suggested change:
Shell exit codes are passed through to make with anything other than
EX_DATAERR 65
indicating a problem with the linter or build process itself (file permissions etc).Miscellaneous
json_whitelist
now supports# comments
and blank linesjson_whitelist
Jenkins buildbot
Is not affected.
make lint-check
does not depend onjq
although if @narcotiq agrees that's possible in a further PR I'd like to replace themake json-check
target with a check viajq