Closed nimec01 closed 5 months ago
The linter is still complaining about a few aspects of the workflow file.
Other than that: Have you done some experiments with how it behaves when there are changes (like manually changing the hpack version number mentioned in the .cabal
, or changing some compiler option in package.yaml
without also changing the .cabal
file)?
I removed some ghc-options and the workflow correctly detected the mismatch between the files. Manually changing the version in the .cabal file did not lead to a mismatch error.
There is one linter error left:
Useless echo? Instead of 'echo $(cmd)', just use 'cmd'
However, this is a false positive. Changing it to only use cmd
breaks the workflow when there is a mismatch between the files.
Okay, can you find out how to let the linter ignore that occurrence?
Possibly either using BASH_SEVERITY
in https://github.com/fmidue/logic-tasks/blob/4b6373327538fad87a0e2e6bd62d7b9db31e221c/.github/workflows/linter.yml#L29-L32 or adding an edited version of https://github.com/super-linter/super-linter/blob/main/TEMPLATES/.shellcheckrc to the .github/linters
directory in this repo.
... or GITHUB_ACTIONS_CONFIG_FILE
or GITHUB_ACTIONS_COMMAND_ARGS
...
... or simply "disguising" the echo
call somehow, so that the linter doesn't see the pattern it is looking for. :smile:
Have you seen this? https://github.com/koalaman/shellcheck/wiki/SC2005#exceptions
Maybe the cmd || true
suggestion would have been appropriate here.
(Mainly asking because if we take over this PR for other repos, we would now also always have to somewhat globally change the linter configuration, which might be undesirable in some settings.)
I think ChatGPT's suggestion led me the wrong way. We can simply call diff [...]
. This prints the differences and exits with code 1 if there are any.
I tested it with a consistent and inconsistent .cabal file, and it worked as expected.
This adds a new GitHub Action workflow that checks whether the
.cabal
file is consistent with thepackage.yml
file.A sample run can be found here.