Skip to content

Add ShellCheck tests and recommendations#1228

Closed
j-marz wants to merge 1 commit intodocker-mailserver:masterfrom
j-marz:shellcheck
Closed

Add ShellCheck tests and recommendations#1228
j-marz wants to merge 1 commit intodocker-mailserver:masterfrom
j-marz:shellcheck

Conversation

@j-marz
Copy link
Copy Markdown
Contributor

@j-marz j-marz commented Aug 14, 2019

This is a WIP. The build will fail until all fixes are applied to shell scripts.

  • fail travis build if shellcheck finds issues with shell scripts
  • fix issues found in existing shell scripts

https://github.com/koalaman/shellcheck

@fbartels
Copy link
Copy Markdown
Member

fbartels commented Aug 14, 2019

In another project I am using the following snippet in a Makefile (could be added to the recently added lint target):

grep -rIl '^#![[:blank:]]*/bin/\(bash\|sh\|zsh\)' \
        --exclude-dir=.git --exclude=*.sw? \
        | xargs shellcheck -x

@j-marz
Copy link
Copy Markdown
Contributor Author

j-marz commented Aug 18, 2019

I like the idea @fbartels - no need to update .travis.yml every time a new shell script is added.
I guess we could use your approach, but limit it to the directories that will be expected to host shell scripts related to this project?
My concern is breaking builds for shell syntax issues found in shell scripts that come with the base image or packages.

@fbartels
Copy link
Copy Markdown
Member

My concern is breaking builds for shell syntax issues found in shell scripts that come with the base image or packages.

as shellcheck is performed in the checked out directory it will check scripts that are then only part of the build docker image. The concern is valid though for files pulled in by git submodules (bats for example).

@erik-wramner
Copy link
Copy Markdown
Contributor

This was a good idea, but it seems to have stalled. Were there too many errors to fix?

@j-marz
Copy link
Copy Markdown
Contributor Author

j-marz commented Aug 9, 2020

This was a good idea, but it seems to have stalled. Were there too many errors to fix?

Unfortunately, I haven't been able to spend any more time on this PR. Happy for someone else to pick it up and take over. Otherwise i'll aim to continue the work later this year.

@georglauterbach
Copy link
Copy Markdown
Member

@j-marz I refactored setup.sh already, currently waiting for the Travis tests to finish. Would be nice to see you continuing 👍

@georglauterbach
Copy link
Copy Markdown
Member

@j-marz I've got time now, will tend to it.

@georglauterbach
Copy link
Copy Markdown
Member

Can be closed due to #1601

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants