-
Notifications
You must be signed in to change notification settings - Fork 66
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
Make it easier to see linter issues #368
Conversation
Makefile
Outdated
@@ -104,7 +94,7 @@ buf-install: | |||
##### Linters ##### | |||
api-linter: | |||
printf $(COLOR) "Run api-linter..." | |||
$(call silent_exec, api-linter --set-exit-status $(PROTO_IMPORTS) --config $(PROTO_ROOT)/api-linter.yaml $(PROTO_FILES)) | |||
@api-linter --set-exit-status $(PROTO_IMPORTS) --config $(PROTO_ROOT)/api-linter.yaml --output-format json $(PROTO_FILES) | jq -r 'map(select(.problems != []) | . as $$file | .problems[] | {rule: .rule_doc_uri, location: "\($$file.file_path):\(.location.start_position.line_number)"}) | group_by(.rule) | .[] | .[0].rule + ":\n" + (map("\t" + .location) | join("\n"))' |
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.
The jq
requirement might be problematic. I don't know if we can expect everyone to have that installed?
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.
FWIW, since we expect go
to be installed, there seems to be a Go port (https://github.com/itchyny/gojq) which could be installed like the other tools.
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.
Maybe instead of requiring jq
, you can add a separate target api-linter-pretty
and recommend running that for pretty output if this target fail.
Wish we didn't have to have platform dependent build scripting and require extra dependencies like "jq". We have a perfectly fine language for executing processes, parsing JSON, etc. |
Thanks for the suggestion, @stephanos! |
👍 Still unfortunate that we have platform-specific build scripts, but that's not specific to this issue |
What changed?
I changed the format of the api-linter to:
Why?
The output previously was not very easy to parse:
Before:
After:
Breaking changes