diff --git a/.github/workflows/flake8-linter-matcher.json b/.github/workflows/flake8-linter-matcher.json new file mode 100644 index 0000000000..58c5dabcab --- /dev/null +++ b/.github/workflows/flake8-linter-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "flake8-linter-error", + "severity": "error", + "pattern": [ + { + "regexp": "^([^:]+):(\\d+):(\\d+):\\s+([EWCNF]\\d+\\s+.+)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + } + ] +} diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 0000000000..eabdbdbf38 --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,27 @@ +name: Python Flake8 Linter +on: + pull_request: +jobs: + flake8-linter: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Install Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install Flake8 5.0.4 linter + run: pip install flake8==5.0.4 # use this version for --diff option + - name: Setup Flake8 output matcher for PR annotations + run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json' + - name: Fetch pull request target branch + run: | + git remote add upstream https://github.com/pvlib/pvlib-python.git + git fetch upstream $GITHUB_BASE_REF + - name: Run Flake8 linter + run: git diff upstream/$GITHUB_BASE_REF HEAD | flake8 + --exclude pvlib/version.py + --ignore E201,E241,E226,W503,W504 + --max-line-length 79 + --diff diff --git a/docs/sphinx/source/whatsnew/v0.10.2.rst b/docs/sphinx/source/whatsnew/v0.10.2.rst index 93dc230d15..51adbdb5e2 100644 --- a/docs/sphinx/source/whatsnew/v0.10.2.rst +++ b/docs/sphinx/source/whatsnew/v0.10.2.rst @@ -23,7 +23,8 @@ Bug fixes Testing ~~~~~~~ - +* Added GitHub action to lint file changes with Flake8, replacing Stickler-CI. + (:issue:`776`, :issue:`1722`, :pull:`1786`) Documentation ~~~~~~~~~~~~~ @@ -37,3 +38,4 @@ Requirements Contributors ~~~~~~~~~~~~ * Adam R. Jensen (:ghuser:`AdamRJensen`) +* Taos Transue (:ghuser:`reepoi`)