-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- When a new PR is submitted, autoformat code with autopep8 and remove commented out code - After reformatting, commit back to the pull request - When reformatted code has been committed, lint it with pycodestyle On github side we will - Require all changes to be submitted as PRs - Require all CI checks to pass before merging PRs This change partially-fixes #1 and fixes #10
- Loading branch information
1 parent
745e3ca
commit 1a0062f
Showing
3 changed files
with
59 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,8 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 |
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,47 @@ | ||
name: Lint & reformat | ||
|
||
on: | ||
pull_request: | ||
branches: ["master"] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
reformat: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
**/requirements*.txt | ||
- name: Install pip packages | ||
run: python3 -m pip install --upgrade autopep8 pycodestyle eradicate | ||
- name: Run autopep8 | ||
run: autopep8 --in-place -aa -r . | ||
- name: Remove commented out code | ||
run: eradicate --in-place ./**/*.py | ||
- name: Push back to repo | ||
uses: actions-go/push@v1 | ||
with: | ||
author-email: github-actions[bot]@users.noreply.github.com | ||
author-name: Reformat action | ||
create-commit: true | ||
commit-message: "Reformatted code and removed commented-out code" | ||
lint: | ||
runs-on: ubuntu-latest | ||
needs: reformat | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
**/requirements*.txt | ||
- name: Install pip packages | ||
run: python3 -m pip install --upgrade pycodestyle | ||
- name: Run pycodestyle | ||
run: pycodestyle --show-source --show-pep8 ./**/*.py |
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,4 @@ | ||
[pycodestyle] | ||
max-line-length = 120 | ||
statistics = True | ||
|