Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix precommit regex (and format / linter errors) #863

Merged
merged 10 commits into from
Nov 2, 2017
47 changes: 28 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
# yet another python formatter
- repo: git://github.com/pre-commit/mirrors-yapf
sha: v0.17.0
sha: v0.19.0
hooks:
- id: yapf
language: system
files: >-
^(aiida/control/)
|(aiida/cmdline/tests)
|(docs/update_req_for_rtd.py)
|(.travis_data/test_setup.py)
|(aiida/backends/tests/verdi_commands.py)
|(aiida/utils/.*fixtures.py)
files: >- # begin multiline string
(?x)^( # (?x) -> multiline regex, ^ -> beginning of file path
aiida/control/.*.py| # must match the whole path, therefore
aiida/cmdline/tests/.*.py| # the .*.py (.* matches everything)
docs/update_req_for_rtd.py| # a|b -> match a OR b
.travis_data/test_setup.py|
.travis-data/test_plugin_testcase.py|
aiida/backends/tests/verdi_commands.py|
aiida/utils/fixtures.py
)$ # $ -> end of file path, to add a directory, give full/path/.*

# prospector: collection of linters
- repo: git://github.com/guykisel/prospector-mirror
sha: b27f281eb9398fc8504415d7fbdabf119ea8c5e1
hooks:
- id: prospector
language: system
exclude: '^(tests/)|(examples/)'
exclude: ^(tests/|examples/)
types: [file, python]
files: >-
^(aiida/control/)
|(aiida/cmdline/tests)
|(docs/update_req_for_rtd.py)
|(.travis_data/test_setup.py)
|(aiida/backends/tests/verdi_commands.py)
|(aiida/utils/.*fixtures.py)
(?x)^(
aiida/control/.*.py|
aiida/cmdline/tests/.*.py|
docs/update_req_for_rtd.py|
.travis_data/test_setup.py|
.travis-data/test_plugin_testcase.py|
aiida/backends/tests/verdi_commands.py|
aiida/utils/fixtures.py
)$

- repo: local
hooks:
Expand All @@ -34,13 +41,15 @@
entry: python ./docs/update_req_for_rtd.py --pre-commit
language: system
files: >-
^(setup_requirements.py)
|(docs/requirements_for_rtd.txt)
|(docs/update_req_for_rtd.py)
(?x)^(
setup_requirements.py|
docs/requirements_for_rtd.txt|
docs/update_req_for_rtd.py|
)$
pass_filenames: false

- repo: git://github.com/pre-commit/pre-commit-hooks
sha: v0.9.4
sha: v1.1.1
hooks:
- id: check-yaml

Expand Down
4 changes: 3 additions & 1 deletion .travis-data/test_plugin_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

def determine_backend():
return BACKEND_DJANGO if os.environ.get(
'TEST_AIIDA_BACKEND', BACKEND_DJANGO) == BACKEND_DJANGO else BACKEND_SQLA
'TEST_AIIDA_BACKEND',
BACKEND_DJANGO) == BACKEND_DJANGO else BACKEND_SQLA


class PluginTestcaseTestCase(PluginTestCase):
"""Test the PluginTestcase from utils.fixtures"""
BACKEND = determine_backend()

def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion .travis-data/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ case "$TEST_TYPE" in
verdi -p $TEST_AIIDA_BACKEND run ${TRAVIS_BUILD_DIR}/.travis-data/test_daemon.py
;;
pre-commit)
pre-commit run --all-files
pre-commit run --all-files || git status --short && git diff
;;
esac