Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when running flake8 withouth a path or on root of project #236

Closed
hmvp opened this issue Nov 18, 2020 · 2 comments
Closed

Crash when running flake8 withouth a path or on root of project #236

hmvp opened this issue Nov 18, 2020 · 2 comments
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@hmvp
Copy link

hmvp commented Nov 18, 2020

Your bug may already be reported!
Please search on the issue tracker before creating one.

Expected Behavior

Run flake8

Current Behavior

flake8 crashes
This does not show when uninstalling nitpick from env
Running nitpick through pre-commit does work:
pre-commit run nitpick --files setup.py

Steps to Reproduce

$ flake8 .
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/local-venv/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/local-venv/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/local-venv/lib/python3.7/site-packages/flake8/checker.py", line 676, in _run_checks
    return checker.run_checks()
  File "/local-venv/lib/python3.7/site-packages/flake8/checker.py", line 589, in run_checks
    self.run_ast_checks()
  File "/local-venv/lib/python3.7/site-packages/flake8/checker.py", line 494, in run_ast_checks
    for (line_number, offset, text, _) in runner:
  File "/local-venv/lib/python3.7/site-packages/nitpick/flake8.py", line 51, in run
    yield from itertools.chain(app.config.merge_styles(), self.check_files(True), self.check_files(False))
  File "/local-venv/lib/python3.7/site-packages/nitpick/config.py", line 66, in merge_styles
    style.find_initial_styles(configured_styles)
  File "/local-venv/lib/python3.7/site-packages/nitpick/style.py", line 66, in find_initial_styles
    self.include_multiple_styles(chosen_styles)
  File "/local-venv/lib/python3.7/site-packages/nitpick/style.py", line 113, in include_multiple_styles
    self.include_multiple_styles(sub_styles)
  File "/local-venv/lib/python3.7/site-packages/nitpick/style.py", line 113, in include_multiple_styles
    self.include_multiple_styles(sub_styles)
  File "/local-venv/lib/python3.7/site-packages/nitpick/style.py", line 113, in include_multiple_styles
    self.include_multiple_styles(sub_styles)
  File "/local-venv/lib/python3.7/site-packages/nitpick/style.py", line 98, in include_multiple_styles
    toml_dict = toml.as_data
  File "/local-venv/lib/python3.7/site-packages/nitpick/formats.py", line 128, in as_data
    self.load()
  File "/local-venv/lib/python3.7/site-packages/nitpick/formats.py", line 229, in load
    self._reformatted = toml.dumps(self._data)
  File "/local-venv/lib/python3.7/site-packages/toml/encoder.py", line 67, in dumps
    raise ValueError("Circular reference detected")
ValueError: Circular reference detected
"""

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

Traceback (most recent call last):
  File "/local-venv/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/local-venv/lib/python3.7/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/local-venv/lib/python3.7/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "/local-venv/lib/python3.7/site-packages/flake8/main/application.py", line 351, in _run
    self.run_checks()
  File "/local-venv/lib/python3.7/site-packages/flake8/main/application.py", line 264, in run_checks
    self.file_checker_manager.run()
  File "/local-venv/lib/python3.7/site-packages/flake8/checker.py", line 321, in run
    self.run_parallel()
  File "/local-venv/lib/python3.7/site-packages/flake8/checker.py", line 287, in run_parallel
    for ret in pool_map:
  File "/local-venv/lib/python3.7/multiprocessing/pool.py", line 354, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "/local-venv/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
ValueError: Circular reference detected

Context

Your Environment

  • nitpick version used: latest

  • Python version: 3.7 and 3.8

  • Operating System and version: Ubuntu

  • Link to your project:

  • Run the following commands and paste the output:

    which python3
    python3 -V
    pip freeze
    cat $(which flake8)
$     which python3
/local-venv/bin/python3
$     python3 -V
Python 3.7.7
$     pip freeze
aiocache==0.11.1
aiofiles==0.5.0
aioredis==1.3.1
alabaster==0.7.12
aniso8601==7.0.0
apache-license-check==1.0.0
apipkg==1.5
appdirs==1.4.4
APScheduler==3.6.0
async-exit-stack==1.0.1
async-generator==1.10
async-timeout==3.0.1
attrs==19.3.0
Authlib==0.14.3
Babel==2.7.0
bandit==1.6.2
black==20.8b1
blinker==1.4
blockdiag==2.0.1
certifi==2020.6.20
cffi==1.14.0
cfgv==3.1.0
chardet==3.0.4
click==7.1.2
colorama==0.4.4
commonmark==0.9.1
contextlib2==0.6.0.post1
coverage==5.1
cryptography==2.9.2
dictdiffer==0.8.1
distlib==0.3.0
dnspython==1.16.0
docutils==0.16
email-validator==1.1.1
execnet==1.7.1
fastapi==0.61.2
fastapi-mail==0.2.5
filelock==3.0.12
flake8==3.8.4
flake8-bandit==2.1.2
flake8-bugbear==20.1.4
flake8-comprehensions==3.3.0
flake8-docstrings==1.5.0
flake8-junit-report==2.1.0
flake8-logging-format==0.6.0
flake8-pep3101==1.3.0
flake8-polyfill==1.0.2
flake8-print==3.1.4
flake8-rst==0.7.2
flake8-rst-docstrings==0.0.14
flake8-tidy-imports==4.1.0
Flask==1.1.2
Flask-DebugToolbar==0.11.0
Flask-Testing==0.8.0
freezegun==1.0.0
funcparserlib==0.3.6
future==0.18.2
gitchangelog==3.0.4
gitdb==4.0.5
GitPython==3.1.3
graphene==2.1.8
graphql-core==2.3.2
graphql-relay==2.0.1
gunicorn==20.0.4
h11==0.9.0
h2==3.2.0
hiredis==1.1.0
hpack==3.0.0
hstspreload==2020.6.16
httptools==0.1.1
httpx==0.12.0
hyperframe==5.2.0
identify==1.4.20
idna==2.9
imagesize==1.2.0
importlib-metadata==1.6.1
influxdb==5.3.0
iniconfig==1.1.1
isort==5.6.4
itsdangerous==1.1.0
jaeger-client==4.3.0
Jinja2==2.11.2
jmespath==0.10.0
MarkupSafe==1.1.1
marshmallow==3.9.1
marshmallow-polyfield==5.9
mccabe==0.6.1
more-itertools==8.6.0
msgpack==0.6.1
mypy==0.790
mypy-extensions==0.4.3
nodeenv==1.4.0
opentracing==2.3.0
opentracing-instrumentation==3.2.1
orjson==3.4.2
packaging==20.4
pathspec==0.8.0
pathtools==0.1.2
pbr==5.4.5
Pillow==7.1.2
pluggy==0.13.1
pre-commit==2.8.2
promise==2.3
py==1.8.2
pycodestyle==2.6.0
pycparser==2.20
pydantic==1.7.1
pydocstyle==3.0.0
pyflakes==2.2.0
Pygments==2.6.1
pyparsing==2.4.7
pystache==0.5.4
pytest==6.1.2
pytest-asyncio==0.14.0
pytest-cov==2.10.1
pytest-forked==1.1.3
pytest-httpx==0.2.0
pytest-xdist==2.1.0
python-dateutil==2.8.1
python-dotenv==0.15.0
python-multipart==0.0.5
python-slugify==4.0.1
pytz==2020.1
PyYAML==5.3.1
recommonmark==0.6.0
redis==3.5.3
regex==2020.6.8
requests==2.24.0
restructuredtext-lint==1.3.1
rfc3986==1.4.0
ruamel.yaml==0.16.12
ruamel.yaml.clib==0.2.2
Rx==1.6.1
schedule==0.5.0
sentry-sdk==0.19.3
seqdiag==2.0.0
six==1.15.0
smmap==3.0.4
sniffio==1.1.0
snowballstemmer==2.0.0
sortedcontainers==2.3.0
Sphinx==3.3.1
sphinx-rtd-theme==0.5.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-blockdiag==2.0.0
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-seqdiag==2.0.0
sphinxcontrib-serializinghtml==1.1.4
starlette==0.13.6
Starlette-OpenTracing==0.1.0
stevedore==2.0.0
structlog==20.1.0
termcolor==1.1.0
text-unidecode==1.3
threadloop==1.0.2
thrift==0.13.0
toml==0.10.1
tornado==5.1.1
typed-ast==1.4.1
typing-extensions==3.7.4.3
tzlocal==2.1
ujson==3.0.0
urllib3==1.25.9
uvicorn==0.12.2
uvloop==0.14.0
virtualenv==20.0.24
watchdog==0.10.3
watchgod==0.6
wcwidth==0.2.4
webcolors==1.11.1
websockets==8.1
Werkzeug==1.0.1
wrapt==1.12.1
zipp==3.1.0
$     cat $(which flake8)
#!/local-venv/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from flake8.main.cli import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
@hmvp hmvp added the bug Something isn't working label Nov 18, 2020
@hmvp
Copy link
Author

hmvp commented Nov 18, 2020

BTW: I fully support changing nitpick to a standalone command instead of a flake plugin. Or at least make both possible

@andreoliwa
Copy link
Owner

I don't know how to reproduce your problem.

  • nitpick version used: latest

Nitpick doesn't seem to be installed.
I can't see nitpick==<version> on your pip freeze output above.

File "/local-venv/lib/python3.7/site-packages/toml/encoder.py", line 67, in dumps
raise ValueError("Circular reference detected")
ValueError: Circular reference detected

This looks like a problem the toml package had some time ago: uiri/toml#295
This is already fixed in the latest toml version, which Nitpick is already using: https://github.com/andreoliwa/nitpick/releases/tag/v0.23.1

BTW: I fully support changing nitpick to a standalone command instead of a flake plugin. Or at least make both possible

This is planned for the future. 🙂
See #166 and https://github.com/andreoliwa/nitpick/projects/1#card-41040429

@andreoliwa andreoliwa added the invalid This doesn't seem right label Jan 14, 2021
@andreoliwa andreoliwa moved this to Done in Nitpick Roadmap Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
Archived in project
Development

No branches or pull requests

2 participants