Flake8 plugin to find commented out or dead code

Overview

flake8-eradicate

wemake.services Build Status codecov Python Version PyPI version wemake-python-styleguide

flake8 plugin to find commented out (or so called "dead") code.

This is quite important for the project in a long run. Based on eradicate project.

Installation

pip install flake8-eradicate

It is also a valuable part of wemake-python-styleguide.

Usage

Run your flake8 checker as usual. Commented code should raise an error.

Example:

flake8 your_module.py

Options

  • --eradicate-aggressive to enable aggressive mode from eradicate, can lead to false positives
  • --eradicate-whitelist to overwrite the whitelist from eradicate (# separated list)
  • --eradicate-whitelist-extend to extend the whitelist from eradicate (# separated list)

Error codes

Error code Description
E800 Found commented out code

Output example

Here's how output looks like (we are using wemake formatter):

flake8-eradicate output

License

MIT.

Comments
  • Release master branch on PyPi

    Release master branch on PyPi

    The current version of this plugin on PyPi (1.2.1) is not able to run with flake8's current version (5.0.1). This has been fixed in #262 but has not been updated on PyPi. Please could this be done?

    opened by CalumY 12
  • fix performance issue due to search in tokens

    fix performance issue due to search in tokens

    Fixes #176

    I looked into this and the issue was in the following block

    comment_in_line = any(
        token_type == tokenize.COMMENT
        for token_type, _, _, _, _ in self._tokens)
    

    self._tokens is actually containing the tokens from beginning of the file until the physical line yielded by flake8, this means that self._tokens is getting bigger and bigger every time flake8 invokes this plugin on the next lines, thus searching in self._tokens gets more and more expensive for large files as it's inefficient to search in large list by design (the large file is > 12000 lines so that makes a lot of tokens).

    I switch the code to process the whole file instead of work line by line, that way it has to search for the comment token only once.

    On the long python file attached in #176, this makes the processing time go from 30 sec to just 2 sec :rocket:

    opened by bagerard 11
  • Update to new eradicate api

    Update to new eradicate api

    Even so the API of eradicate does change the new implementation is not that different.

    • I updated the usage of eradicate's API
    • I added the new CLI flags: --eradicate-whitelist and --eradicate-whitelist-extend which correspond to the appropriate flags from eradicate.
    • I removed the _Options class because I could not find a reason to keep it. Instead it is now a dict.
    • I removed the in_place option which was present in the _Options class because this setting only effects Eradicate.fix_file() which is the 'parent' function to the here used Eradicate.filter_commented_out_code() and does not get called.
    • I fixed test_incorrect_fixture() which should have failed on current master but does not. I dunno why.
    • I added 2 new tests for the new CLI args.
    • I updated the docs with the new CLI args

    EDIT: when eradicate 2.0.0 is released I will update the dependency and finish this PR. Then the CI should also succeed. I tested all thing the CI does locally with success.

    opened by Cielquan 11
  • `noqa` comments are detect as code

    `noqa` comments are detect as code

    This line raises an E800 warning.

    
    # noqa: A100
    
    

    These do not:

    
    # noqa: 100
    # noqa: something
    # noqa: "Something"
    
    

    If anything, the second block might be code (like a line of a multi-line dictionary definition). The first block is a valid noqa-comment and should not raise that warning.

    bug 
    opened by tbrlpld 11
  • Black formatting flags as code

    Black formatting flags as code

    If you're in the unfortunate situation of having to deal with Black formatting, then this plugin catches the on/off markers as if they were code. Maybe just needs a specific whitelist for these 2 lines:

    # fmt: off
    # fmt: on
    
    bug dependencies 
    opened by Dreamsorcerer 7
  • [Regression] `flake8-eradicate==1.0.0` conflicts with `wemake-python-styleguide` under GHA

    [Regression] `flake8-eradicate==1.0.0` conflicts with `wemake-python-styleguide` under GHA

    I don't know if this is the right repo for this issue but my best guess is that it is.

    I'm using pre-commit.com too and I have an upstream flake8 hook set up. I've added flake8-eradicate>=1.0.0 and wemake-python-styleguide there. That seemed to work fine in local envs of developers under different OSs. But in GitHub Actions CI/CD something shady started happening, something quite unobvious and hard to debug. I suspected that some flake8 plugins misbehave but I had no idea which ones.

    flake8 started failing with violations that were supposed to be ignored in the config. It wasn't really obvious in the CI because I used the wemake formatter and it somehow didn't show the error messages, only some lines from code. Example: https://github.com/ansible/pylibssh/runs/1566735649?check_suite_focus=true#step:11:31

    I had to break into those GHA runner VMs over SSH using https://github.com/marketplace/actions/debugging-with-tmate to gather more intel! Commenting out #format = wemake revealed another unexpected detail — almost all of those error messages had error codes prefixed with a letter they weren't supposed to use — Z. Things like these came up:

    tests/conftest.py:14:1: Z101 Found nested import "pylibsshext.session"
    from pylibsshext.session import Session
    ^
    tests/conftest.py:44:9: Z111 Found bare raise outside of except "raise"        raise
            ^
    tests/conftest.py:122:9: Z110 Found wrong keyword "del"
            del ssh_session  # noqa: WPS420
            ^
    

    I've commented out the flake8-eradicate>=1.0.0 line and it reported no violations when the version required by wemake-python-styleguide, which is flake8-eradicate (>=0.3,<0.4) (ref https://pypi.org/pypi/wemake-python-styleguide/json), was used.

    I confirmed that when I tried to re-add flake8-eradicate>=1.0.0, it started throwing errors at me again. Then, I removed the wemake-python-styleguide line keeping flake8-eradicate>=1.0.0 in place and that worked too.

    STR: fork https://github.com/ansible/pylibssh/tree/55b241a001c3621d68776f244a46650bfa5590f9, stick https://github.com/ansible/pylibssh/commit/b4f27eaac023ed8164f14128c85ce97b0e3fda1c there and connect over SSH to see the env.

    N.B. I have no clue why but it's only happening under the GitHub Actions VMs and not locally (checked under CPython 3.8 and 3.9).

    opened by webknjaz 6
  • Resolves Issue #103 noqa comments

    Resolves Issue #103 noqa comments

    Previously, noqa comments inside of a multi-line docstring where flagged as commented out code. When using eradicate directly on a file which includes such a noqa comment it does not show a violation.

    Example of such a multi-line docstring:

    def some_function():
        """
        Test for noqa comments in docstrings.
    
        This function has a multi-line doc string, but no return value is
        stipulated, while the function defines a return. This would raise DAR201
        flake8 violation. To suppress this raise violation the following noqa
        comment is defined in the docstring.
    
        # noqa: DAR201
    
        This noqa comment should not be detected as commented out code. `eradicate`
        itself does not raise this as a violation.
    
        """
        return "something"
    

    This kind of noqa comments are needed to suppress violations raised by darglint, e.g. violations associated with missing return statements in the docstring.

    This issue is caused by passing isolated physical lines of code to the eradicate function filter_commented_out_code. That function does expect to operate on a file's whole source code rather than on isolated lines of code. From the whole source code the context of each line can be determined. This allows differentiation between actual comment lines and lines that only look like comments.

    To resolve this issue, while still keeping the checker on one physical line at a time, a preliminary test is introduced that checks if the current physical line contains a comment according to the tokens of the physical line. These tokens are available as input to the plugin from flake8.

    Solves #103

    opened by tbrlpld 5
  • The

    The "setuptools" requirement should be explicitly defined (ModuleNotFoundError: No module named 'pkg_resources').

    Due to the usage of the "pkg_resources" module, the "setuptools" requirement should be explicitly defined (in this project, it is runtime requirement as well as installation time requirement). Because there are tools (such as Pants) that, after installing the library, do not maintain the installation time requirements, hence, this error is given:

    ModuleNotFoundError: No module named 'pkg_resources'
    

    which raises this exception on the Flake8:

    flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "E8" due to No module named 'pkg_resources'.
    
    opened by AlirezaRoshanzamir 4
  • Bump flake8-isort from 2.8.0 to 2.9.0

    Bump flake8-isort from 2.8.0 to 2.9.0

    Bumps flake8-isort from 2.8.0 to 2.9.0.

    Changelog

    Sourced from flake8-isort's changelog.

    2.9.0 (2020-03-16)

    • Add python3.8 suport. [sobolevn]
    Commits
    • 3a61ab9 Preparing release 2.9.0
    • ea22956 chore: tell zest.releaser where to look for the version
    • fb456d7 Merge pull request #82 from sobolevn/issue-81
    • 3528753 Adds python3.8, closes #81
    • ef75d34 Merge pull request #80 from jnns/show-version
    • 8cd892b Fix version display in flake8 --help
    • 8af7b8f Merge pull request #76 from pedrofreire/isort-version
    • eea5dff Increase required isort version to 4.3.5.
    • a3c084f Back to development: 2.8.1
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump flake8-bugbear from 19.8.0 to 20.1.4

    Bump flake8-bugbear from 19.8.0 to 20.1.4

    Bumps flake8-bugbear from 19.8.0 to 20.1.4.

    Release notes

    Sourced from flake8-bugbear's releases.

    20.1.4

    • Ignore keywords for B009/B010

    20.1.3

    • Silence B009/B010 for non-identifiers
    • State an ignore might be needed for optional B9x checks

    20.1.2

    Refer to README.rst for changes.

    20.1.1

    Refer to README.rst for changes.

    20.1.0

    Refer to README.md for changes.

    Commits
    • 80b280c Move to version 20.1.4 + Update CHANGES in README.rst
    • 891fc92 Don't emit B009/B010 for keywords (#117)
    • e233647 Move to Version 20.1.3 + Update CHANGES in README.rst
    • 7a07a5b Silence B009/B010 for non-identifiers (#116)
    • 76ee744 State an ignore might be needed for optional B9x checks (#115)
    • 9e5c19d Move to Version 20.1.2 + Update CHANGES in README.rst
    • 238001d Fix error on attributes-of-attributes in except (...): clauses (#109)
    • 3731237 Move to Version 20.1.1 + Update CHANGES in README.rst
    • e35343c Add new checks for except (...): clauses (#105)
    • 04dd13b B012 Fix false positive with continue/break in loops in finally (#107)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump mypy from 0.760 to 0.770

    Bump mypy from 0.760 to 0.770

    Bumps mypy from 0.760 to 0.770.

    Commits
    • 92e3f39 Bump version to 0.770.
    • c4d8554 Support narrowing of walrus in most cases (#8458)
    • dc0d35f Revert "mypy: remove has_member (#8438)" (#8500)
    • 30c46ab Properly track module_hidden and module_public for incomplete symbols (#8450)
    • ef0b0df Use fully qualified names for ambiguous class names resembling builtins. (#8425)
    • d128158 Sync typeshed (#8448)
    • 09cdab4 mypy: remove has_member (#8438)
    • 7af3191 Make ModuleFinder try identifying non-PEP 561 packages (#8238)
    • 14ac8af [mypyc] Refactor methods into top-level functions in mypyc.genstatement (#8432)
    • ce24783 [mypyc] Refactor: extract builtin function specializers from genops (#8431)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump attrs from 22.1.0 to 22.2.0

    Bump attrs from 22.1.0 to 22.2.0

    Bumps attrs from 22.1.0 to 22.2.0.

    Release notes

    Sourced from attrs's releases.

    22.2.0

    Highlights

    It's been a lot busier than the changelog indicates, but a lot of the work happened under the hood (like some impressive performance improvements). But we've got still one big new feature that's are worthy the holidays:

    Fields now have an alias argument that allows you to set the field's name in the generated __init__ method. This is especially useful for those who aren't fans of attrs's behavior of stripping underscores from private attribute names.

    Special Thanks

    This release would not be possible without my generous sponsors! Thank you to all of you making sustainable maintenance possible! If you would like to join them, go to https://github.com/sponsors/hynek and check out the sweet perks!

    Above and Beyond

    Variomedia AG (@​variomedia), Tidelift (@​tidelift), Sentry (@​getsentry), HiredScore (@​HiredScore), FilePreviews (@​filepreviews), and Daniel Fortunov (@​asqui).

    Maintenance Sustainers

    @​rzijp, Adam Hill (@​adamghill), Dan Groshev (@​si14), Tamir Bahar (@​tmr232), Adi Roiban (@​adiroiban), Magnus Watn (@​magnuswatn), David Cramer (@​dcramer), Moving Content AG (@​moving-content), Stein Magnus Jodal (@​jodal), Iwan Aucamp (@​aucampia), ProteinQure (@​ProteinQure), Jesse Snyder (@​jessesnyder), Rivo Laks (@​rivol), Thomas Ballinger (@​thomasballinger), @​medecau, Ionel Cristian Mărieș (@​ionelmc), The Westervelt Company (@​westerveltco), Philippe Galvan (@​PhilippeGalvan), Birk Jernström (@​birkjernstrom), Jannis Leidel (@​jezdez), Tim Schilling (@​tim-schilling), Chris Withers (@​cjw296), and Christopher Dignam (@​chdsbd).

    Not to forget 2 more amazing humans who chose to be generous but anonymous!

    Full Changelog

    Backwards-incompatible Changes

    • Python 3.5 is not supported anymore. #988

    Deprecations

    • Python 3.6 is now deprecated and support will be removed in the next release. #1017

    Changes

    • attrs.field() now supports an alias option for explicit __init__ argument names.

      Get __init__ signatures matching any taste, peculiar or plain! The PEP 681 compatible alias option can be use to override private attribute name mangling, or add other arbitrary field argument name overrides. #950

    • attrs.NOTHING is now an enum value, making it possible to use with e.g. typing.Literal. #983

    • Added missing re-import of attr.AttrsInstance to the attrs namespace. #987

    • Fix slight performance regression in classes with custom __setattr__ and speedup even more. #991

    • Class-creation performance improvements by switching performance-sensitive templating operations to f-strings.

      You can expect an improvement of about 5% -- even for very simple classes. #995

    ... (truncated)

    Changelog

    Sourced from attrs's changelog.

    22.2.0 - 2022-12-21

    Backwards-incompatible Changes

    • Python 3.5 is not supported anymore. #988

    Deprecations

    • Python 3.6 is now deprecated and support will be removed in the next release. #1017

    Changes

    • attrs.field() now supports an alias option for explicit __init__ argument names.

      Get __init__ signatures matching any taste, peculiar or plain! The PEP 681 compatible alias option can be use to override private attribute name mangling, or add other arbitrary field argument name overrides. #950

    • attrs.NOTHING is now an enum value, making it possible to use with e.g. typing.Literal. #983

    • Added missing re-import of attr.AttrsInstance to the attrs namespace. #987

    • Fix slight performance regression in classes with custom __setattr__ and speedup even more. #991

    • Class-creation performance improvements by switching performance-sensitive templating operations to f-strings.

      You can expect an improvement of about 5% -- even for very simple classes. #995

    • attrs.has() is now a TypeGuard for AttrsInstance. That means that type checkers know a class is an instance of an attrs class if you check it using attrs.has() (or attr.has()) first. #997

    • Made attrs.AttrsInstance stub available at runtime and fixed type errors related to the usage of attrs.AttrsInstance in Pyright. #999

    • On Python 3.10 and later, call abc.update_abstractmethods() on dict classes after creation. This improves the detection of abstractness. #1001

    • attrs's pickling methods now use dicts instead of tuples. That is safer and more robust across different versions of a class. #1009

    • Added attrs.validators.not_(wrapped_validator) to logically invert wrapped_validator by accepting only values where wrapped_validator rejects the value with a ValueError or TypeError (by default, exception types configurable). #1010

    • The type stubs for attrs.cmp_using() now have default values. #1027

    • To conform with PEP 681, attr.s() and attrs.define() now accept unsafe_hash in addition to hash. #1065

    Commits
    • a9960de Prepare 22.2.0
    • 566248a Don't linkcheck tree links
    • 0f62805 Make towncrier marker independent from warning
    • b9f35eb Fix minor stub issues (#1072)
    • 4ad4ea0 Use MyST-native include
    • 519423d Use MyST-native doctest blocks in all MD
    • 403adab Remove stray file
    • 6957e4a Use new typographic branding in the last rst file, too
    • 1bb2864 Convert examples.rst to md
    • c1c24cc Convert glossary.rst to md
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 0
  • Support flake8 6.0

    Support flake8 6.0

    This PR updates dependencies to support flake8 >= 6.0:

    • Drops support for Python 3.7, adds support for Python 3.11
    • Drops support for flake8-quotes since it isn't yet compatible
    • Upgrades the other dependencies to their latest versions
    • Bumps the version of flake8-eradicate to 1.5.0
    opened by danyeaw 2
  • False-Positive E800 in multiline docstring based on content

    False-Positive E800 in multiline docstring based on content

    $ flake8 --version
    5.0.4 (flake8-eradicate: 1.4.0, mccabe: 0.7.0, pycodestyle: 2.9.1, pyflakes: 2.5.0) CPython 3.9.15 on Linux
    

    Working Code:

    """
    #
    # Copyright (c) 2022. All rights reserved.
    #
    # Project:    Test project
    # Created:    2022-09-23
    #
    # @package
    # @subpackage
    # @author
    #
    """
    

    Output:

    $ flake8
    $ echo $?
    0
    

    Failing Code (Only date changed):

    """
    #
    # Copyright (c) 2022. All rights reserved.
    #
    # Project:    Test project
    # Created:    2022-11-23
    #
    # @package
    # @subpackage
    # @author
    #
    """
    

    Output:

    $ flake8
    ./main.py:6:1: E800 Found commented out code
    $ echo $?
    1
    

    same thing happens if project is changed to a single word (e.g. test-project). Seems to be somehow related to the colons after Project/Created, if I remove them the errors disappear.

    opened by manuelmaurer 0
  • Compat with flake8 >= 6

    Compat with flake8 >= 6

    Notably, flake8 bumped min python version to 3.8.1

    https://flake8.pycqa.org/en/latest/release-notes/6.0.0.html

    I can draft a PR based on what you want to do, either:

    • minimal changes increasing flake8's upper bound
    • big changes with a 2.0, aligning with flake8 in supporting >= 3.8.1, 3.11 support
    opened by g-as 7
  • Content of f-string interpreted as commented code

    Content of f-string interpreted as commented code

    Using flake8-eradicate==1.2.1 On CPython 3.9.13 With flake8==4.0.1 Using the following code as an example

    class FooClass(SpamClass):
        def render_html(self) -> str:
            return f"""
            <div>
                <div>
                    <h2>
                        spam content <bold>{self.foo.bar().car()}</bold> to <bold>foo</bold><br/>
                    </h2>
                    <i>
                        “Some quote.”
                        <br/>~Quote author
                    <i/>
                <div>
                </div>
                    <table>
                        <tbody>
                            <tr>
                                <td><bold>Foo foo</bold></td>
                                <td>{self.bar.foo}</td>
                            </tr>
                            <tr>
                                <td><bold>Bar foo</bold></td>
                                <td>{self.barbar.foo}</td>
                            </tr>
                            <tr>
                                <td><bold>Foo spam</bold></td>
                                <td>
                                    <a href="https://service.com/spam/foo/bar/{self.foo.car}">
                                        #{self.foo.car}
                                    <a/>
                                </td>
                            </tr>
                            <tr>
                                <td><bold>Spam bar</bold></td>
                                <td>{self.foo()}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            """
    

    Following snipped, line #{self.foo.car} generates an error Found commented out code flake8(E800)

    <a href="https://service.com/spam/foo/bar/{self.foo.car}">
        #{self.foo.car}
    <a/>
    

    Which, of course, is not correct because we are not dealing with a comment here. Removing the # from the content makes the error disappear, however, this is not the solution.

    opened by krzysztof3-wisniewski 0
  • Issue with flake8-noqa, flake8-eradicate and commented out code

    Issue with flake8-noqa, flake8-eradicate and commented out code

    Hello. I'm using flake8, flake8-noqa & flake8-eradicate. Until flake8-noqa==1.2.5 it worked fine, but now I encounter weird behaviour.

    Python version

    $ python --version
    Python 3.9.10
    

    Dependencies: flake8==5.0.4 flake8-eradicate==1.4.0 flake8-noqa==1.2.9

    Current behaviour

    code.py

    # a = 5
    a = 7
    

    flake8 run

    $ flake8 code.py
    code.py:1:1: E800 Found commented out code
    

    code.py

    # a = 5  # noqa: E800
    a = 7
    

    flake8 run

    $ flake8 code.py
    code.py:1:1: NQA102 "# noqa: E800" has no matching violations
    

    Expected behaviour

    code.py

    # a = 5
    a = 7
    

    flake8 run

    $ flake8 code.py
    code.py:1:1: E800 Found commented out code
    

    code.py

    # a = 5  # noqa: E800
    a = 7
    

    flake8 run -- no error

    $ flake8 code.py
    

    I created the same issue in flake8-noqa repository but its author pointed out that the issue could be in your package. Can you please take a look?

    opened by shestakovks 0
Releases(1.4.0)
A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.

flake8-bugbear A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycode

Python Code Quality Authority 869 Dec 30, 2022
❄️ A flake8 plugin to help you write better list/set/dict comprehensions.

flake8-comprehensions A flake8 plugin that helps you write better list/set/dict comprehensions. Requirements Python 3.6 to 3.9 supported. Installation

Adam Johnson 398 Dec 23, 2022
Flake8 plugin that checks import order against various Python Style Guides

flake8-import-order A flake8 and Pylama plugin that checks the ordering of your imports. It does not check anything else about the imports. Merely tha

Python Code Quality Authority 270 Nov 24, 2022
flake8 plugin that integrates isort

Flake8 meet isort Use isort to check if the imports on your python files are sorted the way you expect. Add an .isort.cfg to define how you want your

Gil Forcada Codinachs 139 Nov 8, 2022
flake8 plugin to run black for checking Python coding style

flake8-black Introduction This is an MIT licensed flake8 plugin for validating Python code style with the command line code formatting tool black. It

Peter Cock 146 Dec 15, 2022
A plugin for flake8 integrating Mypy.

flake8-mypy NOTE: THIS PROJECT IS DEAD It was created in early 2017 when Mypy performance was often insufficient for in-editor linting. The Flake8 plu

Łukasz Langa 103 Jun 23, 2022
flake8 plugin to catch useless `assert` statements

flake8-useless-assert flake8 plugin to catch useless assert statements Download or install on the PyPI page Violations Code Description Example ULA001

null 1 Feb 12, 2022
Utilities for pycharm code formatting (flake8 and black)

Pycharm External Tools Extentions to Pycharm code formatting tools. Currently supported are flake8 and black on a selected code block. Usage Flake8 [P

Haim Daniel 13 Nov 3, 2022
The official GitHub mirror of https://gitlab.com/pycqa/flake8

Flake8 Flake8 is a wrapper around these tools: PyFlakes pycodestyle Ned Batchelder's McCabe script Flake8 runs all the tools by launching the single f

Python Code Quality Authority 2.6k Jan 3, 2023
Flake8 extension for checking quotes in python

Flake8 Extension to lint for quotes. Major update in 2.0.0 We automatically encourage avoiding escaping quotes as per PEP 8. To disable this, use --no

Zachary Heller 157 Dec 13, 2022
Flake8 wrapper to make it nice, legacy-friendly, configurable.

THE PROJECT IS ARCHIVED Forks: https://github.com/orsinium/forks It's a Flake8 wrapper to make it cool. Lint md, rst, ipynb, and more. Shareable and r

Life4 232 Dec 16, 2022
Automated security testing using bandit and flake8.

flake8-bandit Automated security testing built right into your workflow! You already use flake8 to lint all your code for errors, ensure docstrings ar

Tyler Wince 96 Jan 1, 2023
Flake8 extension for enforcing trailing commas in python

Flake8 Extension to enforce better comma placement. Usage If you are using flake8 it's as easy as: pip install flake8-commas Now you can avoid those a

Python Code Quality Authority 127 Sep 3, 2022
Tool to automatically fix some issues reported by flake8 (forked from autoflake).

autoflake8 Introduction autoflake8 removes unused imports and unused variables from Python code. It makes use of pyflakes to do this. autoflake8 also

francisco souza 27 Sep 8, 2022
Flake8 extension to provide force-check option

flake8-force Flake8 extension to provide force-check option. When this option is enabled, flake8 performs all checks even if the target file cannot be

Kenichi Maehashi 9 Oct 29, 2022
Pylint plugin for improving code analysis for when using Django

pylint-django About pylint-django is a Pylint plugin for improving code analysis when analysing code using Django. It is also used by the Prospector t

Python Code Quality Authority 544 Jan 6, 2023
Tool for pinpointing circular imports in Python. Find cyclic imports in any project

Pycycle: Find and fix circular imports in python projects Pycycle is an experimental project that aims to help python developers fix their circular de

Vadim Kravcenko 311 Dec 15, 2022
A Pylint plugin to analyze Flask applications.

pylint-flask About pylint-flask is Pylint plugin for improving code analysis when editing code using Flask. Inspired by pylint-django. Problems pylint

Joe Schafer 62 Sep 18, 2022
OpenStack Hacking Style Checks. Mirror of code maintained at opendev.org.

Introduction hacking is a set of flake8 plugins that test and enforce the OpenStack StyleGuide Hacking pins its dependencies, as a new release of some

Mirrors of opendev.org/openstack 224 Jan 5, 2023