Linter

The galois library uses pylint for static analysis and code formatting.

Install

First, pylint needs to be installed on your system. Easily install it by installing the development dependencies.

$ python3 -m pip install .[dev]

Configuration

Various nuisance pylint warnings are added to an ignore list in pyproject.toml.

pyproject.toml
[tool.pylint]
disable = [
    "comparison-with-callable",  # pylint doesn't understand metaclass properties
    "consider-using-enumerate",
    "eval-used",
    "fixme",
    "global-statement",
    "invalid-name",
    "invalid-unary-operand-type",
    "line-too-long",
    "missing-function-docstring",
    "missing-module-docstring",
    "no-else-return",
    "not-callable",  # pylint doesn't understand metaclass properties
    "protected-access",
    "too-many-ancestors",
    "too-many-arguments",
    "too-many-branches",
    "too-many-instance-attributes",
    "too-many-lines",
    "too-many-locals",
    "unnecessary-lambda-assignment",
    "unneeded-not",
    "unsubscriptable-object",  # pylint doesn't understand metaclass properties
]
min-similarity-lines = 100

Run from the command line

Run the linter manually from the command line.

$ python3 -m pylint src/galois/

Run from VS Code

Included is a VS Code configuration file .vscode/settings.json. This instructs VS Code about how to invoke pylint. VS Code will run the linter as you view and edit files.


Last update: Oct 25, 2022