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)
Flake8 Type Annotation Checking

flake8-annotations flake8-annotations is a plugin for Flake8 that detects the absence of PEP 3107-style function annotations and PEP 484-style type co

S. Co1 118 Jan 05, 2023
Custom Python linting through AST expressions

bellybutton bellybutton is a customizable, easy-to-configure linting engine for Python. What is this good for? Tools like pylint and flake8 provide, o

H. Chase Stevens 249 Dec 31, 2022
Design by contract for Python. Write bug-free code. Add a few decorators, get static analysis and tests for free.

A Python library for design by contract (DbC) and checking values, exceptions, and side-effects. In a nutshell, deal empowers you to write bug-free co

Life4 473 Dec 28, 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 08, 2022
Mylint - My really simple rendition of how a linter works.

mylint My really simple rendition of how a linter works. This original version was written for my AST article. Since then I've added tests and turned

Tushar Sadhwani 2 Dec 29, 2021
flake8 plugin which checks that typing imports are properly guarded

flake8-typing-imports flake8 plugin which checks that typing imports are properly guarded installation pip install flake8-typing-imports flake8 codes

Anthony Sottile 50 Nov 01, 2022
mypy plugin for loguru

loguru-mypy A fancy plugin to boost up your logging with loguru mypy compatibility logoru-mypy should be compatible with mypy=0.770. Currently there

Tomasz Trębski 13 Nov 02, 2022
Mypy plugin and stubs for SQLAlchemy

Pythonista Stubs Stubs for the Pythonista iOS API. This allows for better error detection and IDE / editor autocomplete. Installation and Usage pip in

Dropbox 521 Dec 29, 2022
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
docstring style checker

pydocstyle - docstring style checker pydocstyle is a static analysis tool for checking compliance with Python docstring conventions. pydocstyle suppor

Python Code Quality Authority 982 Jan 03, 2023
Collection of awesome Python types, stubs, plugins, and tools to work with them.

Awesome Python Typing Collection of awesome Python types, stubs, plugins, and tools to work with them. Contents Static type checkers Dynamic type chec

TypedDjango 1.2k Jan 04, 2023
mypy plugin to type check Kubernetes resources

kubernetes-typed mypy plugin to dynamically define types for Kubernetes objects. Features Type checking for Custom Resources Type checking forkubernet

Artem Yarmoliuk 16 Oct 10, 2022
Pyright extension for coc.nvim

coc-pyright Pyright extension for coc.nvim Install :CocInstall coc-pyright Note: Pyright may not work as expected if can't detect project root correct

Heyward Fann 1.1k Jan 02, 2023
Convert relative imports to absolute

absolufy-imports A tool and pre-commit hook to automatically convert relative imports to absolute. Installation $ pip install absolufy-imports Usage a

Marco Gorelli 130 Dec 30, 2022
Typed interface stubs for Pythonista iOS

Pythonista Stubs Stubs for the Pythonista iOS API. This allows for better error detection and IDE / editor autocomplete. Installation and Usage pip in

Harold Martin 12 Jul 14, 2020
A simple program which checks Python source files for errors

Pyflakes A simple program which checks Python source files for errors. Pyflakes analyzes programs and detects various errors. It works by parsing the

Python Code Quality Authority 1.2k Dec 30, 2022
Utilities for refactoring imports in python-like syntax.

aspy.refactor_imports Utilities for refactoring imports in python-like syntax. Installation pip install aspy.refactor_imports Examples aspy.refactor_i

Anthony Sottile 20 Nov 01, 2022
An open-source, mini imitation of GitHub Copilot for Emacs.

Second Mate An open-source, mini imitation of GitHub Copilot using EleutherAI GPT-Neo-2.7B (via Huggingface Model Hub) for Emacs. This is a much small

Sam Rawal 238 Dec 27, 2022
Flake8 plugin to validate annotations complexity

flake8-annotations-complexity An extension for flake8 to report on too complex type annotations. Complex type annotations often means bad annotations

BestDoctor 41 Dec 28, 2022
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