Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Flake8 linter workflow to replace stickler-ci #1786

Merged
merged 30 commits into from Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f23d95b
adding flake8 linter workflow
reepoi Jun 26, 2023
251a6d9
lint only changed files
reepoi Jun 26, 2023
ebf4868
move changed files to env variable
reepoi Jun 26, 2023
93fccc5
remove filename flag
reepoi Jun 26, 2023
c58095f
remove trailing dot
reepoi Jun 26, 2023
232f505
rename job
reepoi Jun 26, 2023
e064e2c
pass filenames as positional arguments
reepoi Jun 26, 2023
cbc1232
pipe filenames to xargs
reepoi Jun 26, 2023
3513b52
change to check pvlib repo
reepoi Jun 26, 2023
0023272
only lint python files
reepoi Jun 26, 2023
5d9d48e
missing parenthesis
reepoi Jun 26, 2023
8c6c36a
skip linting if no Python files edited
reepoi Jun 26, 2023
db298fb
try env instead of output
reepoi Jun 26, 2023
bed3304
reformatting
reepoi Jun 26, 2023
31cbb3b
create lint issues to try out the new linter
kandersolar Jul 6, 2023
980704b
Revert "create lint issues to try out the new linter"
kandersolar Jul 6, 2023
23700fd
create a lint issue in a file with other lint issues
kandersolar Jul 6, 2023
990d90e
Merge branch 'main' of github.com:pvlib/pvlib-python into stickler-sub
reepoi Jul 12, 2023
b90dfdf
use flake8 --diff with flake8 5.0.4
reepoi Jul 12, 2023
8199b8e
Merge branch 'stickler-sub' of github.com:reepoi/pvlib-python into st…
reepoi Jul 12, 2023
79f7e35
call to git fetch
reepoi Jul 12, 2023
0ada7c4
use GITHUB_TOKEN for fetching
reepoi Jul 12, 2023
dd00e8a
set repository read permission
reepoi Jul 12, 2023
5920174
try using https link to repo instead of ssh
reepoi Jul 12, 2023
fdc65d2
test if GITHUB_TOKEN permissions are not needed
reepoi Jul 12, 2023
043e507
add temporary example of linting annotations
reepoi Jul 12, 2023
1dfbe61
breaking workflow command into more steps
reepoi Jul 19, 2023
302bf35
use base ref variable instead of hard-coding main branch
reepoi Jul 20, 2023
7b6fda9
Merge branch 'main' of github.com:pvlib/pvlib-python into stickler-sub
reepoi Jul 25, 2023
c987ee7
update whatsnew and remove lint error example
reepoi Jul 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .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
}
]
}
]
}
27 changes: 27 additions & 0 deletions .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 pvlib main branch
run: |
git remote add upstream https://github.com/pvlib/pvlib-python.git
git fetch upstream main
- name: Run Flake8 linter
run: git diff upstream/main HEAD | flake8
kandersolar marked this conversation as resolved.
Show resolved Hide resolved
--exclude pvlib/version.py
--ignore E201,E241,E226,W503,W504
--max-line-length 79
--diff
1 change: 1 addition & 0 deletions pvlib/singlediode.py
Expand Up @@ -155,6 +155,7 @@
2010
:doi:`10.4229/25thEUPVSEC2010-4BV.1.114`
"""
I = 10

Check failure on line 158 in pvlib/singlediode.py

View workflow job for this annotation

GitHub Actions / flake8-linter

F841 local variable 'I' is assigned to but never used

Check failure on line 158 in pvlib/singlediode.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E741 ambiguous variable name 'I'
# calculate recombination loss current where d2mutau > 0
is_recomb = d2mutau > 0 # True where there is thin-film recombination loss
v_recomb = np.where(is_recomb, NsVbi - diode_voltage, np.inf)
Expand Down