Skip to main content

Linter for contributing to pandas

Project description

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 builtin 'filter' function used
PDF003 builtin 'exec' function used
PDF004 'foo.__class__' used, (use 'type(foo)' instead)
PDF005 leading space in concatenated strings
PDF006 Found '{foo!r}' formatted value (instead, use 'repr(foo)')
PDF007 line split in two unnecessarily by 'black' formatter
PDF008 found 'os.remove' (use 'tm.ensure_clean' instead)
PDF009 'pytest.raises' used without 'match='
PDF010 'pytest.raises' used outside of context manager
PDF011 found 'pytest.warns' (use 'pandas._testing.assert_produces_warning')
PDF012 found 'pytest.xfail' (use 'pytest.mark.xfail' instead)
PDF013 import from 'conftest' found
PDF014 found import from 'pandas._testing' (use 'import pandas._testing as tm')
PDF015 from import from 'pandas.testing' (use 'import pandas._testing as tm')
PDF016 found 'unittest.mock' (use 'pytest.monkeypatch' instead)
PDF017 'pd.api.types' used (import from 'pandas.api.types' instead)
PDF018 'common' imported from 'pandas.core' without 'comm' alias
PDF019 found both 'pd.foo' and 'foo' in the same file
PDF020 found private import across modules
PDF021 found 'np.bool' or 'np.object' (use 'np.bool_' or 'np.object_' instead)
PDF022 found import from 'numpy.random'

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.1.0]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas_dev_flaker-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandas_dev_flaker-0.1.0-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pandas_dev_flaker-0.1.0.tar.gz.

File metadata

  • Download URL: pandas_dev_flaker-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for pandas_dev_flaker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1242a1750a8498dc85374f0fe91fc8e1d6dcc910cd4c09f6d7d52915a5ca5aaf
MD5 9ba894463979103fa4b95a906bb51feb
BLAKE2b-256 adf9f118dfeefc009a8041d7e3594d7d2bc519d80c73955a5126995bbb34bf50

See more details on using hashes here.

File details

Details for the file pandas_dev_flaker-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pandas_dev_flaker-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for pandas_dev_flaker-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0a4707fde95d821848607477ab49772c334900aea45326a288571dff767e7ace
MD5 f834871e34297475d2fcde27fa1b8fe1
BLAKE2b-256 0cac8771de8fb360364b2128ebd50dd8355bc22e00dc1b379e8c477283dc0852

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page