pyproject-flake8
pyproject-flake8 copied to clipboard
Issue with command line arguments
Not sure if this is the right place to put this, although limiting the version of pyproject-flake8<6.0.0 did resolve the issue. There seems to be a problem with the command line argument type beying passed as an str rather than a function which is resulting in the error below. I put a print statement with the arguments being passed just before this line: .tox/lint/lib/python3.10/site-packages/flake8/options/manager.py", line 274, in add_option
['--copyright-min-file-size']
{'action': 'store', 'default': 0, 'type': 'int', 'help': 'Minimum number of characters in a file before requiring a copyright notice.'}
Traceback (most recent call last):
File ".tox/lint/bin/pflake8", line 8, in <module>
sys.exit(main())
File ".tox/lint/lib/python3.10/site-packages/flake8/main/cli.py", line 23, in main
app.run(argv)
File ".tox/lint/lib/python3.10/site-packages/flake8/main/application.py", line 198, in run
self._run(argv)
File ".tox/lint/lib/python3.10/site-packages/flake8/main/application.py", line 186, in _run
self.initialize(argv)
File ".tox/lint/lib/python3.10/site-packages/flake8/main/application.py", line 165, in initialize
self.plugins, self.options = parse_args(argv)
File ".tox/lint/lib/python3.10/site-packages/flake8/options/parse_args.py", line 51, in parse_args
option_manager.register_plugins(plugins)
File ".tox/lint/lib/python3.10/site-packages/flake8/options/manager.py", line 250, in register_plugins
add_options(self)
File ".tox/lint/lib/python3.10/site-packages/flake8_copyright.py", line 56, in add_options
register_opt(
File ".tox/lint/lib/python3.10/site-packages/flake8_copyright.py", line 30, in register_opt
parser.add_option(*args, **kwargs)
File ".tox/lint/lib/python3.10/site-packages/flake8/options/manager.py", line 274, in add_option
self._current_group.add_argument(*option_args, **option_kwargs)
File "/usr/lib/python3.10/argparse.py", line 1440, in add_argument
raise ValueError('%r is not callable' % (type_func,))
ValueError: 'int' is not callable
Checking this briefly it seems that this bug is related to flake8-copyright's interaction with flake8. It is reported in their repo as well https://github.com/savoirfairelinux/flake8-copyright/issues/19, with a PR fix pending https://github.com/savoirfairelinux/flake8-copyright/pull/20 .