-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add Pylint to Workflow #373
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## RC_v1.5.x #373 +/- ##
=============================================
+ Coverage 56.91% 59.80% +2.88%
=============================================
Files 20 20
Lines 3440 3769 +329
=============================================
+ Hits 1958 2254 +296
- Misses 1482 1515 +33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Linting results by Pylint:Your code has been rated at 8.72/10 (previous run: 8.72/10, +0.00) |
OK Theory confirmed. @fziegner you should have write access to this branch, so feel free to edit/etc. probably good for you to get a commit in there to make sure your contributions are in the record. |
Probably better for this action to pull the merging branch, rather than |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, my only specific comments are regarding how we install tobac
.github/workflows/pylint.yml
Outdated
pip install . | ||
pip install --upgrade pylint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use conda/mamba to create the environment, consistent with other actions, rather than pip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some trouble getting pylint to work with the conda environment but I'll take another look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah fair, if it causes more work then it's probably not worth changing it. Seems to work fine for me via conda locally as long as it isn't using python 3.12
Also good to check that we can install tobac with pip!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it's working now. I just forgot to specify the shell in which pylint is supposed to run.
.github/workflows/pylint.yml
Outdated
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.9' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need to use python 3.9? pylint doesn't seem to yet work with 3.12, but 3.11 works fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can change it to 3.11
Linting results by Pylint:Your code has been rated at 8.71/10 (previous run: 8.71/10, +0.00) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thanks for your help with this @freemansw1!
Linting results by Pylint:Your code has been rated at 8.72/10 (previous run: 8.72/10, +0.00) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @freemansw1 for looking into the permission issue. Should be good to go now.
.github/workflows/pylint.yml
Outdated
echo "SHA=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_OUTPUT | ||
id: git | ||
|
||
- name: Get RC branch name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be better to grab the merging PR branch name. Let me look into that and see if that's possible
Linting results by Pylint:Your code has been rated at 8.72/10 (previous run: 8.72/10, +0.00) |
Ok, I think that figures it out. @fziegner @fsenf @w-k-jones @JuliaKukulies let me know if you're still happy to merge. |
Is it possible to change the commenting action to make it update the origin comment (in the same manner as the coverage action) rather than post a new comment for each change? If it's not a quick change then we should go ahead and merge |
That's an excellent point; this could get really annoying on frequently updated PRs |
I'm going to suggest that this is a blocking issue given the (high) potential for several comments given the way we use PRs. Given the (potential) complexity there, I'm inclined to push this PR back to 1.5.3 (or between releases, as we have done before for repo enhancements). @fsenf @fziegner thoughts? Other than #376 (which is done in my eyes) this is the last thing to resolve before release. |
Amazing, proven wrong within a minute of commenting. Well done, @fziegner! |
Wow, that was incredible timing. The first comment by the linter in this PR should be edited now. |
Very nice work @fziegner , the first linter comment is showing as being edited 1 minute ago for me |
I can't approve my own PR, so this is me approving post edits. @fziegner fantastic work. Are you happy for us to merge? |
Yes @freemansw1, go ahead. |
Annoyingly the |
Excellent work @fziegner!
So that would just mean that we update |
I've committed the change directly to the |
Perfect, thanks! |
This is testing a theory, and is entirely copied from #278 . Per the GitHub documentation (https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token), the Pylint runner will never work on Julia's fork (and in #278) as the maximum access for PRs from public forked repos is read. In theory, this, which copies over the changes from #278 to a branch within our repo, should work.