Open
Description
Copying from this last comment on the first (primary) PR - there is some outstanding work that may be worth doing, and it may make sense to break these up into separate issues. For now here is the full list:
Feel strongly about
- Subtrees get out of hand quickly for even the smallest of repos. We should try to find a way to not force all users to deal with ever-growing helper lib checkouts.
filehandling/lib
(even though it was straight from SO) at the very least needs some comments but it really could be better if the logic flow was cleaned up to be more readable.- The
: ${FOO:?"Something"}
pattern is really hard to read when compared to an if/else - The
[[ <check> ]] | die "foo"
and<cmd> || die
patterns are also really hard to read when compared to an if/else - If/else pattern where the else is returning 1 should be changed to be
if !condition return 1
and then do the positive condition (unconditionally) tests-for-this-repo
needs a better name. Don't know what it should be but the current one isn't great.- Bats tests and Dockerfiles should have more liberal use of newlines in tests to show given/when/then sections
[[ <check> ]]
by itself should go away as a pattern as it's unclear what it's doing without knowing bash in depth
Should probably fix
local rc=0
/return $rc
pattern looked in most cases superfluous. Some tests do seem to need it but we should probably use a named variable rather than return code as the saved state variable.- https://github.com/conjurinc/bash-lib/pull/1/files#diff-9e74f9f10627a857b3f795b8264c89adR14 space between
"
and\
- https://github.com/conjurinc/bash-lib/pull/1/files#diff-9e74f9f10627a857b3f795b8264c89adR30 - should probably quote the image/tag variable
- run_tests should probably do a loop over an array rather than have 3 individual sections on what it's testing
- We should probably use
echo
withecho message
instead ofecho -e '\nmessage
- tests-for-this-repo/run-bats-tests quote both sting values that are being compared
On the fence but leaning towards needing a fix
- Some of your awk chomping of refs could be done with sed
- Even though all of the script import
-e
flag, I think it would be good to explicitly set it in all toplevelish scripts that you expect might want to bail on errors - k8s/platform_login seems like it probably doesn't need main function given that the whole thing is tiny
Nits
- https://github.com/conjurinc/bash-lib/pull/1/files#diff-04c6e90faac2675aa89e2176d2eec7d8R124 needs bold tags
- tests-for-this-repo/python-lint/Dockerfile
/mnt
volume would probably be something else
Random thoughts
- https://github.com/conjurinc/bash-lib/pull/1/files#diff-e37f0136aa3ffaf149b351f6a4c948e9R34 We should probably think about what happens if the used doesn't have credentials to to the submodule checkout but they have the code already on the machine.
- I think pylint is a bit better than pyflake but I'd be curious to see how pyflake works nowadays
Metadata
Assignees
Labels
No labels