make everything pass shellcheck #150
Labels
No Label
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#150
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: 4nd3r
even if we exclude SC2154 (something is referenced but not assigned), then others should be dealt with in some point. yes, that's lot of work :>
thoughts on this?
Created by: asteven
Nice work everyone. To be honest I expect some breakage. But we can just fix that along the way.
I do think we should eat this dog food ourself for quite some time before releasing.
Created by: darko-poljak
@asteven @thriqon @tom-ee @telmich Good news!
If I am right, #712 and #713 should be the last PRs regarding this issue :)
Created by: darko-poljak
To coordinate, after resolving https://github.com/ungleich/cdist/pull/708 I will create PR
for another fixes I am preparing, https://github.com/darko-poljak/cdist/tree/shellcheck-rest.
After this one, I think all shellcheck problems will be resolved.
Except SC2154 (var is referenced but not assigned, https://github.com/koalaman/shellcheck/wiki/SC2154) for all
__<something>
which we will ignore, since such variables are cdist's environment variables.Created by: darko-poljak
We can add Makefile target for shellcheck manifest and gencode-*.
Although we won't be able to check code-* scripts.
Created by: 4nd3r
then we should add
# shellcheck disable=<code>
before that line.Created by: darko-poljak
For specific things, like apt types, which uses GNU version of find I think we do not need to port it to portable POSIX shell code, because apt is specific for debian-like GNU/Linux distros which have GNU tools by default.
Created by: darko-poljak
@asteven For mktemp, POSIX does not specify mktemp utility.
Also, -p is not defined for FreeBSD mktemp. TMPDIR env var is used for this, '/tmp' as default if not set.
So I suggest to use:
TMPDIR=/tmp mktemp...
Created by: darko-poljak
We need to check code generation and fix as many as we notice.
e.g.: __staged_file/gencode-remote generates code that uses mktemp --tmpdir, should be mktemp -p instead.
Created by: darko-poljak
@asteven Can you also take a look if you have time?
Here https://github.com/ungleich/cdist/issues/518 will also be handled.
Created by: darko-poljak
Hm... shellcheck can not check code that would be generated by gencode unless code is checked after it is generated. Guess this should be fixed when someone reports it. Or we look gencode by gencode and see if we spot something. Ideas?
Created by: 4nd3r
woah, that's a big change! it'll take some time to scroll through it. will do.
Created by: darko-poljak
Can you take a look at https://github.com/ungleich/cdist/compare/master...darko-poljak:shellcheck if you can spot some mistake prior to creating PR?
Created by: darko-poljak
@4nd3r I am starting to work on this. I will create a PR with first changes where we can further discuss this.