wemake-python-styleguide
wemake-python-styleguide copied to clipboard
reviewdog: PullRequest needs 'git' command: failed to run 'git rev-parse --show-prefix'
What's wrong
Produces error in actions
Run wemake-services/[email protected]
with:
reporter: github-pr-review
path: ./src
env:
pythonLocation: /opt/hostedtoolcache/Python/3.9.13/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.13/x64/lib
GITHUB_TOKEN: ***
/usr/bin/docker run --name cd98fe6f4b56db05[2](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:2)4edd9b7[3](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:3)a672f703ae26_9e185d --label [4](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:4)cd98f --workdir /github/workspace --rm -e pythonLocation -e LD_LIBRARY_PATH -e GITHUB_TOKEN -e INPUT_REPORTER -e INPUT_PATH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/qcg-backend/qcg-backend":"/github/workspace" 4cd98f:e6f4b[5](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:5)[6](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:6)db0524edd9b[7](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:7)3a672f703ae26 "./src" "github-pr-review"
Using reporter: github-pr-review
Linting path: ./src
flake[8](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:8) --version:
4.0.1 (flake8-bandit: 3.0.0, flake8-broken-line: 0.4.0, flake8-bugbear:
22.7.1, flake8-comprehensions: 3.10.0, flake8-darglint: 1.8.1,
flake8-debugger: 4.1.2, flake8-docstrings: 1.6.0, pydocstyle: 6.1.1,
flake8-eradicate: 1.2.1, flake8-string-format: 0.3.0, flake8_commas: 2.1.0,
flake8_isort: 4.1.1, flake8_quotes: 3.3.1, mccabe: 0.6.1, naming: 0.12.1,
pycodestyle: 2.8.0, pyflakes: 2.4.0, rst-docstrings: 0.2.7,
wemake_python_styleguide: 0.16.1) CPython 3.[9](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:10).[10](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:11) on Linux
=================================
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line [12](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:13)5, in worker
result = (True, func(*args, **kwds))
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/usr/local/lib/python3.9/site-packages/flake8/checker.py", line 687, in _run_checks
return checker.run_checks()
File "/usr/local/lib/python3.9/site-packages/flake8/checker.py", line 597, in run_checks
self.run_ast_checks()
File "/usr/local/lib/python3.9/site-packages/flake8/checker.py", line 500, in run_ast_checks
for (line_number, offset, text, _) in runner:
File "/usr/local/lib/python3.9/site-packages/flake8_docstrings.py", line [14](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:15)2, in run
for error in self._check_source():
File "/usr/local/lib/python3.9/site-packages/flake8_docstrings.py", line 127, in _check_source
for err in self._call_check_source():
File "/usr/local/lib/python3.9/site-packages/pydocstyle/checker.py", line 149, in check_source
error = this_check(
File "/usr/local/lib/python3.9/site-packages/pydocstyle/checker.py", line [19](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:20)9, in check_docstring_missing
and is_blank(ast.literal_eval(docstring))
File "/usr/local/lib/python3.9/ast.py", line 105, in literal_eval
return _convert(node_or_string)
File "/usr/local/lib/python3.9/ast.py", line 104, in _convert
return _convert_signed_num(node)
File "/usr/local/lib/python3.9/ast.py", line 78, in _convert_signed_num
return _convert_num(node)
File "/usr/local/lib/python3.9/ast.py", line 69, in _convert_num
_raise_malformed_node(node)
File "/usr/local/lib/python3.9/ast.py", line 66, in _raise_malformed_node
raise ValueError(f'malformed node or string: {node!r}')
ValueError: malformed node or string: <ast.JoinedStr object at 0x7fc3e569a730>
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/flake8", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/flake8/main/cli.py", line [22](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:23), in main
app.run(argv)
File "/usr/local/lib/python3.9/site-packages/flake8/main/application.py", line 375, in run
self._run(argv)
File "/usr/local/lib/python3.9/site-packages/flake8/main/application.py", line 364, in _run
self.run_checks()
File "/usr/local/lib/python3.9/site-packages/flake8/main/application.py", line [27](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:28)1, in run_checks
self.file_checker_manager.run()
File "/usr/local/lib/python3.9/site-packages/flake8/checker.py", line 309, in run
self.run_parallel()
File "/usr/local/lib/python3.9/site-packages/flake8/checker.py", line 275, in run_parallel
for ret in pool_map:
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 448, in <genexpr>
return (item for chunk in result for item in chunk)
File "/usr/local/lib/python3.9/multiprocessing/pool.py", line 870, in next
raise value
ValueError: malformed node or string: <ast.JoinedStr object at 0x7fc3e569a730>
reviewdog: PullRequest needs 'git' command: failed to run 'git rev-parse --show-prefix': exit status 1[28](https://github.com/user/backend/runs/7426747689?check_suite_focus=true#step:5:29)
=================================
Also, the actions are passing successfully despite the error.

How it should be
The pipeline should run successfully and the action should fail in case of error.
Flake8 version and plugins
actions.py
name: Code Review
on:
pull_request:
branches:
- qa
- master
jobs:
code-review:
name: Code Review
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Check style guide
uses: wemake-services/wemake-python-styleguide
with:
reporter: github-pr-review
path: './src'
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
pip information
Python 3.9
OS information
ubuntu-latest
Does your code pass flake8 . on the same python version?
@sobolevn
Python version used Python 3.9.11
when I run the command flake8 . locally, there are few changes recommended without any error
user@aa30b05174d3:/app$ flake8 .
./authentication/tasks.py:6:1: F401 'dateutil.relativedelta.relativedelta' imported but unused
./authentication/tasks.py:13:1: F401 'authentication.emails.send_inactive_account_deletion_reminder' imported but unused
./authentication/tasks.py:13:1: F401 'authentication.emails.send_inactive_account_deletion_confirmation_mail' imported but unused
./authentication/tasks.py:299:121: E501 line too long (122 > 120 characters)
./authentication/tasks.py:300:121: E501 line too long (121 > 120 characters)
./qcg/settings/__init__.py:12:4: F405 'DEBUG' may be undefined, or defined from star imports: .base, .celery, .constants, .ecs, .logging, .mfa, .monitoring, .payment, .security, .testing
./qcg/settings/__init__.py:12:14: F405 'ENVIRONMENT' may be undefined, or defined from star imports: .base, .celery, .constants, .ecs, .logging, .mfa, .monitoring, .payment, .security, .testing
./scan_data_collect/tasks.py:91:29: F541 f-string is missing placeholders
./tracking/google_tracking2.py:1:1: F401 'json' imported but unused
Are you sure that there are no extra files in the CI?
@sobolevn I listed the files in the actions and here is the output
Run ls -la
total 26
drwxr-xr-x 11 runner docker 4096 Jul 20 15:27 .
drwxr-xr-x 3 runner docker 4096 Jul 20 15:27 ..
-rw-r--r-- 1 runner docker 149 Jul 20 15:27 .coveragerc
-rw-r--r-- 1 runner docker 24 Jul 20 15:27 .dockerignore
drwxr-xr-x 8 runner docker 406 Jul 20 15:27 .git
drwxr-xr-x 3 runner docker 4096 Jul 20 15:27 .github
-rw-r--r-- 1 runner docker 915 Jul 20 15:27 .gitignore
-rw-r--r-- 1 runner docker 4352 Jul 20 15:27 Dockerfile
-rw-r--r-- 1 runner docker 4340 Jul 20 15:27 Dockerfile.dev
-rw-r--r-- 1 runner docker 1373 Jul 20 15:27 Pipfile.bk
-rw-r--r-- 1 runner docker 135592 Jul 20 15:27 Pipfile.lock.bk
-rw-r--r-- 1 runner docker 750 Jul 20 15:27 appspec-qa.yml
-rw-r--r-- 1 runner docker 765 Jul 20 15:27 appspec-staging.yml
-rw-r--r-- 1 runner docker 671 Jul 20 15:27 appspec-v8.yml
-rw-r--r-- 1 runner docker 670 Jul 20 15:27 appspec.yml
-rw-r--r-- 1 runner docker 6908 Jul 20 15:27 bitbucket-pipelines.yml
-rw-r--r-- 1 runner docker 4180 Jul 20 15:27 codedeploy_deploy.py
drwxr-xr-x 6 runner docker 4096 Jul 20 15:27 configs
-rw-r--r-- 1 runner docker 2774 Jul 20 15:27 docker-compose.dev.yml
-rw-r--r-- 1 runner docker 1656 Jul 20 15:27 docker-compose.qa.yml
-rw-r--r-- 1 runner docker 2370 Jul 20 15:27 docker-compose.staging.yml
-rw-r--r-- 1 runner docker 1658 Jul 20 15:27 docker-compose.v8.yml
-rw-r--r-- 1 runner docker 3217 Jul 20 15:27 docker-compose.yml
drwxr-xr-x 3 runner docker 4096 Jul 20 15:27 docs
drwxr-xr-x 3 runner docker 4096 Jul 20 15:27 library_data
-rw-r--r-- 1 runner docker 989 Jul 20 15:27 pytest.ini
-rw-r--r-- 1 runner docker 2331 Jul 20 15:27 readme.md
drwxr-xr-x 2 runner docker 4096 Jul 20 15:27 requirements
drwxr-xr-x 6 runner docker 4096 Jul 20 15:27 scripts
drwxr-xr-x 29 runner docker 4096 Jul 20 15:27 src
drwxr-xr-x 2 runner docker 4096 Jul 20 15:27 static_my_project
-rwxr-xr-x 1 runner docker 49 Jul 20 15:27 update_ecs_service.sh
And I have to check the src directory.
Also, the python version in actions is 3.9.13
Also, there is .flake8 file inside the src directory with the following content
[flake8]
exclude = .git,*migrations*,*tests*,*src/migration/*
max-line-length = 120
Can you please create a reproducable sample?