-
-
Notifications
You must be signed in to change notification settings - Fork 48
Lint on GitHub Actions via pre-commit #93
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
Merged
Merged
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
27e4367
Upgrade Python syntax with pyupgrade
hugovk ca95e6b
Format with Black
hugovk 5a2a1f8
Sort imports with isort
hugovk 704cb67
Add and fix Flake8 warnings
hugovk da786e7
Add more pre-commit checks
hugovk 31cdcbd
Format pyproject.toml for easy comparison with other projects
hugovk b9a7b24
Add bandit to pre-commit
hugovk 735bb52
Add codespell to pre-commit
hugovk 4abea3d
Add mypy to pre-commit
hugovk 48825bb
Move safety to lint.yml
hugovk 70b6106
Merge remote-tracking branch 'upstream/main' into lint
hugovk a9ddb87
Add whitespace
hugovk a0eef4a
Add f to string segment without placeholders
hugovk 70505ef
Update pre-commit
hugovk fb20a18
Update cache-dependency-path and bump GitHub Actions
hugovk 328c08f
Merge remote-tracking branch 'upstream/main' into lint
hugovk b17da2f
Update pre-commit
hugovk b7395f3
Merge remote-tracking branch 'upstream/main' into lint
hugovk 2d3a122
Capitalise docstring
hugovk da31633
Bump pre-commit
hugovk a2e0890
Shorten docstring
hugovk bd636ad
Oops
hugovk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [flake8] | ||
| extend-ignore = C408,E203,F841,W503 | ||
| max-complexity = 10 | ||
| max-line-length = 88 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Lint | ||
|
|
||
| on: [push, pull_request, workflow_dispatch] | ||
|
|
||
| env: | ||
| FORCE_COLOR: 1 | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.x" | ||
| cache: pip | ||
| cache-dependency-path: .github/workflows/lint.yml | ||
| - uses: pre-commit/action@v3.0.0 | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip wheel | ||
| # TODO: remove setuptools installation when safety==2.4.0 is released | ||
| python -m pip install --upgrade safety setuptools | ||
| python -m pip install --editable . | ||
| # Ignore CVE-2023-5752, we're not using that pip or feature | ||
| - run: safety check --ignore 62044 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| repos: | ||
| - repo: https://github.com/asottile/pyupgrade | ||
| rev: v3.15.0 | ||
| hooks: | ||
| - id: pyupgrade | ||
| args: [--py38-plus] | ||
|
|
||
| - repo: https://github.com/psf/black-pre-commit-mirror | ||
| rev: 23.12.1 | ||
| hooks: | ||
| - id: black | ||
|
|
||
| - repo: https://github.com/PyCQA/isort | ||
| rev: 5.13.2 | ||
| hooks: | ||
| - id: isort | ||
| args: [--add-import=from __future__ import annotations] | ||
|
|
||
| - repo: https://github.com/PyCQA/bandit | ||
| rev: 1.7.6 | ||
| hooks: | ||
| - id: bandit | ||
| args: ["--skip=B101,B404,B603"] | ||
|
|
||
| - repo: https://github.com/PyCQA/flake8 | ||
| rev: 7.0.0 | ||
| hooks: | ||
| - id: flake8 | ||
| additional_dependencies: | ||
| [ | ||
| flake8-2020, | ||
| flake8-bugbear, | ||
| flake8-comprehensions, | ||
| flake8-implicit-str-concat, | ||
| flake8-logging, | ||
| ] | ||
|
|
||
| - repo: https://github.com/pre-commit/pygrep-hooks | ||
| rev: v1.10.0 | ||
| hooks: | ||
| - id: python-check-blanket-noqa | ||
|
|
||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.5.0 | ||
| hooks: | ||
| - id: check-case-conflict | ||
| - id: check-executables-have-shebangs | ||
| - id: check-merge-conflict | ||
| - id: check-json | ||
| - id: check-toml | ||
| - id: check-yaml | ||
| - id: debug-statements | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
|
|
||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.8.0 | ||
| hooks: | ||
| - id: mypy | ||
| args: | ||
| [ | ||
| --ignore-missing-imports, | ||
| --install-types, | ||
| --non-interactive, | ||
| --pretty, | ||
| --show-error-codes, | ||
| ., | ||
| ] | ||
| pass_filenames: false | ||
|
|
||
| - repo: https://github.com/tox-dev/pyproject-fmt | ||
| rev: 1.6.0 | ||
| hooks: | ||
| - id: pyproject-fmt | ||
|
|
||
| - repo: https://github.com/abravalheri/validate-pyproject | ||
| rev: v0.15 | ||
| hooks: | ||
| - id: validate-pyproject | ||
|
|
||
| - repo: https://github.com/codespell-project/codespell | ||
| rev: v2.2.6 | ||
| hooks: | ||
| - id: codespell | ||
| args: [--ignore-words-list=commitish] | ||
|
|
||
| ci: | ||
| autoupdate_schedule: quarterly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| """Backport CPython changes from main to maintenance branches.""" | ||
| from __future__ import annotations | ||
|
|
||
| import importlib.metadata | ||
|
|
||
| __version__ = importlib.metadata.version(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from .cherry_picker import cherry_pick_cli | ||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.