rlworkgroup / garage

A toolkit for reproducible reinforcement learning research.
MIT License
1.84k stars 309 forks source link

Flake8 raises exception in pre-commit #2258

Closed mugoh closed 3 years ago

mugoh commented 3 years ago

On the pre-commit checks, I get the following error log from flake8. How should I resolve it?

flake8...................................................................Failed
- hook id: flake8
- exit code: 1

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 421, in run_check
    plugin["parameters"], arguments
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/processor.py", line 251, in keyword_arguments_for
    arguments[param] = getattr(self, param)
AttributeError: 'FileProcessor' object has no attribute 'indent_size'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 655, in _run_checks
    return checker.run_checks()
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 588, in run_checks
    self.process_tokens()
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 578, in process_tokens
    self.handle_newline(token_type)
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 605, in handle_newline
    self.run_logical_checks()
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 515, in run_logical_checks
    results = self.run_check(plugin, logical_line=logical_line) or ()
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 426, in run_check
    plugin=plugin, exception=ae
flake8.exceptions.PluginRequestedUnknownParameters: "pycodestyle" requested unknown parameters causing 'FileProcessor' object has no attribute 'indent_size'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/main/application.py", line 360, in run
    self._run(argv)
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/main/application.py", line 348, in _run
    self.run_checks()
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/main/application.py", line 262, in run_checks
    self.file_checker_manager.run()
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 323, in run
    self.run_parallel()
  File "/home/precious/.cache/pre-commit/repoq8ymn8i5/py_env-python3/lib/python3.6/site-packages/flake8/checker.py", line 289, in run_parallel
    for ret in pool_map:
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 735, in next
    raise value
flake8.exceptions.PluginRequestedUnknownParameters: "pycodestyle" requested unknown parameters causing 'FileProcessor' object has no attribute 'indent_size'
haydenshively commented 3 years ago

This may sounds silly, but can you try uninstalling and reinstalling flake8?

mugoh commented 3 years ago

I actually tried this many times. And I noted flake 8 used for the pre-commit test is in the pre-commit environment .cache/pre-commit/repoq8ymn8i5 not in .local/lib/python3 or a custom virtual env. So it didn't work

I'd also tried running pre-commit clean and setting up pre-commit again but this didn't solve it.