Skip to main content
Version: 2.0 (deprecated)

lint

Lint source code.


The lint goal runs both dedicated linters and any formatters in check-only mode:

  • Bandit
  • Black
  • Docformatter
  • Flake8
  • isort
  • Pylint

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-only and Python 3-only code 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 ./pants 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.