Giter VIP home page Giter VIP logo

flake8-dunder-all's People

Contributors

domdfcoding avatar peterschutt avatar pre-commit-ci[bot] avatar repo-helper[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

flake8-dunder-all's Issues

Possible incompatibility with Flake8 >= 5.0.4

Description

After upgrading flake I seem to be getting the below error...

There was a critical error during execution of Flake8:
plugin code for `flake8-dunder-all[DALL]` does not match ^[A-Z]{1,3}[0-9]{0,3}$

Steps to Reproduce

  1. Install flake8 5.0.3
  2. Install flake8-dunder-all
  3. Try lint some python code

Actual result:

There was a critical error during execution of Flake8:
plugin code for `flake8-dunder-all[DALL]` does not match ^[A-Z]{1,3}[0-9]{0,3}$

Expected result:

No critical error.

Reproduces how often:

Easily reproduced

Version

  • Operating System: Arch
  • Python: 3.10.5
  • flake8: 5.0.4
  • flake8-dunder-all: 0.2.2

flake8 and flake8-dunder-all is installed in a tox environment using "deps = flake8 flake8-dunder-all".

Release next version to PyPI

Hi, I've noticed that you've fixed the incompatibility with newer flake8 versions due to the 4 letter entry point name, which newer flake8 versions don't like in: 6b530db. However this commit is not yet available on PyPI.

Because of this, anyone interested in using this extension has to use flake8 version 4.0.1, or older, which is not ideal, considering flake8 version 6.0.0 is already out. In many cases, newer addons might not even be available for this old flake8 version, forcing people to choose between this extension or the new one they'd like to install (such as flake8-bandit).

As a temporary solution for anyone who's also having this issue, you can install flake8-dunder-all from latest master directly, as pip supports installations from git repositories. To do this, you can use: pip install 'flake8-dunder-all git+https://github.com/python-formate/flake8-dunder-all.

However even though there is a workaround, this really isn't ideal and a new version should be released instead ASAP.

Fails with newer versions of flake8

Hi there, the code for the lib is no longer supported by flake8:

There was a critical error during execution of Flake8:
plugin code for `flake8-dunder-all[DALL]` does not match ^[A-Z]{1,3}[0-9]{0,3}$

To reproduce, execute:

  - repo: https://github.com/PyCQA/flake8
    rev: 6.0.0
    hooks:
      - id: flake8
        additional_dependencies:
          [
            "flake8-dunder-all",
          ]

Can't ignore DALL000 through config file on flake8 v6

Description

Trying to ignore DALL000 globally using a config file leads to a validation error when using flake8 v6.0.0

Steps to Reproduce

Run flake8 with the following .flake8 config file

[flake8]
ignore = DALL000

Actual result:

Traceback (most recent call last):
le_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Lucina\.pyenv\pyenv-win\versions\3.10.0\lib\runpy.py", line 86, in _run_code        
    exec(code, run_globals)
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\Scripts\flake8.exe\__main__.py", line 7, in <module>
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\lib\site-packages\flake8\main\cli.py", line 23, in main
    app.run(argv)
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\lib\site-packages\flake8\main\application.py", line 198, in run
    self._run(argv)
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\lib\site-packages\flake8\main\application.py", line 186, in _run
    self.initialize(argv)
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\lib\site-packages\flake8\main\application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\lib\site-packages\flake8\options\parse_args.py", line 53, in parse_args
    opts = aggregator.aggregate_options(option_manager, cfg, cfg_dir, rest)
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\lib\site-packages\flake8\options\aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)
  File "C:\Users\Lucina\Documents\vsc\Tanjun\venv\lib\site-packages\flake8\options\config.py", line 131, in parse_config
    raise ValueError(
ValueError: Error code 'DALL000' supplied to 'ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'

Expected result:

An error code which'll pass these checks is provided

Reproduces how often:

Every time this is used in the ignore section of a config file

Version

  • Operating System: Windows and Linux
  • Python: 3.9 and 3.10
  • flake8-dunder-all: 0.3.0
  • flake8: 6.0.0

Installation source

Pip

sort order of `__all__`

Hi,

would it be possible to check for an alphabetical sort order of the list items in __all__?

Automatically ignore tests and __main__.py

Description

There's no reason for tests, or for __main.py__, to export anything. Therefore __all__ is unnecessary. Instead of having to amnually configure this for every project, it would be great if this could be automatically determined by the plugin.

Version

  • Operating System: N/A
  • Python: 3.10
  • flake8-dunder-all: latest

Other Additional Information:

I read the docs and the code and couldn't find any evidence of this functionality existing yet.

bug: TYPE_CHECKING block that contains things other than imports.

Hi, thanks for releasing 0.4.0 with the handling for if TYPE_CHECKING.

I encountered one issue when applying this to our code base, where the block contained logic other than just imports the __all__ would be injected within that logic breaking the syntax.

E.g.,

from typing import TYPE_CHECKING

if TYPE_CHECKING:
	try:
		from x import y
	except ImportError:
		pass

def a_function():
	from hello import world

Ends up like:

from typing import TYPE_CHECKING

if TYPE_CHECKING:
	try:
		from x import y
	except ImportError:
__all__ = ["a_function"]


		pass

def a_function():
	from hello import world

Other configurations are possible too, e.g.:

if TYPE_CHECKING:
    ...
else:
    ...

Any suggestions on how to handle this type of thing?

One approach might be to only handle the first if TYPE_CHECKING block encountered in the module, and only if end_linenum is available for the if node. That way we can just skip it that whole block and otherwise, leave behavior as it is was in 0.3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.