Skip to content

Instantly share code, notes, and snippets.

@sco1
Created June 11, 2022 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sco1/7c544878bde10163258435f9e8ae5b11 to your computer and use it in GitHub Desktop.
Save sco1/7c544878bde10163258435f9e8ae5b11 to your computer and use it in GitHub Desktop.

reproducer

$ flake8 --version
4.0.1 (flake8-bonk: 0.1.0, mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.10.2 on Darwin
$ flake8 -vv ./bonk.py
...
flake8.main.application   MainProcess    152 INFO     Finished running
flake8.main.application   MainProcess    152 INFO     Reporting errors
flake8.style_guide        MainProcess    152 DEBUG    Deciding if "BONK001" should be reported
flake8.style_guide        MainProcess    152 DEBUG    The user configured "BONK001" to be "Ignored.Implicitly", "Ignored.Explicitly"
flake8.style_guide        MainProcess    152 DEBUG    "BONK001" will be "Decision.Ignored"
flake8.style_guide        MainProcess    152 DEBUG    Violation(code='BONK001', filename='./bonk.py', line_number=1, column_number=2, text='Bonk!', physical_line='class BonkChecker:\n') is not inline ignored
flake8.main.application   MainProcess    152 INFO     Found a total of 1 violations and reported 0
$ flake8 -vv --extend-select=BONK001 ./bonk.py
...
flake8.main.application   MainProcess    241 INFO     Finished running
flake8.main.application   MainProcess    241 INFO     Reporting errors
flake8.style_guide        MainProcess    241 DEBUG    Deciding if "BONK001" should be reported
flake8.style_guide        MainProcess    242 DEBUG    The user configured "BONK001" to be "Selected.Explicitly", "Ignored.Explicitly"
flake8.style_guide        MainProcess    242 DEBUG    "BONK001" will be "Decision.Ignored"
flake8.style_guide        MainProcess    242 DEBUG    Violation(code='BONK001', filename='./bonk.py', line_number=1, column_number=2, text='Bonk!', physical_line='class BonkChecker:\n') is not inline ignored
flake8.main.application   MainProcess    242 INFO     Found a total of 1 violations and reported 0

This should be fixed by: PyCQA/flake8#1576

$ flake8 -vv --extend-select=BONK001 ./bonk.py
flake8.main.application   MainProcess    130 INFO     Finished running
flake8.main.application   MainProcess    130 INFO     Reporting errors
flake8.style_guide        MainProcess    130 DEBUG    The user configured 'BONK001' to be <Selected.Explicitly: 'explicitly selected'>, <Ignored.Implicitly: 'implicitly ignored'>
flake8.style_guide        MainProcess    131 DEBUG    "BONK001" will be "Decision.Selected"
flake8.violation          MainProcess    131 DEBUG    Violation(code='BONK001', filename='./bonk.py', line_number=1, column_number=2, text='Bonk!', physical_line='class BonkChecker:\n') is not inline ignored
flake8.main.application   MainProcess    131 INFO     Found a total of 1 violations and reported 1
./bonk.py:1:2: BONK001 Bonk!
class BonkChecker:
name = "flake8-bonk"
version = "0.1.0"
def __init__(self, tree):
self.tree = tree
def run(self):
yield (1, 1, "BONK001 Bonk!", BonkChecker)
@classmethod
def add_options(cls, opt_manager):
opt_manager.extend_default_ignore(("BONK001",))
from setuptools import setup
setup(
name="flake8-bonk",
version="0.1.0",
description="bonk",
author="bonk",
author_email="bonk@bonk.bonk",
license="MIT",
python_requires=">=3.7",
py_modules=['bonk'],
install_requires=["flake8 >= 4.0.0"],
classifiers=[
"Environment :: Console",
"Framework :: Flake8",
],
entry_points={"flake8.extension": ["BONK = bonk:BonkChecker"]},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment