-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add GitHub reporter #9484
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 GitHub reporter #9484
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9484 +/- ##
=======================================
Coverage 95.82% 95.83%
=======================================
Files 173 173
Lines 18797 18808 +11
=======================================
+ Hits 18012 18024 +12
+ Misses 785 784 -1
|
2dc629d to
597c9ea
Compare
This comment has been minimized.
This comment has been minimized.
Pierre-Sassoulas
left a comment
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.
That's pretty clean. Let's also use it for ourselves :D (before fixing the 'typo' so it's easy to test ?)
597c9ea to
d55d44c
Compare
This comment has been minimized.
This comment has been minimized.
88a4049 to
17204fc
Compare
This comment has been minimized.
This comment has been minimized.
17204fc to
1229f7a
Compare
|
I have this dummy PR which I am constantly updating with the HEAD of this PR. It shows both error, warning and notice annotations being generated by pylint's output: https://github.com/zoftko/balba/pull/2/files |
This comment has been minimized.
This comment has been minimized.
A new `github` reporter has been added. This reporter automatically annotates code on GitHub's UI with the messages found during linting. Closes pylint-dev#9443.
9738918 to
a0502b0
Compare
This comment has been minimized.
This comment has been minimized.
DanielNoord
left a comment
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.
This looks almost done already! Thanks very much!
.pre-commit-config.yaml
Outdated
| types: [python] | ||
| args: ["-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I"] | ||
| args: | ||
| ["-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I", "--output-format=github"] |
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 this doesn't do much right? As pre-commit isn't uploaded to Github.
Instead we should use this in our workflows defined in .github
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.
Yes you are right, it is only needed for the manual stage hook which is run in the checks.yml workflow.
doc/whatsnew/fragments/9443.feature
Outdated
| A new `github` reporter has been added. This reporter automatically annotates code on GitHub's user interface | ||
| with the messages found during linting. Use it with `pylint --output-format=github`. |
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.
| A new `github` reporter has been added. This reporter automatically annotates code on GitHub's user interface | |
| with the messages found during linting. Use it with `pylint --output-format=github`. | |
| A new `github` reporter has been added. This reporter returns the output of `pylint` in the format that | |
| Github can use to automatically annotate code. Use it with `pylint --output-format=github`. |
Users will still need to run the linter in the right workflow so it is not fully automatic.
| TextReporter(StringIO()), | ||
| ColorizedTextReporter(StringIO()), | ||
| JSON2Reporter(StringIO()), | ||
| GithubReporter(StringIO()), |
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.
Ideally we would also test the output of this reporter, but I would be fine with not doing so for now as it is such a nice to have feature.
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.
Yes, I was thinking about tests but since Github is the one that will annotate after all, seems like we just need to trust on Github 🤔
|
Changes look great, but I can't see the result either hère or on the PR you linked (maybe because I'm on mobile?). |
I checked on the app (mobile) and I can't see the annotations either so it seems like it is not supported. There are no annotations anymore in this PR, but the dummy one I linked still has them (just checked on a PC). |
Used message.C directly instead of slicing again, improved feature notes and removed unecessary output from locally run pre-commit pylint hook. It was kept for the manual stage since that is run on Github and needs it to annotate code on PRs.
|
It's a pity but not a blocker maybe github will evolve to show them on mobile later. (And jobs will show violations like before). I will be able to finish the review in one to three weeks, sorry for that. |
|
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 2c76860 |
DanielNoord
left a comment
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.
Thanks!!
@Pierre-Sassoulas Would you be okay with me merging this? I only need to apply the correct labels I think!
|
Sure @DanielNoord if you can see the result and think it looks good then please do. As I said the code itself and the design are great. Love the brevity @crazybolillo, great MR |
Type of Changes
Description
A new
githubreporter has been added. This reporter automatically annotates code on GitHub's UI with the messages found during linting.Closes #9443.