Skip to content

Commit

Permalink
Merge pull request #863 from DropD/fix-precommit-regex
Browse files Browse the repository at this point in the history
Fix precommit regex (and format / linter errors)
  • Loading branch information
szoupanos authored Nov 2, 2017
2 parents 7894a19 + f37d685 commit 4e5852f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
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

0 comments on commit 4e5852f

Please sign in to comment.