Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.

pandas-dev/pandas-dev-flaker

Build Status Coverage pre-commit.ci status

pandas-dev-flaker

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.

installation

pip install pandas-dev-flaker

flake8 codes

Code Description
PDF001 found import from collections.abc (use 'from collections import abc')
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
PDF013 leading space in concatenated strings
PDF014 Found '{foo!r}' formatted value (instead, use 'repr(foo)')
PDF015 found pytest.xfail (use pytest.mark.xfail instead)
PDF016 found private import across modules
PDF017 found import from 'pandas._testing' (use 'import pandas._testing as tm')
PDF018 don't import from pandas.testing
PDF019 found 'os.remove' (use 'tm.ensure_clean' instead)
PDF020 found 'np.bool' or 'np.object' (use 'np.bool_' or 'np.object_' instead)
PDF021 builtin exec used

contributing

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.

credit

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.

as a pre-commit hook

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]

About

flake8 plugin used for pandas development

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages