The flake8 supports --append-configoption that overwrites a default config that is automatically loaded (or specified in --config).
But the current pflake8 raises error when pyproject.toml set in --append-config:
# pflake8 --append-config pyproject.toml
Traceback (most recent call last):
File "/opt/conda/bin/pflake8", line 8, in <module>
sys.exit(main())
^^^^^^
File "/opt/conda/lib/python3.11/site-packages/flake8/main/cli.py", line 23, in main
app.run(argv)
File "/opt/conda/lib/python3.11/site-packages/flake8/main/application.py", line 198, in run
self._run(argv)
File "/opt/conda/lib/python3.11/site-packages/flake8/main/application.py", line 186, in _run
self.initialize(argv)
File "/opt/conda/lib/python3.11/site-packages/flake8/main/application.py", line 165, in initialize
self.plugins, self.options = parse_args(argv)
^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/flake8/options/parse_args.py", line 29, in parse_args
cfg, cfg_dir = config.load_config(
^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/flake8/options/config.py", line 90, in load_config
if not cfg.read(filename, encoding="UTF-8"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/configparser.py", line 713, in read
self._read(fp, filename)
File "/opt/conda/lib/python3.11/site-packages/pflake8/__init__.py", line 35, in _read
self.add_section(section)
File "/opt/conda/lib/python3.11/configparser.py", line 674, in add_section
raise DuplicateSectionError(section)
configparser.DuplicateSectionError: Section 'flake8' already exists
This PR allows to use pyproject.toml in --append-config.
I also added simple test cases.
The flake8 supports
--append-config
option that overwrites a default config that is automatically loaded (or specified in --config). But the current pflake8 raises error when pyproject.toml set in --append-config:This PR allows to use pyproject.toml in --append-config. I also added simple test cases.