# pre-commit
.pre-commit-config.yaml @hugovk @AlexWaygood
+.ruff.toml @hugovk @AlexWaygood
# asyncio
**/*asyncio* @1st1 @asvetlov
# into the PR branch anyway.
#
# https://github.com/python/core-workflow/issues/373
- git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
+ git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo "run_ssl_tests=true" >> $GITHUB_OUTPUT || true
fi
- name: Compute hash for config cache key
permissions:
contents: read
+env:
+ FORCE_COLOR: 1
+ RUFF_FORMAT: github
+
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
repos:
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.0.288
+ hooks:
+ - id: ruff
+ name: Run Ruff on Lib/test/
+ args: [--exit-non-zero-on-fix]
+ files: ^Lib/test/
+
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
+ - id: check-toml
+ exclude: ^Lib/test/test_tomllib/
- id: check-yaml
- id: trailing-whitespace
types_or: [c, python, rst]
--- /dev/null
+fix = true
+select = [
+ "F811", # Redefinition of unused variable (useful for finding test methods with the same name)
+]
+extend-exclude = [
+ # Failed to lint
+ "badsyntax_pep3120.py",
+ "encoded_modules/module_iso_8859_1.py",
+ "encoded_modules/module_koi8_r.py",
+ "test_source_encoding.py",
+ # Failed to parse
+ "badsyntax_3131.py",
+ "test_fstring.py",
+ # TODO Fix: F811 Redefinition of unused name
+ "test_buffer.py",
+ "test_dataclasses.py",
+ "test_descr.py",
+ "test_enum.py",
+ "test_functools.py",
+ "test_genericclass.py",
+ "test_grammar.py",
+ "test_import/__init__.py",
+ "test_keywordonlyarg.py",
+ "test_pkg.py",
+ "test_subclassinit.py",
+ "test_tokenize.py",
+ "test_typing.py",
+ "test_yield_from.py",
+ "time_hashlib.py",
+]