More linting is good

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:

  1. 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.
  2. Dockerfilelint. This is cruder utility. It helps with makng sure you do thinks like use gosu instead of sudo. 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 like gosu 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.
  3. Mypy, Flake8, Bandit, Black. This is really a quite of tools for python

Here is how to deploy these:

  1. 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
  2. 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.
  3. 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
  4. 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

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect

Recent posts

Loading Mastodon feed…