Skip to content

Commit

Permalink
Enable checking for python norms and fix violating code (#1168)
Browse files Browse the repository at this point in the history
This PR:
- enables checking coding norms on python scripts using `pycodestyle` via github actions
- adds the rules of the norms in `.pycodestyle`
- fixes python scripts that violate the norms using `autopep8`.


If a python script is failing during norm check, it can be fixed with the following command:
```
$> autopep8 -i --max-line-length 160 --ignore E402,W504 /path/to/offending_script.py
```
  • Loading branch information
aerorahul authored Dec 12, 2022
1 parent 6274c27 commit dda2edb
Show file tree
Hide file tree
Showing 21 changed files with 582 additions and 501 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pynorms.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Norms
on: [push, pull_request]

jobs:
check_norms:
runs-on: ubuntu-latest
name: Check Python coding norms with pycodestyle

steps:

- name: Install dependencies
run: |
pip install --upgrade pip
pip install pycodestyle
- name: Checkout
uses: actions/checkout@v3
with:
path: global-workflow

- name: Run pycodestyle
run: |
cd $GITHUB_WORKSPACE/global-workflow
pycodestyle -v --config ./.pycodestyle .
6 changes: 6 additions & 0 deletions .pycodestyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[pycodestyle]
count = False
ignore = E402,W504
max-line-length = 160
statistics = True
exclude = Experimental
Loading

0 comments on commit dda2edb

Please sign in to comment.