-
Notifications
You must be signed in to change notification settings - Fork 118
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
infra: update the pre-commit hook with linters #678
Changes from all commits
17d7908
e95e93b
f6f4eae
291e6e4
9f06429
0d6502d
79fdcbf
c24164e
3e5db5d
2479899
39e9ae4
d56d2e1
170fbba
a06a217
6b7b045
14eccc8
025fa0b
c387d7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
if [ -f .pre-commit-config.yaml ]; then | ||
echo 'pre-commit configuration detected, but `pre-commit install` was never run' 1>&2 | ||
exit 1 | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,8 @@ | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: tox | ||
name: tox | ||
stages: [push] | ||
language: system | ||
entry: tox | ||
types: [python] | ||
pass_filenames: false | ||
|
||
- id: tox_integ_tests | ||
name: tox integ tests | ||
stages: [push] | ||
language: system | ||
entry: tox -e integ-tests | ||
types: [python] | ||
pass_filenames: false | ||
- repo: local | ||
hooks: | ||
- id: tox_linters | ||
name: linters | ||
entry: tox -e linters_check | ||
language: system | ||
types: [python] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,19 @@ commands = | |
{[testenv:black]commands} | ||
{[testenv:flake8]commands} | ||
|
||
# Read only linter env | ||
[testenv:linters_check] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not also run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call! I missed this as an option. I am also planning on using this test env here in our workflows: https://github.com/aws/amazon-braket-sdk-python/blob/main/.github/workflows/check-format.yml#L29. I shall add this check in for both. |
||
basepython = python3 | ||
skip_install = true | ||
deps = | ||
{[testenv:isort_check]deps} | ||
{[testenv:black_check]deps} | ||
{[testenv:flake8]deps} | ||
commands = | ||
{[testenv:isort_check]commands} | ||
{[testenv:black_check]commands} | ||
{[testenv:flake8]commands} | ||
|
||
[testenv:flake8] | ||
basepython = python3 | ||
skip_install = true | ||
|
@@ -60,6 +73,14 @@ deps = | |
commands = | ||
isort . {posargs} | ||
|
||
[testenv:isort_check] | ||
basepython = python3 | ||
skip_install = true | ||
deps = | ||
isort | ||
commands = | ||
isort . -c {posargs} | ||
|
||
[testenv:black] | ||
basepython = python3 | ||
skip_install = true | ||
|
@@ -68,6 +89,14 @@ deps = | |
commands = | ||
black ./ {posargs} | ||
|
||
[testenv:black_check] | ||
basepython = python3 | ||
skip_install = true | ||
deps = | ||
black | ||
commands = | ||
black --check . {posargs} | ||
|
||
[testenv:docs] | ||
basepython = python3 | ||
deps = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove these? We want the tests to pass before committing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I debated keeping the unit-tests run but I am hesitant around keeping the integ-tests. As these require an AWS account, I am not sure we should expect these to be ran by all contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing integ tests makes sense, but I think unit tests are still good to have.