wemake-services / wemake-python-styleguide

The strictest and most opinionated python linter ever!
https://wemake-python-styleguide.rtfd.io
MIT License
2.5k stars 381 forks source link

Github action doesn't create PR review #2078

Closed fearsd closed 3 years ago

fearsd commented 3 years ago

What's wrong

Github action doesn't create PR review as it described in docs. You can check it there https://github.com/fearsd/idea_tracker_bot/pull/8

How it should be

It should create PR reviews

Flake8 version and plugins

{
  "dependencies": [],
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.9.2",
    "system": "Darwin"
  },
  "plugins": [
    {
      "is_local": false,
      "plugin": "flake8-bandit",
      "version": "2.1.2"
    },
    {
      "is_local": false,
      "plugin": "flake8-broken-line",
      "version": "0.3.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-bugbear",
      "version": "21.4.3"
    },
    {
      "is_local": false,
      "plugin": "flake8-comprehensions",
      "version": "3.5.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-darglint",
      "version": "1.8.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-debugger",
      "version": "4.0.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-docstrings",
      "version": "1.6.0, pydocstyle: 6.1.1"
    },
    {
      "is_local": false,
      "plugin": "flake8-eradicate",
      "version": "1.1.0"
    },
    {
      "is_local": false,
      "plugin": "flake8-string-format",
      "version": "0.3.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_commas",
      "version": "2.0.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_isort",
      "version": "4.0.0"
    },
    {
      "is_local": false,
      "plugin": "flake8_quotes",
      "version": "3.2.0"
    },
    {
      "is_local": false,
      "plugin": "mccabe",
      "version": "0.6.1"
    },
    {
      "is_local": false,
      "plugin": "naming",
      "version": "0.11.1"
    },
    {
      "is_local": false,
      "plugin": "pycodestyle",
      "version": "2.7.0"
    },
    {
      "is_local": false,
      "plugin": "pyflakes",
      "version": "2.3.1"
    },
    {
      "is_local": false,
      "plugin": "rst-docstrings",
      "version": "0.2.3"
    },
    {
      "is_local": false,
      "plugin": "wemake_python_styleguide",
      "version": "0.15.3"
    }
  ],
  "version": "3.9.2"
}

pip information

pip 21.0.1 from /Users/a1/just4fun/idea_tracker_bot/venv/lib/python3.9/site-packages/pip (python 3.9)
aiogram==2.13
aiohttp==3.7.4.post0
astor==0.8.1
async-timeout==3.0.1
attrs==21.2.0
Babel==2.9.1
bandit==1.7.0
certifi==2021.5.30
chardet==4.0.0
coverage==5.5
darglint==1.8.0
docutils==0.17.1
eradicate==2.0.0
flake8==3.9.2
flake8-bandit==2.1.2
flake8-broken-line==0.3.0
flake8-bugbear==21.4.3
flake8-commas==2.0.0
flake8-comprehensions==3.5.0
flake8-debugger==4.0.0
flake8-docstrings==1.6.0
flake8-eradicate==1.1.0
flake8-isort==4.0.0
flake8-polyfill==1.0.2
flake8-quotes==3.2.0
flake8-rst-docstrings==0.2.3
flake8-string-format==0.3.0
gitdb==4.0.7
GitPython==3.1.18
greenlet==1.1.0
idna==3.2
iniconfig==1.1.1
isort==5.9.1
mccabe==0.6.1
multidict==5.1.0
packaging==20.9
pbr==5.6.0
pep8-naming==0.11.1
pluggy==0.13.1
psycopg2==2.8.6
py==1.10.0
pycodestyle==2.7.0
pydocstyle==6.1.1
pyflakes==2.3.1
Pygments==2.9.0
pyparsing==2.4.7
pytest==6.2.4
pytest-cov==2.12.1
pytest-dotenv==0.5.2
python-dotenv==0.17.1
pytz==2021.1
PyYAML==5.4.1
restructuredtext-lint==1.3.2
six==1.16.0
smmap==4.0.0
snowballstemmer==2.1.0
SQLAlchemy==1.4.18
stevedore==3.3.0
testfixtures==6.17.1
toml==0.10.2
typing-extensions==3.10.0.0
wemake-python-styleguide==0.15.3
yarl==1.6.3

OS information

macOS 11.3.1 - local machine github action - ubuntu-latest

sobolevn commented 3 years ago

Hi!

Things to check:

  1. GitHub Permissions
  2. Whether there are any actual violations
  3. But, not too many of them, because it won't comment on more than ~50 of them
  4. That configuration is the same we have here, because it works for us: https://github.com/wemake-services/wemake-python-styleguide/pull/2070#pullrequestreview-688133292
fearsd commented 3 years ago
  1. I think workflows have right permissions image

  2. Can you send a link to recognize the actual violations? Logs in pipeline for wemake-python-styleguide:

    
    /usr/bin/docker run --name c9a4171703b43a6918dfa7ede6b6aa2_3e2c1e --label 442333 --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_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_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -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/idea_tracker_bot/idea_tracker_bot":"/github/workspace" 442333:1c9a4171703b43a6918dfa7ede6b6aa2  "." "github-pr-review"
    Using reporter: github-pr-review
    Linting path: .
    flake8 --version:
    3.9.2 (flake8-bandit: 2.1.2, flake8-broken-line: 0.3.0, flake8-bugbear:
    21.4.3, flake8-comprehensions: 3.5.0, flake8-darglint: 1.8.0, flake8-debugger:
    4.0.0, flake8-docstrings: 1.6.0, pydocstyle: 6.1.1, flake8-eradicate: 1.1.0,
    flake8-string-format: 0.3.0, flake8_commas: 2.0.0, flake8_isort: 4.0.0,
    flake8_quotes: 3.2.0, mccabe: 0.6.1, naming: 0.11.1, pycodestyle: 2.7.0,
    pyflakes: 2.3.1, rst-docstrings: 0.2.3, wemake_python_styleguide: 0.15.3)
    CPython 3.9.5 on Linux
    =================================

reviewdog: this is not PullRequest build. ./tests.py:1:1: F401 'pytest' imported but unused ./tests.py:2:1: I003 isort expected 1 blank line in imports, found 0 ./tests.py:3:1: I003 isort expected 1 blank line in imports, found 0 ./tests.py:4:1: E302 expected 2 blank lines, found 1 ./tests.py:4:1: D103 Missing docstring in public function ./tests.py:5:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:8:1: D103 Missing docstring in public function ./tests.py:9:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:12:1: D103 Missing docstring in public function ./tests.py:13:5: WPS110 Found wrong variable name: data ./tests.py:15:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:16:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:16:20: WPS421 Found wrong function call: dir ./tests.py:16:29: W292 no newline at end of file ./main.py:1:1: D100 Missing docstring in public module ./main.py:1:1: I001 isort found an import in the wrong position ./main.py:4:1: I001 isort found an import in the wrong position ./main.py:5:1: I001 isort found an import in the wrong position ./main.py:5:1: WPS458 Found imports collision: models ./main.py:5:1: WPS458 Found imports collision: models ./main.py:6:1: I001 isort found an import in the wrong position ./main.py:9:1: I003 isort expected 1 blank line in imports, found 0 ./main.py:9:1: I005 isort found an unexpected missing import ./main.py:12:1: E722 do not use bare 'except' ./main.py:12:1: B001 Do not use bare except:, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer except Exception:. If you're sure what you're doing, be explicit and write except BaseException:. ./main.py:23:1: D103 Missing docstring in public function ./main.py:24:5: WPS421 Found wrong function call: print ./main.py:25:12: WPS317 Found incorrect multi-line parameters ./main.py:26:45: C812 missing trailing comma ./main.py:27:25: WPS319 Found bracket in wrong position ./main.py:28:5: WPS421 Found wrong function call: print ./main.py:31:1: E302 expected 2 blank lines, found 1 ./main.py:32:1: D103 Missing docstring in public function ./main.py:33:5: WPS421 Found wrong function call: print ./main.py:37:51: W292 no newline at end of file ./config.py:1:1: D100 Missing docstring in public module ./config.py:3:24: Q000 Remove bad quotes ./conftest.py:1:1: D100 Missing docstring in public module ./conftest.py:4:1: I003 isort expected 1 blank line in imports, found 0 ./conftest.py:5:1: I003 isort expected 1 blank line in imports, found 0 ./conftest.py:6:1: E302 expected 2 blank lines, found 1 ./conftest.py:7:1: D103 Missing docstring in public function ./conftest.py:9:6: N806 variable 'SessionLocal' in function should be lowercase ./conftest.py:16:19: W292 no newline at end of file ./handlers.py:1:1: D100 Missing docstring in public module ./handlers.py:1:1: F401 'models.get_db' imported but unused ./handlers.py:4:1: D103 Missing docstring in public function ./handlers.py:4:22: WPS110 Found wrong variable name: data ./handlers.py:5:1: E800 Found commented out code ./models.py:1:1: D100 Missing docstring in public module ./models.py:2:1: I001 isort found an import in the wrong position ./models.py:3:1: I003 isort expected 1 blank line in imports, found 0 ./models.py:3:1: I005 isort found an unexpected missing import ./models.py:6:1: I001 isort found an import in the wrong position ./models.py:7:1: I001 isort found an import in the wrong position ./models.py:11:1: D103 Missing docstring in public function ./models.py:12:9: W291 trailing whitespace ./models.py:13:9: WPS221 Found line with high Jones Complexity: 18 > 14 ./models.py:13:10: N806 variable 'SQLALCHEMY_DATABASE_URL' in function should be lowercase ./models.py:13:35: WPS305 Found f string ./models.py:13:80: E501 line too long (137 > 79 characters) ./models.py:14:5: E722 do not use bare 'except' ./models.py:14:5: B001 Do not use bare except:, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer except Exception:. If you're sure what you're doing, be explicit and write except BaseException:. ./models.py:15:10: N806 variable 'SQLALCHEMY_DATABASE_URL' in function should be lowercase ./models.py:18:10: N806 variable 'SQLALCHEMY_DATABASE_URL' in function should be lowercase ./models.py:18:80: E501 line too long (100 > 79 characters) ./models.py:18:82: Q000 Remove bad quotes ./models.py:20:5: WPS331 Found variables that are only used for return: engine ./models.py:22:1: E305 expected 2 blank lines after class or function definition, found 1 ./models.py:24:1: E302 expected 2 blank lines, found 1 ./models.py:24:1: D103 Missing docstring in public function ./models.py:26:6: N806 variable 'SessionLocal' in function should be lowercase ./models.py:28:5: WPS501 Found finally in try block without except ./models.py:33:1: E302 expected 2 blank lines, found 1 ./models.py:33:1: D101 Missing docstring in public class ./models.py:39:1: D101 Missing docstring in public class ./models.py:39:1: WPS110 Found wrong variable name: Item ./models.py:46:25: Q000 Remove bad quotes ./models.py:46:49: W292 no newline at end of file

./tests.py:1:1: D100 Missing docstring in public module ./tests.py:1:1: F401 'pytest' imported but unused ./tests.py:2:1: I003 isort expected 1 blank line in imports, found 0 ./tests.py:3:1: I003 isort expected 1 blank line in imports, found 0 ./tests.py:4:1: E302 expected 2 blank lines, found 1 ./tests.py:4:1: D103 Missing docstring in public function ./tests.py:5:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:8:1: D103 Missing docstring in public function ./tests.py:9:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:12:1: D103 Missing docstring in public function ./tests.py:13:5: WPS110 Found wrong variable name: data ./tests.py:15:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:16:1: S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. ./tests.py:16:20: WPS421 Found wrong function call: dir ./tests.py:16:29: W292 no newline at end of file ./main.py:1:1: D100 Missing docstring in public module ./main.py:1:1: I001 isort found an import in the wrong position ./main.py:4:1: I001 isort found an import in the wrong position ./main.py:5:1: I001 isort found an import in the wrong position ./main.py:5:1: WPS458 Found imports collision: models ./main.py:5:1: WPS458 Found imports collision: models ./main.py:6:1: I001 isort found an import in the wrong position ./main.py:9:1: I003 isort expected 1 blank line in imports, found 0 ./main.py:9:1: I005 isort found an unexpected missing import ./main.py:12:1: E722 do not use bare 'except' ./main.py:12:1: B001 Do not use bare except:, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer except Exception:. If you're sure what you're doing, be explicit and write except BaseException:. ./main.py:23:1: D103 Missing docstring in public function ./main.py:24:5: WPS421 Found wrong function call: print ./main.py:25:12: WPS317 Found incorrect multi-line parameters ./main.py:26:45: C812 missing trailing comma ./main.py:27:25: WPS319 Found bracket in wrong position ./main.py:28:5: WPS421 Found wrong function call: print ./main.py:31:1: E302 expected 2 blank lines, found 1 ./main.py:32:1: D103 Missing docstring in public function ./main.py:33:5: WPS421 Found wrong function call: print ./main.py:37:51: W292 no newline at end of file ./config.py:1:1: D100 Missing docstring in public module ./config.py:3:24: Q000 Remove bad quotes ./conftest.py:1:1: D100 Missing docstring in public module ./conftest.py:4:1: I003 isort expected 1 blank line in imports, found 0 ./conftest.py:5:1: I003 isort expected 1 blank line in imports, found 0 ./conftest.py:6:1: E302 expected 2 blank lines, found 1 ./conftest.py:7:1: D103 Missing docstring in public function ./conftest.py:9:6: N806 variable 'SessionLocal' in function should be lowercase ./conftest.py:16:19: W292 no newline at end of file ./handlers.py:1:1: D100 Missing docstring in public module ./handlers.py:1:1: F401 'models.get_db' imported but unused ./handlers.py:4:1: D103 Missing docstring in public function ./handlers.py:4:22: WPS110 Found wrong variable name: data ./handlers.py:5:1: E800 Found commented out code ./models.py:1:1: D100 Missing docstring in public module ./models.py:2:1: I001 isort found an import in the wrong position ./models.py:3:1: I003 isort expected 1 blank line in imports, found 0 ./models.py:3:1: I005 isort found an unexpected missing import ./models.py:6:1: I001 isort found an import in the wrong position ./models.py:7:1: I001 isort found an import in the wrong position ./models.py:11:1: D103 Missing docstring in public function ./models.py:12:9: W291 trailing whitespace ./models.py:13:9: WPS221 Found line with high Jones Complexity: 18 > 14 ./models.py:13:10: N806 variable 'SQLALCHEMY_DATABASE_URL' in function should be lowercase ./models.py:13:35: WPS305 Found f string ./models.py:13:80: E501 line too long (137 > 79 characters) ./models.py:14:5: E722 do not use bare 'except' ./models.py:14:5: B001 Do not use bare except:, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer except Exception:. If you're sure what you're doing, be explicit and write except BaseException:. ./models.py:15:10: N806 variable 'SQLALCHEMY_DATABASE_URL' in function should be lowercase ./models.py:18:10: N806 variable 'SQLALCHEMY_DATABASE_URL' in function should be lowercase ./models.py:18:80: E501 line too long (100 > 79 characters) ./models.py:18:82: Q000 Remove bad quotes ./models.py:20:5: WPS331 Found variables that are only used for return: engine ./models.py:22:1: E305 expected 2 blank lines after class or function definition, found 1 ./models.py:24:1: E302 expected 2 blank lines, found 1 ./models.py:24:1: D103 Missing docstring in public function ./models.py:26:6: N806 variable 'SessionLocal' in function should be lowercase ./models.py:28:5: WPS501 Found finally in try block without except ./models.py:33:1: E302 expected 2 blank lines, found 1 ./models.py:33:1: D101 Missing docstring in public class ./models.py:39:1: D101 Missing docstring in public class ./models.py:39:1: WPS110 Found wrong variable name: Item ./models.py:46:25: Q000 Remove bad quotes ./models.py:46:49: W292 no newline at end of file Process failed with the status code: 1



I suppose the problem in 
`reviewdog: this is not PullRequest build.`
I found only one case in the internet https://stackoverflow.com/questions/66309574/reviewdog-this-is-not-pullrequest-build
But it connected with JS and CircleCI

3. Ok, I will notice it. Is it reviewdog limitation?

4. Yes, I learned the logs from this pull request and noticed the suspicious log mentioned above.

P.S
 Sorry if I didn't grasp something correctly, I started using Github Actions today)
sobolevn commented 3 years ago

Yes,

I suppose the problem in reviewdog: this is not PullRequest build.

Looks like the root of this problem! 👍

fearsd commented 3 years ago

Ok, it was my mistake 😅. I put in workflow file on: push, when reviewdog only works with on: pull_request. After this fix, action started making reviews. https://github.com/fearsd/idea_tracker_bot/pull/8. Thanks!

sobolevn commented 3 years ago

Glad it worked!