-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add shell linter Github action for pull requests #1007
Merged
aerorahul
merged 5 commits into
NOAA-EMC:develop
from
WalterKolczynski-NOAA:feature/shell_linter
Aug 31, 2022
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a8b164f
Adds shellint GitHub action
WalterKolczynski-NOAA 278e6d1
Update shell linter to diff linter
WalterKolczynski-NOAA e0de360
Add shellcheck settings file
WalterKolczynski-NOAA f8cb9ab
Run linter on all PR activity
WalterKolczynski-NOAA ee1676d
Make preamble comply with g-style
WalterKolczynski-NOAA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
name: linters | ||
on: | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
defaults: | ||
run: | ||
shell: bash -o pipefail {0} | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
security-events: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Lint shell scripts | ||
uses: redhat-plumbers-in-action/differential-shellcheck@latest | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
shell-scripts: ush/preamble.sh | ||
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Global settings for Spellcheck (https://github.com/koalaman/shellcheck) | ||
enable=all |
This file contains 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
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.
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.
Unfortunately, this will not work as you expect.
shell-scripts
option takes the path to a text file that contains a list of file paths that will be ignored. I know that it is a bit clumsy, and it would deserve to rework on the linter side.But I think you could be fine by running a linter with default settings. It performs differential scans, so only new changes introduced via PR will be reported.
I'm glad you are using my action. If you have any issues or requests, feel free to reach out to me or create issue on
differential-shellcheck
.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.
Seemed to work when I tested it, but thanks for the information. It was probably just accidental that it did what I expected. I don't know that using a separate file is really all that clumsy at all.
Actually really like your action, thank you for making it available. My only request would be to make a new one that does the same for python linter ;). I'm having trouble finding one quite as well integrated into GitHub actions, to the point I am considering adapting yours for a different linter.
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.
I'm glad you like it. 👍
We are planning to create also other linters, including
differential-cppcheck
anddifferential-pylint
. I can't give you any exact release date, but they are coming. They will be available at: @redhat-plumbers-in-action