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 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
❄️ 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
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
Flake8 extension for checking quotes in python

Flake8 Extension to lint for quotes. Major update in 2.0.0 We automatically encourage avoiding escaping quotes as per PEP 8. To disable this, use --no

Zachary Heller 157 Dec 13, 2022
flake8 plugin that integrates isort

Flake8 meet isort Use isort to check if the imports on your python files are sorted the way you expect. Add an .isort.cfg to define how you want your

Gil Forcada Codinachs 139 Nov 8, 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
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
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 1, 2023
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
A plugin for Flake8 that checks pandas code

pandas-vet pandas-vet is a plugin for flake8 that provides opinionated linting for pandas code. It began as a project during the PyCascades 2019 sprin

Jacob Deppen 146 Dec 28, 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 3, 2022
Tool to automatically fix some issues reported by flake8 (forked from autoflake).

autoflake8 Introduction autoflake8 removes unused imports and unused variables from Python code. It makes use of pyflakes to do this. autoflake8 also

francisco souza 27 Sep 8, 2022
Utilities for pycharm code formatting (flake8 and black)

Pycharm External Tools Extentions to Pycharm code formatting tools. Currently supported are flake8 and black on a selected code block. Usage Flake8 [P

Haim Daniel 13 Nov 3, 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

null 1 Feb 12, 2022
Flake8 extension to provide force-check option

flake8-force Flake8 extension to provide force-check option. When this option is enabled, flake8 performs all checks even if the target file cannot be

Kenichi Maehashi 9 Oct 29, 2022
GeoIP Legacy Python API

MaxMind GeoIP Legacy Python Extension API Requirements Python 2.5+ or 3.3+ GeoIP Legacy C Library 1.4.7 or greater Installation With pip: $ pip instal

MaxMind 230 Nov 10, 2022
Automatically generate a RESTful API service for your legacy database. No code required!

sandman2 sandman2 documentation [ ~ Dependencies scanned by PyUp.io ~ ] sandman2 automagically generates a RESTful API service from your existing data

Jeff Knupp 1.9k Jan 7, 2023
python3.5+ hubspot client based on hapipy, but modified to use the newer endpoints and non-legacy python

A python wrapper around HubSpot's APIs, for python 3.5+. Built initially around hapipy, but heavily modified. Check out the documentation here! (thank

Jacobi Petrucciani 140 Dec 21, 2022
Legacy python processor for AsciiDoc

AsciiDoc.py This branch is tracking the alpha, in-progress 10.x release. For the stable 9.x code, please go to the 9.x branch! AsciiDoc is a text docu

AsciiDoc.py 178 Dec 25, 2022
Legacy django jet rebooted , supports only Django 3

Django JET Reboot Rebooting the original project : django-jet. Django Jet is modern template for Django admin interface with improved functionality. W

null 215 Dec 31, 2022