Add shfmt for sh and bats#2642
Merged
mrunalp merged 4 commits intoopencontainers:masterfrom Oct 20, 2020
Merged
Conversation
Various bats tests use various types of indentation (about half is tabs, the rest is 2 spaces, 4 spaces, etc.). Let's bring it to one style (tabs) using recently added shfmt support for bats files (see [1]). This commit is brought to you by shfmt -ln bats -w tests/integration/*.bats [1] mvdan/sh#600 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Note that you need a very recent shfmt (such as mvdan/sh@08ecaf9adf4bb75). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
I played with shfmt options (-bn, -ci, -sr) a bit trying to minimize the patch generated (and also because I don't have a strong preference on these matters), and it appears to be that the patch size is about the same nevertheless, so I chose no options. This commit is brought to you by shfmt -ln bash -w man/*.sh script/*.sh tests/*.sh tests/integration/*.bash Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
AkihiroSuda
approved these changes
Oct 12, 2020
mrunalp
approved these changes
Oct 20, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. tests/integration/*.bats: reformat with shfmt
Various bats tests use various types of indentation (about half
is tabs, the rest is 2 spaces, 4 spaces, etc.).
Let's bring it to one style (tabs) using recently added
shfmt support for bats files (see mvdan/sh#600).
This commit is brought to you by
2. CI: add shfmt for bats
Note that you need a very recent shfmt (such as
mvdan/sh@08ecaf9adf4bb75).
3. *.sh: use shfmt
I played with shfmt options (-bn, -ci, -sr) a bit trying to minimize
the patch generated (and also because I don't have a strong preference
on these matters), and it appears to be that the patch size is about the
same nevertheless, so I chose no options.
This commit is brought to you by
4. CI: add shfmt for sh files
Fixes: #2396