lint
Lint source code.
The lint
goal runs linters on your code. It also runs any formatters in check-only mode.
See here for how to opt in to specific formatters and linters, along with how to configure them.
Benefit of Pants: runs linters in parallel
Pants will run all activated linters at the same time for improved performance. You can see this through Pants's dynamic UI.
Benefit of Pants: lint Python 2 and Python 3 targets at the same time
Bandit, Flake8, and Pylint depend on which Python interpreter the tool is run with. Normally, if your project has some Python 2-only files and some Python 3-only files, you would not be able to run the linter in a single command because it would fail to parse your code.
Instead, Pants will do the right thing when you run
<<pantscmd>> lint ::
. Pants will group your targets based on their interpreter constraints, and run all the Python 2 targets together and all the Python 3 targets together.
Updated over 3 years ago