Skip to content

Commit

Permalink
Merge pull request #788 from PCMDI/787_ljw_pre-commit-hook
Browse files Browse the repository at this point in the history
I am merging this PR and will open another PR for make existing files to be compliant to the pre-commit-hook
  • Loading branch information
lee1043 authored Nov 3, 2021
2 parents b60e8ce + b152684 commit e487a9e
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
exclude: "docs|node_modules|migrations|.git|.tox"
default_stages: [commit]
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

# Need to use flake8 GitHub mirror due to CentOS git issue with GitLab
# https://github.com/pre-commit/pre-commit/issues/1206
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ["--config=setup.cfg"]
additional_dependencies: [flake8-isort]
exclude: ^sample_setups/jsons/

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
args: ["--config=setup.cfg"]
42 changes: 40 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
[flake8]
# https://pep8.readthedocs.io/en/latest/intro.html#error-codes
ignore =
# whitespace before ‘:’
E203
# line too long (82 > 79 characters)
E501
# line break before operator
W503
# Max width of Github code review is 119 characters
max-line-length = 119
max-complexity = 10
exclude =
.tox
.git
*/migrations/*
*/static/CACHE/*
docs
node_modules
.idea
.mypy_cache
.pytest_cache
*__init__.py
venv
*json

[mypy]
python_version = 3.8
check_untyped_defs = True
ignore_missing_imports = True
warn_unused_ignores = True
warn_redundant_casts = True
warn_unused_configs = True

[aliases]
# Define setup.py command aliases here
test = pytest

[tool:pytest]
junit_family=xunit2
junit_family = xunit2
addopts = --cov=pcmdi_metrics --cov-report term --cov-report html:tests_coverage_reports/htmlcov --cov-report xml:tests_coverage_reports/coverage.xml -s --ignore tests/deprecated
python_files = tests.py test_*.py
python_files = tests.py test_*.py

0 comments on commit e487a9e

Please sign in to comment.