PyCQA / flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
https://flake8.pycqa.org
Other
3.39k stars 306 forks source link

--append-config does not extend defaults #1901

Closed tony-p closed 9 months ago

tony-p commented 9 months ago

how did you install flake8?

pixi add flake8 flake8-isort flake8-black flake8-docstrings

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.10.10",
    "system": "Windows"
  },
  "plugins": [
    {
      "plugin": "flake8-black",
      "version": "0.3.6"
    },
    {
      "plugin": "flake8-docstrings",
      "version": "1.7.0"
    },
    {
      "plugin": "flake8-isort",
      "version": "6.1.1"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.1"
    },
    {
      "plugin": "pyflakes",
      "version": "3.1.0"
    }
  ],
  "version": "6.1.0"
}

describe the problem

what I expected to happen

When there is no base configuration file --append-config should extend/modify the defaults

myconfig

[flake8]
max-line-length=125
docstring-convention=google
select=
  # D213: Multi-line docstring summary should start at the second line
  D213,
  # indentation is not a multiple of four
  E111
extend-ignore=
  # D212: Multi-line docstring summary should start at the first line
  D212
require-plugins=
  flake8-black,
  flake8-docstrings,
  flake8-isort,
  pycodestyle

sample code

def hello_world():
     return "hello world"

print(hello_world())

commands ran

$ pixi run flake8 t.py
mytest.py:1:1: D100 Missing docstring in public module
mytest.py:1:1: D103 Missing docstring in public function
mytest.py:2:5: BLK100 Black would make changes.
mytest.py:2:6: E111 indentation is not a multiple of 4
mytest.py:2:6: E117 over-indented
mytest.py:4:1: E305 expected 2 blank lines after class or function definition, found 1

$ pixi run flake8 --append-config=myconfig t.py
ok
tony-p commented 9 months ago

extend-select was sufficient to fix the issue