-
Notifications
You must be signed in to change notification settings - Fork 77
Revert "Remove non-working problem matchers. (#88)" #103
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "problemMatcher": [ | ||
| { | ||
| "owner": "shellcheck-gcc", | ||
| "pattern": [ | ||
| { | ||
| "regexp": "^\\.?\\/?(.+):(\\d+):(\\d+):\\s(warning|error):\\s(.*)\\s\\[(SC\\d+)\\]$", | ||
| "file": 1, | ||
| "line": 2, | ||
| "column": 3, | ||
| "severity": 4, | ||
| "message": 5, | ||
| "code": 6 | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "owner": "shellcheck-gcc-notice", | ||
| "severity": "notice", | ||
| "pattern": [ | ||
| { | ||
| "regexp": "^\\.?\\/?(.+):(\\d+):(\\d+):\\s(note):\\s(.*)\\s\\[(SC\\d+)\\]$", | ||
| "file": 1, | ||
| "line": 2, | ||
| "column": 3, | ||
| "message": 5, | ||
| "code": 6 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "problemMatcher": [ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "owner": "shellcheck-tty", | ||||||||||||||||||||||||||
| "pattern": [ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "regexp": "^In\\s\\.?\\/?(.+)\\sline\\s(\\d+):$", | ||||||||||||||||||||||||||
| "file": 1, | ||||||||||||||||||||||||||
| "line": 2 | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "regexp": ".*" | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| "regexp": "(SC\\d+):\\s(.+)$", | ||||||||||||||||||||||||||
| "code": 1, | ||||||||||||||||||||||||||
| "message": 2, | ||||||||||||||||||||||||||
| "loop": true | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+14
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) LGTM: Effective pattern for capturing shellcheck warnings with a minor suggestion. The regular expression Consider adding word boundaries to the shellcheck code pattern for increased precision: - "regexp": "(SC\\d+):\\s(.+)$",
+ "regexp": "\\b(SC\\d+):\\s(.+)$",This change ensures that the pattern only matches "SC" when it's at the start of a word, potentially preventing false positives. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+1
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Overall assessment: Well-designed problem matcher configuration. This problem matcher configuration for shellcheck-tty output is well-structured and should effectively integrate shellcheck warnings into the GitHub Actions workflow. It correctly captures file names, line numbers, shellcheck codes, and warning messages. Key points:
Consider addressing the following minor points:
This problem matcher will enhance the visibility and tracking of shellcheck issues within your GitHub Actions workflow, improving the overall code quality process. |
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -140,12 +140,26 @@ If you need to scan for unusual files, you can use the `additional_files` key. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| additional_files: 'run finish' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Disable problem matcher | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| If you do not want to have the problem-matcher annotate files, you can disable it | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| by setting `disable_matcher` to `true`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```yaml | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run ShellCheck | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ludeeus/action-shellcheck@master | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| disable_matcher: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+143
to
+154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) LGTM! Consider adding a brief explanation of the problem matcher. The new section about disabling the problem matcher is well-structured and provides a clear example of how to use the To further improve clarity, consider adding a brief explanation of what the problem matcher does and why a user might want to disable it. For example: ## Disable problem matcher
-If you do not want to have the problem-matcher annotate files, you can disable it
+The problem matcher automatically annotates files with issues found by ShellCheck.
+If you do not want to have these automatic annotations, you can disable the matcher
by setting `disable_matcher` to `true`.📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Change output format | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Shellcheck can print output in these formats: `checkstyle`, `diff`, `gcc`, `json`, `json1`, `quiet`, `tty`. See some examples [here](https://github.com/koalaman/shellcheck/wiki/Integration#pick-the-output-format-that-makes-your-life-easier). | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Only `tty` and `gcc` produce file annotations via problem matcher, default is `gcc`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `tty` has multi-line log messages | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gcc` has single-line log messages | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `tty` has multi-line log messages, but all annotations are reported as errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - `gcc` has single-line log messages, so it's easier to parse with a problem matcher (including correct severity annotation) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+159
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) LGTM! Consider standardizing the format of the list items. The changes to the output format section provide valuable clarification on the behavior of 'tty' and 'gcc' formats. This information helps users make an informed decision about which format to use based on their needs. To improve consistency with the rest of the document, consider standardizing the format of the list items. For example: -Only `tty` and `gcc` produce file annotations via problem matcher, default is `gcc`.
+Only `tty` and `gcc` produce file annotations via problem matcher. The default is `gcc`.
-- `tty` has multi-line log messages, but all annotations are reported as errors
-- `gcc` has single-line log messages, so it's easier to parse with a problem matcher (including correct severity annotation)
+- `tty`: Has multi-line log messages, but all annotations are reported as errors.
+- `gcc`: Has single-line log messages, making it easier to parse with a problem matcher (including correct severity annotation).📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ```yaml | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,6 @@ inputs: | |
| description: "Set to true to skip using problem-matcher" | ||
| required: false | ||
| default: "false" | ||
| deprecationMessage: "There are no problem-matchers, this setting does not do anything." | ||
| format: | ||
| description: "Output format (checkstyle, diff, gcc, json, json1, quiet, tty)" | ||
| required: false | ||
|
|
@@ -57,6 +56,17 @@ branding: | |
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Enable problem-matcher | ||
| shell: bash | ||
| env: | ||
| INPUT_FORMAT: ${{ inputs.format }} | ||
| INPUT_DISABLE_MATCHER: ${{ inputs.disable_matcher }} | ||
| run: | | ||
| problem_matcher_file="${{ github.action_path }}/.github/problem-matcher-${INPUT_FORMAT}.json" | ||
| if [[ "${INPUT_DISABLE_MATCHER}" != "true" && -f "$problem_matcher_file" ]]; then | ||
| echo "::add-matcher::$problem_matcher_file" | ||
| fi | ||
|
|
||
|
Comment on lines
+59
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) LGTM! Consider adding a comment for clarity. The new "Enable problem-matcher" step effectively reintroduces the problem matcher functionality, aligning with the PR objectives. The logic is sound, checking for both the disable flag and the existence of the matcher file. Consider adding a brief comment explaining the purpose of this step, e.g.: # Enable problem-matcher if not disabled and the matcher file existsThis would enhance readability and maintainability. |
||
| - name: Download shellcheck | ||
| shell: bash | ||
| env: | ||
|
|
@@ -220,6 +230,13 @@ runs: | |
|
|
||
| set +f # re-enable globbing | ||
|
|
||
| - name: Remove problem-matcher | ||
| shell: bash | ||
| run: | | ||
| echo "::remove-matcher owner=shellcheck-gcc::" | ||
| echo "::remove-matcher owner=shellcheck-gcc-notice::" | ||
| echo "::remove-matcher owner=shellcheck-tty::" | ||
|
|
||
|
Comment on lines
+233
to
+239
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) LGTM! Consider using environment variables for consistency. The new "Remove problem-matcher" step effectively cleans up the problem matchers added during the action's execution. This is a good practice to avoid potential conflicts with other actions. For consistency with the "Enable problem-matcher" step, consider using environment variables for the matcher names: - name: Remove problem-matcher
shell: bash
env:
MATCHER_GCC: "shellcheck-gcc"
MATCHER_GCC_NOTICE: "shellcheck-gcc-notice"
MATCHER_TTY: "shellcheck-tty"
run: |
echo "::remove-matcher owner=${MATCHER_GCC}::"
echo "::remove-matcher owner=${MATCHER_GCC_NOTICE}::"
echo "::remove-matcher owner=${MATCHER_TTY}::"This approach would make it easier to update matcher names in the future if needed. |
||
| - name: Exit action | ||
| shell: bash | ||
| run: exit ${{steps.check.outputs.statuscode}} | ||
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.
🧹 Nitpick (assertive)
Well-structured problem matcher configuration for shellcheck output.
The overall structure of this file is excellent, providing comprehensive coverage for shellcheck output in GCC format. The separation of matchers for warnings/errors and notices enhances the precision of issue categorization in GitHub Actions.
For improved maintainability, consider adding a brief comment at the top of the file explaining its purpose and the format of shellcheck output it's designed to parse. This would help future maintainers quickly understand the file's role.