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
Stubs with type annotations for ordered-set Python library

ordered-set-stubs - stubs with type annotations for ordered-set Python library Archived - now type annotations are the part of the ordered-set library

Roman Inflianskas 2 Feb 06, 2020
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
Easy saving and switching between multiple KDE configurations.

Konfsave Konfsave is a config manager. That is, it allows you to save, back up, and easily switch between different (per-user) system configurations.

42 Sep 25, 2022
An extension for flake8 that forbids some imports statements in some modules.

flake8-obey-import-goat An extension for flake8 that forbids some imports statements in some modules. Important: this project is developed using DDD,

Ilya Lebedev 10 Nov 09, 2022
open source tools to generate mypy stubs from protobufs

mypy-protobuf: Generate mypy stub files from protobuf specs We just released a new major release mypy-protobuf 2. on 02/02/2021! It includes some back

Dropbox 527 Jan 03, 2023
A python documentation linter which checks that the docstring description matches the definition.

Darglint A functional docstring linter which checks whether a docstring's description matches the actual function/method implementation. Darglint expe

Terrence Reilly 463 Dec 31, 2022
MonkeyType as a pytest plugin.

MonkeyType as a pytest plugin.

Marius van Niekerk 36 Nov 24, 2022
Type stubs for the lxml package

lxml-stubs About This repository contains external type annotations (see PEP 484) for the lxml package. Installation To use these stubs with mypy, you

25 Dec 26, 2022
Static Typing for Python

Python static typing home. Contains the source for typing_extensions and the documentation. Also hosts a user help forum.

Python 1.3k Jan 06, 2023
It's not just a linter that annoys you!

README for Pylint - https://pylint.pycqa.org/ Professional support for pylint is available as part of the Tidelift Subscription. Tidelift gives softwa

Python Code Quality Authority 4.4k Jan 04, 2023
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
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
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
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
Backport Python 3.8+ typing utils & add issubtype & more

typing-utils Backport Python3.8+ typing utils & issubtype & more Install API issubtype get_origin get_args get_type_hints Install pip install typi

10 Nov 09, 2022
Tools for improving Python imports

imptools Tools for improving Python imports. Installation pip3 install imptools Overview Detailed docs import_path Import a module from any path on th

Danijar Hafner 7 Aug 07, 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
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
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