Fix bash code analysis issues #4440
Merged
+40
−7
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.
Description
(This is a re-opening of #4382)
Fixes some issues from the recent expansion of bash code analysis and switch to the reviewdog framework.
First and foremost, the permission issue that prevented errors from being posted to the PR are fixed. This was only an issue for pull requests from forks (which is all of them for us). The trigger is changed to
pull_request_target, which changes the context to the target repo. This is safe as long as we are not attempting to build or run the code. Because of the context change, an additional argument is needed for checkout to checkout the head of the PR.Second, some parameters are turned into conditionals to handle the fact that the action is run on both pull requests and merges to develop. This allows both the correct hash in the previous change, and also the correct GH reporter to be used. This uses a new GH action that will need to be added to the allowed list.
Third, the
shfmtoptions are fixed so that it actually fails on error. Reviewdog has deprecatedfail_on_error, but thereviewdog/shfmtaction does not seem to support the replacementfail_level. So,fail_levelis passed to reviewdog directly as a flag.Finally, the README status badges are updated for the new actions. Additionally, clicking on the code analysis badges now brings up the GH action logs.
Note: the
bash_code_analysisactions may not run for this PR because of the trigger change. It will run on develop after merge, and on PRs from then on.Resolves #4369
Type of change
Change characteristics
How has this been tested?
Checklist