Keep file/line in the github reporter's log output#657
Open
wilfison wants to merge 1 commit into
Open
Conversation
The github reporter emits workflow commands whose `file`/`line` GitHub moves into the Files-tab annotation, dropping them from the plain Actions log. Prefix the command message with `filename:line LinterName:` so the location stays in the log, add a `title=haml-lint <Linter>` to the annotation, and escape the `:`/`,` delimiters in property values. Closes sds#495
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #495
Problem
The
githubreporter emits GitHub Actions workflow commands like:GitHub moves the
file/lineof a workflow command into the annotation shown in the "Files changed" tab, so they disappear from the plain Actions log — leaving only the bare message with no location. This makes the log much less useful than the default reporter, which is the trade-off reported in #495.Change
Enhance
Reporter::GithubReporterso the location is preserved in both places:filename:line LinterName:, so the log line reads e.g.app/views/x.haml:12 RuboCop: Style/StringLiterals: ...even after GitHub strips thefile/lineinto the annotation.title—title=haml-lint <LinterName>(falling back tohaml-lintwhen a lint has no linter), so annotations are labeled and distinguishable from other tools'.
%,\n,\r; property values (file,title, ...) additionally escape the:and,that delimit the command.Before
After
The annotation in the Files tab still works exactly as before; the difference is that the log
now keeps the file, line, and linter name.
Tests
file=/line=command properties.title, the location/linter prefix in the message (with andwithout an associated linter), and escaping of delimiter characters.
bundle exec rspec spec/haml_lint/reporter/github_reporter_spec.rb— 18 examples, 0 failures.bundle exec rubocop lib/haml_lint/reporter/github_reporter.rb— no offenses.