firecracker
firecracker copied to clipboard
Add bash linter integration test
Install shellcheck (or a similar checker) inside devctr and add a python integration test that runs it on the shell scripts we have in Firecracker, like tools/devtool and other .sh files
@alindima, I would like to own this issue. IMO, the change boils down to
- Adding shellcheck to devctr.
- Resolving issues found by static analysis tool.
- Adding a
buildintegration test for verification. - Adding a devtool command to run shellcheck.
The first task may require collaboration with yourself or another maintainer. The following patch should be enough to add shellcheck via package manager.
diff --git a/tools/devctr/Dockerfile.aarch64 b/tools/devctr/Dockerfile.aarch64
index 94fcf5fa..114a45fa 100644
--- a/tools/devctr/Dockerfile.aarch64
+++ b/tools/devctr/Dockerfile.aarch64
@@ -58,6 +58,7 @@ RUN apt-get update \
bc \
flex \
bison \
+ shellcheck \
&& python3 -m pip install \
setuptools \
setuptools_rust \
diff --git a/tools/devctr/Dockerfile.x86_64 b/tools/devctr/Dockerfile.x86_64
index 1e58b406..a8929fa2 100644
--- a/tools/devctr/Dockerfile.x86_64
+++ b/tools/devctr/Dockerfile.x86_64
@@ -58,6 +58,7 @@ RUN apt-get update \
bc \
flex \
bison \
+ shellcheck \
&& python3 -m pip install \
setuptools \
wheel \
Using ubuntu:18.04, we get access to version 0.4.6-1 which is recent enough that I don't think it warrants installing from source.
Thoughts?
Hi @austinvazquez
Very happy you want to help with this issue. The steps you propose sound good to me. I will help you with pushing the docker image once the PR is up.
@dianpopa thanks for the feedback. I'll begin looking into the changes and open a PR soon.
We've discussed this with the team today and decided against adding shellcheck to our CI. This is mainly due to having bad experiences with its false-positive rates, that are similar to markdownlint, which already creates a lot of noise for us.