From 228aa766eb0d3506c79ece135ae6134232a5d25d Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 30 Dec 2020 08:49:08 +0000 Subject: [PATCH 1/2] add hook for disallowing bare pytest raises --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d78c2bacc4e44..27c775ae397c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -121,6 +121,13 @@ repos: entry: python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module" types: [python] exclude: ^(asv_bench|pandas/tests|doc)/ + - id: unwanted-patterns-bare-pytest-raises + name: Check for use of bare pytest raises + language: python + entry: python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises" + types: [python] + files: ^pandas/tests/ + exclude: ^pandas/tests/(arrays|computation|dtypes|extension|indexes|indexing|io|libs|reductions|resample|reshape|series|window)/ - id: inconsistent-namespace-usage name: 'Check for inconsistent use of pandas namespace in tests' entry: python scripts/check_for_inconsistent_pandas_namespace.py From 79e7c032c0e1a5c4157aa34930a68fda35feedfc Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 1 Jan 2021 08:28:54 +0000 Subject: [PATCH 2/2] narrow down excludes based on latest merged PRs --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27c775ae397c7..2dade8afbf91f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,5 @@ minimum_pre_commit_version: 2.9.2 +exclude: ^LICENSES/|\.(html|csv|svg)$ repos: - repo: https://github.com/python/black rev: 20.8b1 @@ -127,7 +128,7 @@ repos: entry: python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises" types: [python] files: ^pandas/tests/ - exclude: ^pandas/tests/(arrays|computation|dtypes|extension|indexes|indexing|io|libs|reductions|resample|reshape|series|window)/ + exclude: ^pandas/tests/(computation|extension|io)/ - id: inconsistent-namespace-usage name: 'Check for inconsistent use of pandas namespace in tests' entry: python scripts/check_for_inconsistent_pandas_namespace.py @@ -144,7 +145,7 @@ repos: name: Check for use of foo.__class__ instead of type(foo) entry: \.__class__ language: pygrep - files: \.(py|pyx)$ + types_or: [python, cython] - id: unwanted-typing name: Check for use of comment-based annotation syntax and missing error codes entry: | @@ -172,9 +173,8 @@ repos: rev: v3.4.0 hooks: - id: end-of-file-fixer - exclude: ^LICENSES/|\.(html|csv|txt|svg|py)$ + exclude: \.txt$ - id: trailing-whitespace - exclude: \.(html|svg)$ - repo: https://github.com/codespell-project/codespell rev: v2.0.0 hooks: