Well we’ve been using mypy and other python checking for a while, but just realized that there are ton more for just about any file type:
- Shellcheck. this is a a great utility that finds all kinds of errors. In my best written shell script, it identified two serious bugs I didn’t realize that I had. The first are unreachable options to getopt. Pretty indispensable.
- Dockerfilelint. This is cruder utility. It helps with makng sure you do thinks like use
gosu
instead ofsudo
. Unfortunately, it doesn’t seem to ignore errors properly so not that useful. For instance it just searches for sudo and doesn’t know if you are doing a group likegosu usermod -aG sudo
gives it a fit as it can’t parse the command line. Also it requires pinning of every FROM line. So not that useful. - Mypy, Flake8, Bandit, Black. This is really a quite of tools for python
Here is how to deploy these:
- Syntastic. Integrate them into your editor. For vim, this is pretty complicated but I use Syntastic for this, you need to to make sure to install and then add a line to your .vimrc
- ALE. The right longer term choice is to probably use ALE as it use a real language server for it. But it is definitely slower although it runs async. Also with language servers, you could get features like renaming variables which is great.
- Neovim. As an aside, this is probably a good reason to move to neovim since the plug in architecture is better. It’s a work alike
- Pre-commit. You can add these checks as a git pre-commit check. Again useful as a defense. The syntax is pretty weird, but it works