question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: missing plugin flake8 after upgrade from 3.0.0 to 3.2.0

See original GitHub issue

Checklist

  • Same issue occurs when reproducing the MWE below: new virtualenv, clean folder, minimal additional libs, etc.
  • Same issue occurs when running without cache (eg by setting the env var FLAKEHEAVEN_CACHE_TIMEOUT=0)

Bug Description

if you change version from 3.0.0 to 3.x.0 it does not run; it complains about lacking of flake8 plugin

Expected behavior

it runs as before

Bug Repro

  1. OS, arch 12.6, intel based
  2. python --version Python 3.9.6
  3. pyproject.toml (and / or all other config files that apply, eg .pylintrc, stc)
[tool.black]
line-length = 120
target-version = ['py37']
exclude = '''
/(
    \.git
  | \.github
  | \.mypy_cache
  | \.pytest_cache
  | \.idea
  | venv
  | venv_linter
  | venv_tests
  | \.local
  | makefile\.inc
  | build
  | dist
)/
'''

[tool.isort]
profile = 'black'
line_length = 120
skip_glob = [
    ".history",
    "venv",
    "venv_linter",
    "venv_tests",
]
use_parentheses = true
multi_line_output = 3
include_trailing_comma = true

[tool.flakeheaven]
exclude = [
    ".history",
    "venv",
    "venv_linter",
    "venv_tests",
]
format = "grouped"
max_line_length = 120
show_source = true
extended_default_ignore = []

[tool.flakeheaven.plugins]
# default plugins
pyflakes = ["+*"]
pycodestyle = ["+*"]
# additional plugins
flake8 = ["+*"]
# enable everything that starts from `flake8-`
"flake8-*" = ["+*"]
pylint = [
    "+*", # include everything
    "-C0114", # disable Missing module docstring (missing-module-docstring)
    "-C0116", # disable Missing function or method docstring  (missing-function-docstring)
    "-E0401", # disable Unable to import 'library' (import-error)
]

# match by prefix
[tool.flakeheaven.exceptions."dags/"]
pycodestyle = [
    "-W503" # disable line break before binary operator
]
pylint = [
    "-W0104" # disable statement seems to have no effect (pointless-statement)
]
  1. pip freeze
astroid==2.12.12
black==22.8.0
click==8.1.3
colorama==0.4.6
dill==0.3.6
entrypoints==0.4
flake8==4.0.1
flakeheaven==3.2.0
isort==5.10.1
lazy-object-proxy==1.8.0
mccabe==0.6.1
mypy-extensions==0.4.3
pathspec==0.10.1
platformdirs==2.5.2
pycodestyle==2.8.0
pyflakes==2.4.0
Pygments==2.13.0
pylint==2.15.5
toml==0.10.2
tomli==2.0.1
tomlkit==0.11.6
typing_extensions==4.4.0
urllib3==1.26.12
wrapt==1.14.1
  1. flakeheaven plugins
  2. Contents of any additional files (eg sample .py file(s) to be linted)
  3. Any additional env vars setup
  4. [If available] contents of flakeheaven config -vvv
NAME        | VERSION  | CODES            | RULES
mccabe      | 0.6.1    | C90              | 
pycodestyle | 2.8.0    | E, W             | +*
pyflakes    | 2.4.0    | F                | +*
pylint      | 2.15.5   | C, E, F, I, R, W | +*, -C0114, -C0116, -E0401

Steps to reproduce the behavior:

  1. run flakeheaven lint .

Additional context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
pwoolvettcommented, Nov 8, 2022

Not quite.

Flake8 is not a checker itself but instead a framework where plugins can register linting checks. By default, when you install flake8 those three mentioned plugins are installed.

So if you only install flake8, when you run flake8, it will internally call those three plugins and merge their reports.

When you install a package in your python environment, if that package registers itself as a flake8 plugin, its automatically added to the list of checks which are run each time you run flake8.

So if you install flake8 and additionally other flake8 plugins, when you run flake8, it will internally call all those plugins and merge their reports (I think a plugin can define itself as “disabled by default”, but that doesn’t concern this discussion…)

flakeheaven is just a flake8 wrapper for custom configuration etc. It inherits everything from flake8 and adds the config mentioned in the README. Worthy mention is the departure from automatically activating all plugins to only activate explicitly required plugins from the config.

So if you only install flakeheaven (which has flake8 as a dependency), when you run flakeheaven lint, it will internally call those three plugins and merge their reports, BUT ONLY REPORT THE ACTIVATED PLUGINS from the config.

  • if you have no plugins section -> only pyflakes and pycodestyle are activated docs

  • if your config is

...
[tool.flakeheaven.plugins]
mccabe = ["+*"]

then -> only mccabe is activated

  • if your config is
...
[tool.flakeheaven.plugins]
pyflakes = ["+*"]
pycodestyle = ["+*"]
mccabe = ["+*"]

then -> only mccabe, pyflakes, and pycodestyle are activated

anything else you want to activate, you must (1) pip install it, (2) enable it explicitly or with a glob in the plugins section

0reactions
iamtodorcommented, Nov 7, 2022

@pwoolvett yeah, seems like I thought that by adding a plugin in a config file it will be automatically installed and activated. So basically, flakeheaven checks the code against the following:

  • flake8
  • PyFlakes
  • pycodestyle
  • McCabe

Right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyCQA/flake8-bugbear - GitHub
A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
Read more >
flake8 Documentation - Read the Docs
After installation, most plugins immediately start reporting errors. Check the plugin's documentation for which error codes it returns and if it ...
Read more >
flake8-comprehensions - PyPI
A flake8 plugin that helps you write better list/set/dict comprehensions. Installation. Install from pip with: pip install flake8-comprehensions. Python 3.5 ...
Read more >
5.0.0 – 2022-07-30 — flake8 6.0.0 documentation
Missing explicitly-specified configuration is now an error (See also #1497, #1498). Always read configuration files as UTF-8 (See also #1532, # ...
Read more >
Release 3.8.0 Ian Stapleton Cordasco - Flake8
in GitLab, there's a good chance that 3.2.0 is the next release. ... Flake8 allowed for custom formatting plugins in version 3.0.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found