Plugin for flake8 used to contribute to pandas.
NOTE: this is not a linter meant for pandas usage, but for pandas development. If you want a linter for pandas usage, please see pandas-vet.
pip install pandas-dev-flaker
| Code | Description |
|---|---|
| PDF001 | import from collections.abc (use 'from collections import abc' instead) |
| PDF002 | pd.api.types used (import from pandas.api.types instead) |
| PDF003 | pytest.raises used without 'match=' |
| PDF004 | builtin filter function used |
| PDF005 | 'pytest.raises' used outside of context manager |
| PDF006 | builtin exec used |
| PDF007 | 'pytest.warns' used (use 'tm.assert_produces_warning' instead) |
| PDF008 | 'foo.__class__' used, (use 'type(foo)' instead) |
| PDF009 | 'common' imported from 'pandas.core' without 'comm' alias |
| PDF010 | import from 'conftest' found |
| PDF011 | found both 'pd.foo' and 'foo' in the same file |
| PDF012 | line split in two unnecessarily by 'black' formatter |
See contributing.md for how to get started.
Each new linting rule should be its own file inside pandas-dev-flaker/_plugins. Please linting rule should have two sets of tests in pandas-dev-flaker/tests - one for when the linting rule is expected to pass, and another for when it's expected to fail.
Several methods are simplified versions of methods from pyupgrade. Some of the checks were taken from the pandas repo. Please find both their licenses in the LICENSES folder.
See pre-commit for instructions
Sample .pre-commit-config.yaml:
- repo: https://github.com/pycqa/flake8
rev: 3.9.0
hooks:
- id: flake8
additional_dependencies: [pandas-dev-flaker==0.0.1]