chore: add pylint to pre-commit hook (#28137)

This commit is contained in:
Maxime Beauchemin 2024-04-25 07:58:44 -07:00 committed by GitHub
parent 2d63722150
commit 7b40b6426c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 7 deletions

View File

@ -31,10 +31,6 @@ jobs:
- name: Setup Python
uses: ./.github/actions/setup-backend/
if: steps.check.outputs.python
- name: pylint
if: steps.check.outputs.python
# `-j 0` run Pylint in parallel
run: pylint -j 0 superset
babel-extract:
runs-on: ubuntu-20.04

View File

@ -77,3 +77,17 @@ repos:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
exclude: ^(tests/|superset/migrations/|scripts/|RELEASING/|docker/)
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=.pylintrc",
]

View File

@ -30,9 +30,9 @@ with open(PACKAGE_JSON) as package_file:
def get_git_sha() -> str:
try:
s = subprocess.check_output(["git", "rev-parse", "HEAD"])
return s.decode().strip()
except Exception:
output = subprocess.check_output(["git", "rev-parse", "HEAD"])
return output.decode().strip()
except Exception: # pylint: disable=broad-except
return ""