Skip to content

Commit dee0c62

Browse files
authored
2 parents 4127486 + fb59ec3 commit dee0c62

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,26 @@ In your `.github/workflows/main.yml`, set environment variable `PYLINT_THRESHOLD
1717
uses: cfedermann/python-code-validator@master
1818
env:
1919
PYLINT_THRESHOLD: 8
20+
BLACK_LINE_MAXLEN: 100
2021

2122
You can drop the `env:` section in your `main.yml` file if you want to use the default value `9`.
23+
24+
Set `BLACK_LINE_MAXLEN` to the desired max line length.
25+
26+
In your local repo, it may be useful to add a `validation.sh` script to allow local testing before the GitHub action is run on the server. The following is an example used in a GitHub codespace (where `./venv/` stores the virtual environment):
27+
28+
#!/bin/sh -e
29+
30+
pip install black mypy pylint-fail-under reorder-python-imports safety
31+
pip install -r requirements.txt
32+
33+
export PYLINT_THRESHOLD=8
34+
export BLACK_LINE_MAXLEN=100
35+
36+
black -S -l $BLACK_LINE_MAXLEN --check .
37+
find . -name "*.py" -not -path "./.venv/*" | xargs mypy
38+
find . -name "*.py" -not -path "./.venv/*" | xargs pylint-fail-under --fail_under $PYLINT_THRESHOLD
39+
find . -name "*.py" -not -path "./.venv/*" | xargs reorder-python-imports --diff-only
40+
cat requirements.txt | safety check --stdin
41+
42+
Note that this should match `entrypoint.sh` but you are free to ignore local folders (such as `./.venv/`) if they exist in your dev environment.

0 commit comments

Comments
 (0)