<commit_before>pytest-flakes
=============

py.test plugin for efficiently checking python source with pyflakes.


Usage
-----

install via::

    pip install pytest-flakes

if you then type::

    py.test --flakes

every file ending in ``.py`` will be discovered and run through pyflakes,
starting from the command line arguments.

Simple usage example
-----------------------------

Consider you have this code::

    # content of module.py

    import os
    from os.path import *

    def some_function():
        pass

Running it with pytest-flakes installed shows two issues::

    $ py.test -q --flakes
    F
    ================================= FAILURES =================================
    ______________________________ pyflakes-check ______________________________
    /tmp/doc-exec-685/module.py:2: UnusedImport
    'os' imported but unused
    /tmp/doc-exec-685/module.py:3: ImportStarUsed
    'from os.path import *' used; unable to detect undefined names
    1 failed in 0.00 seconds

These are only two of the many issues that pytest-flakes can find.

Configuring pyflakes options per project and file
-------------------------------------------------

You may configure pyflakes-checking options for your project
by adding an ``flakes-ignore`` entry to your ``setup.cfg``
or ``setup.cfg`` file like this::

    # content of setup.cfg
    [pytest]
    flakes-ignore = ImportStarUsed

This would globally prevent complaints about star imports.
Rerunning with the above example will now look better::

    $ py.test -q --flakes
    F
    ================================= FAILURES =================================
    _________________ pyflakes-check(ignoring ImportStarUsed) __________________
    /tmp/doc-exec-685/module.py:2: UnusedImport
    'os' imported but unused
    1 failed in 0.00 seconds

But of course we still would want to delete the ``import os`` line to
have a clean pass.

If you have some files where you want to specifically ignore
some errors or warnings you can start a flakes-ignore line with
a glob-pattern and a space-separated list of codes::

    # content of setup.cfg<commit_msg>Fix typo: setup.cfg or pytest.ini<commit_after>pytest-flakes
=============

py.test plugin for efficiently checking python source with pyflakes.


Usage
-----

install via::

    pip install pytest-flakes

if you then type::

    py.test --flakes

every file ending in ``.py`` will be discovered and run through pyflakes,
starting from the command line arguments.

Simple usage example
-----------------------------

Consider you have this code::

    # content of module.py

    import os
    from os.path import *

    def some_function():
        pass

Running it with pytest-flakes installed shows two issues::

    $ py.test -q --flakes
    F
    ================================= FAILURES =================================
    ______________________________ pyflakes-check ______________________________
    /tmp/doc-exec-685/module.py:2: UnusedImport
    'os' imported but unused
    /tmp/doc-exec-685/module.py:3: ImportStarUsed
    'from os.path import *' used; unable to detect undefined names
    1 failed in 0.00 seconds

These are only two of the many issues that pytest-flakes can find.

Configuring pyflakes options per project and file
-------------------------------------------------

You may configure pyflakes-checking options for your project
by adding an ``flakes-ignore`` entry to your ``setup.cfg``
or ``pytest.ini`` file like this::

    # content of setup.cfg
    [pytest]
    flakes-ignore = ImportStarUsed

This would globally prevent complaints about star imports.
Rerunning with the above example will now look better::

    $ py.test -q --flakes
    F
    ================================= FAILURES =================================
    _________________ pyflakes-check(ignoring ImportStarUsed) __________________
    /tmp/doc-exec-685/module.py:2: UnusedImport
    'os' imported but unused
    1 failed in 0.00 seconds

But of course we still would want to delete the ``import os`` line to
have a clean pass.

If you have some files where you want to specifically ignore
some errors or warnings you can start a flakes-ignore line with
a glob-pattern and a space-separated list of codes::

    # content of setup.cfg
{'fraction_non_alphanumeric': 0.16498946875731335, 'fraction_numerical': 0.00936110461034402, 'mean_word_length': 3.0666032350142722, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4345215', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1080, 'n_words': 457}