Flake8 wrapper to make it nice, legacy-friendly, configurable.

Overview

THE PROJECT IS ARCHIVED

Forks: https://github.com/orsinium/forks


FlakeHell

PyPI version Build Status License: MIT Documentation

It's a Flake8 wrapper to make it cool.

output example

Compatibility

FlakeHell supports all flake8 plugins, formatters, and configs. However, FlakeHell has it's own beautiful way to configure enabled plugins and codes. So, options like --ignore and --select unsupported. You can have flake8 and FlakeHell in one project if you want but enabled plugins should be explicitly specified.

Installation

python3 -m pip install --user flakehell

Usage

First of all, let's create pyproject.toml config:

[tool.flakehell]
# optionally inherit from remote config (or local if you want)
base = "https://raw.githubusercontent.com/life4/flakehell/master/pyproject.toml"
# specify any flake8 options. For example, exclude "example.py":
exclude = ["example.py"]
# make output nice
format = "grouped"
# 80 chars aren't enough in 21 century
max_line_length = 90
# show line of source code in output
show_source = true

# list of plugins and rules for them
[tool.flakehell.plugins]
# include everything in pyflakes except F401
pyflakes = ["+*", "-F401"]
# enable only codes from S100 to S199
flake8-bandit = ["-*", "+S1??"]
# enable everything that starts from `flake8-`
"flake8-*" = ["+*"]
# explicitly disable plugin
flake8-docstrings = ["-*"]

Show plugins that aren't installed yet:

flakehell missed

Show installed plugins, used plugins, specified rules, codes prefixes:

flakehell plugins

plugins command output

Show codes and messages for a specific plugin:

flakehell codes pyflakes

codes command output

Run flake8 against the code:

flakehell lint

This command accepts all the same arguments as Flake8.

Read flakehell.readthedocs.io for more information.

Contributing

Contributions are welcome! A few ideas what you can contribute:

  • Improve documentation.
  • Add more tests.
  • Improve performance.
  • Found a bug? Fix it!
  • Made an article about FlakeHell? Great! Let's add it into the README.md.
  • Don't have time to code? No worries! Just tell your friends and subscribers about the project. More users -> more contributors -> more cool features.

A convenient way to run tests is using DepHell:

curl -L dephell.org/install | python3
dephell venv create --env=pytest
dephell deps install --env=pytest
dephell venv run --env=pytest

Bug-tracker is disabled by-design to shift contributions from words to actions. Please, help us make the project better and don't stalk maintainers in social networks and on the street.

Thank you ❤️

The FlakeHell mascot (Flaky) is created by @illustrator.way and licensed under the CC BY-SA 4.0 license.

Comments
  • Allow flakehell to be installed from the source alone

    Allow flakehell to be installed from the source alone

    See https://flit.readthedocs.io/en/latest/pyproject_toml.html#build-system-section

    This will allow flakehell installable from just the source. E.g. pip install git+git+https://github.com/life4/flakehell

    opened by thejcannon 6
  • Fix --config handling and allow --append-config

    Fix --config handling and allow --append-config

    From my testing, passing --config ./file.toml wasn't being handled correctly. Debugging it, it looks like parse_preliminary_options in flake8 strips out these options, so by the time we get to it in parse_configuration_and_cli they are nowhere to be found in argv.

    opened by thejcannon 4
  • Update message output

    Update message output

    • Adding the pylint symbol (verbal error code) makes disabling certain errors a bit easier.
    • Printing error codes in only one color makes them a bit more readable and from my experience, there is no real need to make the number stand out.

    The pylint issue is more important for me. If you have any objections against the other change, I can revert it. :)

    opened by sscherfke 3
  • Try multiple cache locations

    Try multiple cache locations

    In CI environment, depending on the user and whether it has a home, flakehell would try to create the /.cache directory, and would fail with a PermissionError.

    This commit changes that by making flakehell try to create the cache at different locations: $HOME/.cache/flakehell and ./.flakehell_cache (the chances we can write into the current directory in CI are high).

    A --disable-cache option would be much more robust but seems to be way more complicated to implement.

    Hacktoberfest 
    opened by pawamoy 3
  • Where has the bug tracker gone?

    Where has the bug tracker gone?

    The exclude option is still broken in 0.4.5, I still get a SyntaxError on a file that is in the exclude list.

    I'm also struggling to figure out how this would be used as a git hook.

    opened by Dreamsorcerer 3
  • Fix exception thrown when nonexistent filename, especially `-` is passed

    Fix exception thrown when nonexistent filename, especially `-` is passed

    The error is caused by Snapshot class naively reading in file content to create a md5 digest for the file. This is not possible when - is passed, because a) it is most likely not an existing filename, and b) even if we were to interpret it as stdin, it isn't seekable (outside of using os.lseek when a real file was redirected).

    The fix: when calculating digests for a non-existent file, just invent one from current time and a random value. It will be a new value every time, ensuring no caching between such stdin invocations.

    Fixes #44

    opened by k3rni 3
  • fix flakehell version passed to flake8 application

    fix flakehell version passed to flake8 application

    Currently flakehell is using 2 versions:

    • flakehell.__version__ which is pypi package version
    • flakehell._constants.VERSION which is passed to Flake8Application as version kwarg

    Maybe it's some leftover after refactor or something, but it's quite confusing and imho only one version number should be used for both cases. Please correct me if I am wrong, because maybe I misunderstood something.

    Thanks for maintaining this really useful project!

    opened by skarzi 3
  • Please rename or remove the yesqa sub command

    Please rename or remove the yesqa sub command

    opened by asottile 2
  • Add support for intersection between exceptions

    Add support for intersection between exceptions

    Not sure if the current behavior is by design or not. When some file is matched by two or more exceptions, only one exception is applied and it is not obvious which one (the one with a shorter path actually). So, i suggest to apply all matched exceptions.

    opened by evgeniyz321 2
  • Use FLAKEHELL_CACHE environment variable

    Use FLAKEHELL_CACHE environment variable

    A PermissionError can be raised when trying to create the cache directory. We allow the user to change the cache path with the FLAKEHELL_CACHE environment variable to work around this issue.

    Replaces #101.

    Hacktoberfest 
    opened by pawamoy 2
  • Baseline hashes not use forward-slash on all platforms

    Baseline hashes not use forward-slash on all platforms

    This will allow baseline files to be generated on any platform to be consumed on any platform.

    NOTE: Unfortunately, this will break existing baseline files generated on machines that use back slashes.

    opened by thejcannon 2
  • Fix --config handling and allow --append-config

    Fix --config handling and allow --append-config

    From my testing, passing --config ./file.toml wasn't being handled correctly. Debugging it, it looks like parse_preliminary_options in flake8 strips out these options, so by the time we get to it in parse_configuration_and_cli they are nowhere to be found in argv.

    opened by thejcannon 4
Owner
Life4
Original cool Open Source projects
Life4
❄️ 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
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
Flake8 plugin for managing type-checking imports & forward references

flake8-type-checking Lets you know which imports to put in type-checking blocks. For the imports you've already defined inside type-checking blocks, i

snok 67 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 01, 2023
Performant type-checking for python.

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally – providi

Facebook 6.2k Jan 04, 2023
Run isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks

Run isort, pyupgrade, mypy, pylint, flake8, mdformat, black, blacken-docs, and more on Jupyter Notebooks ✅ handles IPython magics robustly ✅ respects

663 Jan 08, 2023
Flake8 plugin for managing type-checking imports & forward references

flake8-type-checking Lets you know which imports to put in type-checking blocks. For the imports you've already defined inside type-checking blocks, i

snok 67 Dec 16, 2022
MonkeyType as a pytest plugin.

MonkeyType as a pytest plugin.

Marius van Niekerk 36 Nov 24, 2022
coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." ― John F. Woods coala provides a

coala development group 3.4k Dec 29, 2022
Flake8 plugin to find commented out or dead code

flake8-eradicate flake8 plugin to find commented out (or so called "dead") code. This is quite important for the project in a long run. Based on eradi

wemake.services 277 Dec 27, 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
Mypy stubs, i.e., type information, for numpy, pandas and matplotlib

Mypy type stubs for NumPy, pandas, and Matplotlib This is a PEP-561-compliant stub-only package which provides type information for matplotlib, numpy

Predictive Analytics Lab 194 Dec 19, 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 06, 2023
A static type analyzer for Python code

pytype - 🦆 ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 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
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 03, 2022
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
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
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
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