-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pre-commit for linting and code formatting
Bug: T281633 Change-Id: Ibef01b1c705ec560cafa7bc71feca7f5a0824037
- Loading branch information
Showing
9 changed files
with
165 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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,40 @@ | ||
name: pre-commit | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- stable | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
PYWIKIBOT_TEST_RUNNING: 1 | ||
PYWIKIBOT_NO_USER_CONFIG: 2 | ||
jobs: | ||
pre-commit: | ||
matrix: | ||
python-version: | ||
- "3.13.0-alpha - 3.13.0" | ||
- "3.14-dev" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: set up python ${{ matrix.python-version }} | ||
if: "!endsWith(matrix.python-version, '-dev')" | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: set up development python ${{ matrix.python-version }} | ||
if: "endsWith(matrix.python-version, '-dev')" | ||
uses: deadsnakes/[email protected] | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: run pre-commit | ||
uses: pre-commit/[email protected] | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: false | ||
timeout-minutes: 100 |
This file contains 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,87 @@ | ||
repos: | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
- id: check-useless-excludes | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-toml | ||
- id: check-vcs-permalinks | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: destroyed-symlinks | ||
- id: end-of-file-fixer | ||
- id: fix-byte-order-marker | ||
- id: fix-encoding-pragma | ||
args: | ||
- --remove | ||
- id: forbid-new-submodules | ||
- id: mixed-line-ending | ||
- id: pretty-format-json | ||
args: | ||
- --autofix | ||
- --indent=4 | ||
- --no-ensure-ascii | ||
- id: trailing-whitespace | ||
args: | ||
- --markdown-linebreak-ext=rst | ||
exclude: '^tests/data/' | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: python-check-blanket-noqa | ||
- id: python-check-blanket-type-ignore | ||
- id: python-check-mock-methods | ||
- id: python-use-type-annotations | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.17.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: | ||
- --py37-plus | ||
- repo: https://github.com/PyCQA/autoflake | ||
rev: v2.3.1 | ||
hooks: | ||
- id: autoflake | ||
args: | ||
- --expand-star-imports | ||
- --in-place | ||
- --remove-all-unused-imports | ||
- --remove-duplicate-keys | ||
- --remove-unused-variables | ||
exclude: '^pywikibot/backports\.py$' | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
exclude: '^pwb\.py$' | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 | ||
args: | ||
- --doctests | ||
additional_dependencies: | ||
# Due to incompatibilities between packages the order matters. | ||
- darglint2 | ||
- pydocstyle==6.3.0 # deprecated and no longer maintained | ||
- flake8-bugbear!=24.1.17 | ||
- flake8-comprehensions>=3.13.0 | ||
- flake8-docstrings>=1.4.0 | ||
- flake8-mock-x2 | ||
- flake8-print>=5.0.0 | ||
- flake8-quotes>=3.3.2 | ||
- flake8-raise | ||
- flake8-tuple>=0.4.1 | ||
- flake8-no-u-prefixed-strings>=0.2 | ||
- pep8-naming>=0.13.3 |
This file contains 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
This file contains 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
This file contains 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,26 +1,26 @@ | ||
{ | ||
"@metadata": { | ||
"authors": [ | ||
"Daniel Herding", | ||
"Huji", | ||
"Siebrand", | ||
"Revi", | ||
"Russell Blau", | ||
"Xqt" | ||
] | ||
}, | ||
"pywikibot-bot-prefix": "Bot:", | ||
"pywikibot-cosmetic-changes": "; cosmetic changes", | ||
"pywikibot-enter-category-name": "Please enter the category name:", | ||
"pywikibot-enter-file-links-processing": "Links to which file page should be processed?", | ||
"pywikibot-enter-finished-browser": "Press Enter when finished in browser.", | ||
"pywikibot-enter-namespace-number": "Please enter a namespace by its number:", | ||
"pywikibot-enter-new-text": "Please enter the new text:", | ||
"pywikibot-enter-page-processing": "Which page should be processed?", | ||
"pywikibot-enter-xml-filename": "Please enter the XML dump's filename:", | ||
"pywikibot-fixes-fckeditor": "Bot: Fixing rich-editor html", | ||
"pywikibot-fixes-isbn": "Bot: Formatting ISBN", | ||
"pywikibot-fixes-html": "Bot: Converting/fixing HTML", | ||
"pywikibot-fixes-syntax": "Bot: Fixing wiki syntax", | ||
"pywikibot-touch": "Pywikibot touch edit" | ||
"@metadata": { | ||
"authors": [ | ||
"Daniel Herding", | ||
"Huji", | ||
"Siebrand", | ||
"Revi", | ||
"Russell Blau", | ||
"Xqt" | ||
] | ||
}, | ||
"pywikibot-bot-prefix": "Bot:", | ||
"pywikibot-cosmetic-changes": "; cosmetic changes", | ||
"pywikibot-enter-category-name": "Please enter the category name:", | ||
"pywikibot-enter-file-links-processing": "Links to which file page should be processed?", | ||
"pywikibot-enter-finished-browser": "Press Enter when finished in browser.", | ||
"pywikibot-enter-namespace-number": "Please enter a namespace by its number:", | ||
"pywikibot-enter-new-text": "Please enter the new text:", | ||
"pywikibot-enter-page-processing": "Which page should be processed?", | ||
"pywikibot-enter-xml-filename": "Please enter the XML dump's filename:", | ||
"pywikibot-fixes-fckeditor": "Bot: Fixing rich-editor html", | ||
"pywikibot-fixes-html": "Bot: Converting/fixing HTML", | ||
"pywikibot-fixes-isbn": "Bot: Formatting ISBN", | ||
"pywikibot-fixes-syntax": "Bot: Fixing wiki syntax", | ||
"pywikibot-touch": "Pywikibot touch edit" | ||
} |
This file contains 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
This file contains 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
This file contains 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,4 @@ | ||
{ | ||
"test-multiple-plurals": "Bot: %(action)s %(line)s {{PLURAL:line|Zeile|Zeilen}} von {{PLURAL:%(page)d|einer|mehreren}} {{PLURAL:page|Seite|Seiten}}.", | ||
"test-plural": "Bot: Ändere %(num)d {{PLURAL:num|Seite|Seiten}}." | ||
} | ||
} |
This file contains 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