-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat+ci+lint: add incremental linting
* add `inv lint` command to tasks.py * add `lint` workflow to .github/workflows/lint.yaml * update README.md with linting instructions
- Loading branch information
Showing
7 changed files
with
128 additions
and
24 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
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,29 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
cache: "pip" | ||
cache-dependency-path: "requirements.lint.txt" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.lint.txt | ||
- name: Commit Range | ||
id: commit-range | ||
uses: akaihola/darker/.github/actions/[email protected] | ||
- name: Run lint | ||
run: | | ||
inv lint --revision=${{ steps.commit-range.outputs.commit-range }} |
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 |
---|---|---|
|
@@ -43,3 +43,5 @@ __pycache__/ | |
rsconnect/ | ||
|
||
*.Rproj | ||
venv | ||
env |
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
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 |
---|---|---|
@@ -1,26 +1,37 @@ | ||
[tool.black] | ||
line-length = 100 | ||
line-length = 120 | ||
target-version = ['py38'] | ||
include = 'server,tests/server' | ||
|
||
[tool.darker] | ||
revision = 'origin/dev...' | ||
color = true | ||
isort = true | ||
|
||
[tool.isort] | ||
profile = "black" | ||
known_third_party = ["pytest"] | ||
|
||
[tool.pylint] | ||
[tool.pylint.'MESSAGES CONTROL'] | ||
max-line-length = 100 | ||
disable = [ | ||
'logging-format-interpolation', | ||
# Allow pytest functions to be part of a class | ||
'no-self-use', | ||
'too-many-locals', | ||
'too-many-arguments', | ||
# Allow pytest classes to have one test | ||
'too-few-public-methods', | ||
] | ||
[tool.pylint.main] | ||
max-line-length = 120 | ||
disable = [ | ||
'logging-format-interpolation', | ||
# Allow pytest functions to be part of a class | ||
'no-self-use', | ||
'too-many-locals', | ||
'too-many-arguments', | ||
'too-many-branches', | ||
'too-many-statements', | ||
# Allow pytest classes to have one test | ||
'too-few-public-methods', | ||
] | ||
enable = 'useless-suppression' | ||
|
||
[tool.pylint.'BASIC'] | ||
# Allow arbitrarily short-named variables. | ||
variable-rgx = ['[a-z_][a-z0-9_]*'] | ||
argument-rgx = [ '[a-z_][a-z0-9_]*' ] | ||
attr-rgx = ['[a-z_][a-z0-9_]*'] | ||
[tool.pylint.basic] | ||
# Allow arbitrarily short-named variables. | ||
variable-rgx = '[A-Za-z_][a-z0-9_]*' | ||
argument-rgx = '[A-Za-z_][a-z0-9_]*' | ||
attr-rgx = '[A-Za-z_][a-z0-9_]*' | ||
|
||
[tool.pylint.'DESIGN'] | ||
ignored-argument-names = ['(_.*|run_as_module)'] | ||
[tool.pylint.design] | ||
ignored-argument-names = ['(_.*|run_as_module)'] |
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 @@ | ||
# Keep versions in sync with cmu-delphi/covidcast-indicators | ||
darker[flynt]~=1.7.2 | ||
invoke>=1.4.1 | ||
isort==5.12.0 | ||
lint_diffs==0.1.22 | ||
pylint==2.8.3 | ||
requests |
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