Skip to content

Commit

Permalink
updated pre-commit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard committed May 12, 2022
1 parent fa07e9c commit e55e48e
Show file tree
Hide file tree
Showing 5 changed files with 1,479 additions and 1,458 deletions.
15 changes: 14 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ repos:
name: "Python: Formating files"
args: [--line-length=88, --preview, --safe]
types: [file, python]
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
hooks:
- id: pyupgrade
name: "Python: upgrade syntax"
args: [--py37-plus]
- repo: https://github.com/hadialqattan/pycln
rev: v1.3.2
hooks:
Expand Down Expand Up @@ -93,6 +99,7 @@ repos:
# making isort line length compatible with black
- "--max-line-length=88"
- "--max-complexity=18"
- "--kwargs-max-positional-arguments=4"
# allowing these errors now that in the past we ignored.
# D100 Missing docstring in public module
# D103 Missing docstring in public function
Expand Down Expand Up @@ -131,7 +138,13 @@ repos:
- flake8-colors
- flake8-tuple
- pandas-vet
# - wemake-python-styleguide
- flake8-length
- flake8-assertive
- flake8-warnings
- flake8-comprehensions
- flake8-simplify
- flake8-noqa
- flake8-force-keyword-arguments
exclude: "setup[.]py|conf[.]py|__init__[.]py"
types: [file, python]
- repo: https://github.com/asottile/add-trailing-comma
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@
"pylance",
"pyright",
"Verbex"
],
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--ignore=E501"
]
}
26 changes: 12 additions & 14 deletions check_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,18 @@ def main() -> int:
print(f"ERROR: '{module_name}' is not all lowercase with underscores")
return ExitCode.DATA_ERR
# check package if exists
if package_name.strip() != "":
# check package name
if not re.fullmatch("[A-Za-z]+", package_name):
if re.fullmatch("[A-Za-z0-9]+", package_name):
print(
f"WARNING: '{package_name}' has numbers - allowing but note"
" this is not 'strictly' to pep 8 best practices",
)
else:
print(
f"ERROR: '{package_name}' is not all lowercase with no"
" underscores",
)
return ExitCode.DATA_ERR
# check package name
if package_name.strip() != "" and not re.fullmatch("[A-Za-z]+", package_name):
if re.fullmatch("[A-Za-z0-9]+", package_name):
print(
f"WARNING: '{package_name}' has numbers - allowing but note"
" this is not 'strictly' to pep 8 best practices",
)
else:
print(
f"ERROR: '{package_name}' is not all lowercase with no underscores",
)
return ExitCode.DATA_ERR
return ExitCode.OK


Expand Down
Loading

0 comments on commit e55e48e

Please sign in to comment.