This repository contains a small Python package, voight-kampff
, which provides a
command line application, vk
, which can be used to run the following linters
(including some spell checkers):
- Bandit
- Black
- cspell
- isort
- Flake8
- Markdownlint
- Pydocstyle
- Pylint (including spelling)
- Pyright
This can be useful to check your entire repository before pushing the code to the remote.
In case you are wondering about the name, it was inspired by a device used to determine whether an individual is a replicant in the 1982 movie, Blade Runner.
Before you can use Voight-Kampff to run the linters, they need be installed. Some of the
linters are written in Python and can be installed through pip
. These are specified as
dependencies of Voight-Kampff and will be installed automatically when you install the
voight-kampff
package. However, a few of the linters are
Node.js-based and need to be installed using npm
. Finally
for the spell checking feature in Pylint to work, you need to have
Enchant installed. That can be done through
Homebrew or apt
depending on your OS. Installation
instructions for all dependencies on macOS as well as Debian, Ubuntu and similar are
provided below.
This section briefly describes how you can install the prerequisites on macOS. These instructions assume you already have Homebrew installed.
First you should install the prerequisites that are installed through Homebrew as follows:
brew install enchant
brew install node
The above lines will install Enchant and Node.js. Now that you have Node.js installed, you can install the linters that are based on Node.js:
npm install --global cspell
npm install --global markdownlint-cli2
npm install --global pyright
First you should install the prerequisites that are installed through apt
as follows:
sudo apt install enchant-2
sudo apt install npm
The above lines will install Enchant and Node.js. Now that you have Node.js installed, you can install the linters that are based on Node.js:
sudo npm install --global cspell
sudo npm install --global markdownlint-cli2
sudo npm install --global pyright
Assuming you have the prerequisites installed as described above, you can install Voight-Kampff as follows:
pip3 install voight-kampff
To run all of the above linters on the current directory, simply run:
vk
If you want to run only one or a few specific linters, say Black and Pylint, you can do that as follows:
vk black pylint
By default, Voight-Kampff will keep running the subsequent linters if the current one
fails the check. If you prefer that Voight-Kampff stops as soon as any linter fails, you
can specify the --break-on-error
flag -- or the short version, -B
:
vk -B