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
Mypy stubs for the PyQt5 framework

Mypy stubs for the PyQt5 framework This repository holds the stubs of the PyQt5 framework. It uses the stub files that are produced during compilation

62 Nov 22, 2022
Flake8 plugin that checks import order against various Python Style Guides

flake8-import-order A flake8 and Pylama plugin that checks the ordering of your imports. It does not check anything else about the imports. Merely tha

Python Code Quality Authority 270 Nov 24, 2022
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
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

beartype 1.4k Jan 01, 2023
Plugin for mypy to support zope.interface

Plugin for mypy to support zope.interface The goal is to be able to make zope interfaces to be treated as types in mypy sense. Usage Install both mypy

Shoobx 36 Oct 29, 2022
:sparkles: Surface lint errors during code review

✨ Linty Fresh ✨ Keep your codebase sparkly clean with the power of LINT! Linty Fresh parses lint errors and report them back to GitHub as comments on

Lyft 183 Dec 18, 2022
flake8 plugin to catch useless `assert` statements

flake8-useless-assert flake8 plugin to catch useless assert statements Download or install on the PyPI page Violations Code Description Example ULA001

1 Feb 12, 2022
MyPy types for WSGI applications

WSGI Types for Python This is an attempt to bring some type safety to WSGI applications using Python's new typing features (TypedDicts, Protocols). It

Blake Williams 2 Aug 18, 2021
Tool to check the completeness of MANIFEST.in for Python packages

check-manifest Are you a Python developer? Have you uploaded packages to the Python Package Index? Have you accidentally uploaded broken packages with

Marius Gedminas 270 Dec 26, 2022
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
Reference implementation of sentinels for the Python stdlib

Sentinels This is a reference implementation of a utility for the definition of sentinel values in Python. This also includes a draft PEP for the incl

Tal Einat 22 Aug 27, 2022
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 01, 2023
Python classes with types validation at runtime.

typedclasses Python classes with types validation at runtime. (Experimental & Under Development) Installation You can install this library using Pytho

Izhar Ahmad 8 Feb 06, 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
OpenStack Hacking Style Checks. Mirror of code maintained at opendev.org.

Introduction hacking is a set of flake8 plugins that test and enforce the OpenStack StyleGuide Hacking pins its dependencies, as a new release of some

Mirrors of opendev.org/openstack 224 Jan 05, 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
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
Static type checker for Python

Static type checker for Python Speed Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fas

Microsoft 9.2k Jan 03, 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
Pymxs, the 3DsMax bindings of Maxscript to Python doesn't come with any stubs

PyMXS Stubs generator What Pymxs, the 3DsMax bindings of Maxscript to Python doe

Frieder Erdmann 19 Dec 27, 2022