-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Lintcheck: Rework and limit diff output for GH's CI #13139
Lintcheck: Rework and limit diff output for GH's CI #13139
Conversation
1bd2b79
to
83a0f4a
Compare
Could you upload the entire file as an artifact, like in the |
I assume you mean the file markdown diff output? Yeah, I can do that, should be easy. It just means that the truncation has to be controlled by a CLI flag, but that's easy enough |
83a0f4a
to
b67908a
Compare
b67908a
to
1f879fc
Compare
My repo is currently running these changes with an additional dummy commit that generates a lot of warnings. Here is the link: https://github.com/xFrednet/rust-clippy/actions/runs/10044508861 |
2f9cfa9
to
23b231a
Compare
Example output with these changes: https://github.com/xFrednet/rust-clippy/actions/runs/10044508861 |
lintcheck/src/json.rs
Outdated
// The additional anchor is added for non GH viewers that don't prefix ID's | ||
println!(r#"## `{name}` <a id="user-content-{html_id}"/>"#); |
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.
No longer additional by the looks of it
Doesn't actually change the DOM since it gets auto closed by the </h2>
but a
isn't a void element so this should be <a></a>
, same for below
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.
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.
Yeah it should result in the same DOM since HTML self closes elements - <h2><a /></h2>
is the same as <h2><a></h2>
because HTML treats />
and >
identically
The open a
tag is then auto closed when it hits the </h2>
so it becomes <h2><a></a></h2>
- but this seems like the kind of area where differing behaviour in markdown previewers would crop up
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.
Makes sense, it's updated now :D
lintcheck/src/json.rs
Outdated
for change in itertools::merge_join_by(old_warnings, new_warnings, |old, new| old.key().cmp(&new.key())) { | ||
match change { | ||
EitherOrBoth::Both(old, new) => { | ||
if old.rendered != new.rendered { | ||
changed.push((old, new)); | ||
} | ||
}, | ||
EitherOrBoth::Left(old) => removed.push(old), | ||
EitherOrBoth::Right(new) => added.push(new), | ||
} | ||
} | ||
|
||
let lint_warnings = group_by_lint(added, removed, changed); |
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.
If we put the lint name first in the key
function we could create lint_warnings
directly via something like
for (name, chunk) in &merge_join_by(...).chunk_by(...) {}
// or however it needs to work for `ChunkBy`'s lifetime
rather than resorting/grouping it
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 like the idea. I currently can't figure out how to get chunk_by
working on MergeBy
. You suggestion produces the following error:
error[E0599]: no method named `chunk_by` found for struct `MergeBy` in the current scope
--> src/json.rs:69:120
|
69 | for (_name, change) in &itertools::merge_join_by(old_warnings, new_warnings, |old, new| old.key().cmp(&new.key())).chunk_by(|change| change.into_left().lint.as_str()) {
| ^^^^^^^^
|
help: there is a method `chunks` with a similar name
|
69 | for (_name, change) in &itertools::merge_join_by(old_warnings, new_warnings, |old, new| old.key().cmp(&new.key())).chunks(|change| change.into_left().lint.as_str()) {
|
Do you know how to solve it? I could collect it first into a vec, but then it seems better to manually chunk them.
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 it was renamed in itertools 0.13 and we're on 0.12
f29ea77
to
bdf3e58
Compare
Nice, thanks! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Background
While working on #13136 I found an amazing limitation of GH's CI. The summary can at most have be 1MB of text. Here is the warning message:
The PR produced a casual 61808 changes. Guess that's why those lints are not warn-by-default :P.
Changes:
This PR limits the lintcheck diff output in two ways.
>> $GITHUB_STEP_SUMMARY
. The entire file is also written to the normal CI log. This helps for cases where several lints change and the total size exceeds the 1MB limit.An example of these changes can be seen here: https://github.com/xFrednet/rust-clippy/actions/runs/10028799118?pr=4
changelog: none
r? @Alexendoo
Sorry for bombarding you with so many PR's lately 😅 Feel free to pass some of you reviews to me.