Skip to content
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

Incorporate ShellCheck into GitHub Action #7904

Closed
wants to merge 1 commit into from

Conversation

dtrodrigues
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This will run ShellCheck on bin/brew and scripts ending in .sh not in a tap or in vendor.

@dtrodrigues dtrodrigues changed the title shellcheck Incorporate ShellCheck into GitHub Action Jul 5, 2020
- name: Run ShellCheck
run: |
brew install shellcheck
shellcheck --color bin/brew
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is (or at least should be) already run by brew style:

shellcheck = which("shellcheck")
shellcheck ||= which("shellcheck", ENV["HOMEBREW_PATH"])
shellcheck ||= begin
ohai "Installing `shellcheck` for shell style checks..."
system HOMEBREW_BREW_FILE, "install", "shellcheck"
which("shellcheck") || which("shellcheck", ENV["HOMEBREW_PATH"])
end
unless shellcheck
opoo "Could not find or install `shellcheck`! Not checking shell style."
return rubocop_success
end

@dtrodrigues
Copy link
Member Author

It looks like 892d0ac from April 2019 may have prevented shellcheck from running since then since the current GitHub action runs brew style --display-cop-names. The 3 detected errors were all introduced after that point (19fd564 99e3087 5d3456f).

Also, I think it would be better to add a #!/bin/bash shebang to the .sh files missing them and remove the --shell=bash argument so the files are more explicit.

@MikeMcQuaid
Copy link
Member

It looks like 892d0ac from April 2019 may have prevented shellcheck from running since then since the current GitHub action runs brew style --display-cop-names. The 3 detected errors were all introduced after that point (19fd564 99e3087 5d3456f).

Good catch, I've re-enabled in #7930.

Also, I think it would be better to add a #!/bin/bash shebang to the .sh files missing them and remove the --shell=bash argument so the files are more explicit.

I'd rather not; these files are not designed to be executed as shell scripts but sourced from other files.

@dtrodrigues dtrodrigues closed this Jul 7, 2020
@MikeMcQuaid
Copy link
Member

Thanks for the PR @dtrodrigues, wouldn't have caught this without you ❤️

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 25, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants