diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9141329 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..796d099 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,48 @@ +name: Lint & reformat + +on: + pull_request: + branches: ["master"] + + workflow_dispatch: + +jobs: + reformat: + runs-on: ubuntu-latest + outputs: + reformatting-required: ${{ steps.push-back-to-repo.outputs.modified }} + steps: + - uses: actions/checkout@v3 + with: + token : ${{ secrets.PAT }} + - 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 + id: push-back-to-repo + uses: anyone-developer/anyone-push-back-repo@1.1.2 + lint: + runs-on: ubuntu-latest + needs: reformat + if: needs.reformat.reformatting-required == 0 + 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 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..a6958b8 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[pycodestyle] +max-line-length = 120 +statistics = True + diff --git a/test/requirements.txt b/test/requirements.txt new file mode 100644 index 0000000..e69de29