-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add formatting tools Signed-off-by: Martin Hickey <[email protected]> * Update after review Review comment: #31 (review) Signed-off-by: Martin Hickey <[email protected]> --------- Signed-off-by: Martin Hickey <[email protected]>
- Loading branch information
Showing
6 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
*.egg-info | ||
*.pyc | ||
__pycache__ | ||
.coverage | ||
.coverage.* | ||
durations/* | ||
coverage*.xml | ||
dist | ||
htmlcov | ||
build | ||
test | ||
|
||
# IDEs | ||
.vscode/ | ||
.idea/ | ||
|
||
# Env files | ||
.env | ||
|
||
# Virtual Env | ||
venv/ | ||
.venv/ | ||
|
||
# Mac personalization files | ||
*.DS_Store | ||
|
||
# Tox envs | ||
.tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[settings] | ||
profile=black | ||
from_first=true | ||
import_heading_future=Future | ||
import_heading_stdlib=Standard | ||
import_heading_thirdparty=Third Party | ||
import_heading_firstparty=First Party | ||
import_heading_localfolder=Local | ||
known_firstparty= | ||
known_localfolder=tuning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
exclude: imports | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.11.5 | ||
hooks: | ||
- id: isort | ||
exclude: imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
pre-commit run --all-files | ||
RETURN_CODE=$? | ||
|
||
function echoWarning() { | ||
LIGHT_YELLOW='\033[1;33m' | ||
NC='\033[0m' # No Color | ||
echo -e "${LIGHT_YELLOW}${1}${NC}" | ||
} | ||
|
||
if [ "$RETURN_CODE" -ne 0 ]; then | ||
if [ "${CI}" != "true" ]; then | ||
echoWarning "☝️ This appears to have failed, but actually your files have been formatted." | ||
echoWarning "Make a new commit with these changes before making a pull request." | ||
else | ||
echoWarning "This test failed because your code isn't formatted correctly." | ||
echoWarning 'Locally, run `make run fmt`, it will appear to fail, but change files.' | ||
echoWarning "Add the changed files to your commit and this stage will pass." | ||
fi | ||
|
||
exit $RETURN_CODE | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pre-commit>=3.0.4,<4.0 | ||
pydeps>=1.12.12,<2 | ||
tox>=4.4.2,<5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[tox] | ||
envlist = fmt | ||
|
||
[testenv:fmt] | ||
description = format with pre-commit | ||
commands = ./scripts/fmt.sh | ||
allowlist_externals = ./scripts/fmt.sh |