sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.56k stars 71 forks source link

EOFError: Ran out of input when running in pre-commit CI #435

Open IceBotYT opened 3 months ago

IceBotYT commented 3 months ago

Checklist

Description

When running sourcery in pre-commit inside GitHub Actions, it fails with this error. See here for full Actions run.

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/__main__.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/binary/command_line_interface/__init__.py", line 44, in <module binary.command_line_interface>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/binary/hub_server.py", line 11, in <module binary.hub_server>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/hub/app.py", line 32, in <module hub.app>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/sourcery/rules/proposers.py", line 6, in <module sourcery.rules.proposers>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/sourcery/rules/private/comments/dsl/avoid_builtin_shadow.py", line 3, in <module sourcery.rules.private.comments.dsl.avoid_builtin_shadow>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/sourcery/dsl/proposals.py", line 15, in <module sourcery.dsl.proposals>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/sourcery/code/source_unparser.py", line 18, in <module sourcery.code.source_unparser>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf/__init__.py", line 41, in <module yapf>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf/yapflib/yapf_api.py", line [38](https://github.com/IceBotYT/nice-go/actions/runs/10441430046/job/28912548602?pr=18#step:4:39), in <module yapf.yapflib.yapf_api>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf/pyparser/pyparser.py", line 44, in <module yapf.pyparser.pyparser>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf/yapflib/format_token.py", line 23, in <module yapf.yapflib.format_token>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 11[47](https://github.com/IceBotYT/nice-go/actions/runs/10441430046/job/28912548602?pr=18#step:4:48), in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf/pytree/pytree_utils.py", line 30, in <module yapf.pytree.pytree_utils>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf_third_party/_ylib2to3/pygram.py", line 29, in <module yapf_third_party._ylib2to3.pygram>
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf_third_party/_ylib2to3/pgen2/driver.py", line 2[52](https://github.com/IceBotYT/nice-go/actions/runs/10441430046/job/28912548602?pr=18#step:4:53), in load_grammar
  File "/home/runner/.cache/pre-commit/repoon734gmg/py_env-python3.12/lib/python3.12/site-packages/sourcery/yapf_third_party/_ylib2to3/pgen2/grammar.py", line 95, in load
EOFError: Ran out of input

Re-running it solves the problem

Code snippet that reproduces issue

Debug Information

IDE Version:

N/A

Sourcery Version:

Sourcery 1.21.0

Operating system and Version:

Runs on GitHub Actions ubuntu-latest