-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add lint output to lint list #8947
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
Conversation
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.
The implementation looks good to me, a few smaller nits, but everything should be simple to fix.
With this change, I would like to ensure that the metadata collection works during the bors check and not on master when the deploy script is run. @flip1995 Would it be possible to run deploy.sh
with bors and also push it to the gh-pages (if it's not @
bors try). And would we want to have that?
if line.eq_ignore_ascii_case("Use instead:") || line.eq_ignore_ascii_case("Could be written as:") { | ||
break 'outer; | ||
} |
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 means that a lint description like:
/// ```rs
/// <bad-example 1>
/// ```
///
/// Use instead:
/// ```rs
/// <good-example 1>
/// ```
///
/// ### Example 2
///
/// ```rs
/// <bad-example 2>
/// ```
///
/// Use instead:
/// ```rs
/// <good-example 2>
/// ```
would only lint the first example correct? I don't know of any lint that has such a documentation, but this would be good to know.
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.
Yep, this is just an attempt to do as little work as possible. Normally when lints have multiple examples they use "or" anyway, so it shouldn't be an issue.
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.
Okay, I'm debating if this actually has a huge impact on the runtime. 🤔
I also want to see how what effect this PR has on the runtime. But I doubt that we can really do any optimization here, since we need to compile every snippet separately. Therefore, it should be 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.
Here are a few timings:
Before the PR
Executed in 8.75 secs fish external usr time 15.40 secs 310.00 micros 15.40 secs sys time 0.62 secs 185.00 micros 0.62 secs
After the PR (no generated output)
Executed in 9.44 secs fish external usr time 16.87 secs 551.00 micros 16.87 secs sys time 0.62 secs 0.00 micros 0.62 secs
Generating the output of 5 lints
Executed in 30.93 secs fish external usr time 59.21 secs 0.00 micros 59.21 secs sys time 3.75 secs 554.00 micros 3.75 secs
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 quite a step up from the original run time, and just for 5 lints. Have you looked into parallelizing this step somehow? Maybe we could start the linting processes and not wait for its output?
If it's not possible, I'm also fine with this, as it will only be run, during for merge commits.
Before we merge this, I want to try adding this to the bors workflow, to ensure that the metadata collection always succeeds. Currently, it's only run on master after the merge and can therefore fail without us noticing. I have a good idea how this can be done, and I'll create a PR on the weekend, unless you want to give it a try 🙃
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'll work on parallelization, I've made slight improvements but it could probably be much better.
Also, I'll just wait for your PR. Workflows aren't my forte 😄.
e5b69df
to
fdadebe
Compare
[WIP] Test metadata collection in Bors CI workflow This PR adds a new check to bors CI workflows, which ensures that the metadata collection success, when it's run as part of the `deploy` script. I've only added it to bors workflows, as the runtime will be high while it'll also succeed most of the time. This is a preparation for #8947. --- changelog: none r? `@ghost`
[WIP] Test metadata collection in Bors CI workflow This PR adds a new check to bors CI workflows, which ensures that the metadata collection success, when it's run as part of the `deploy` script. I've only added it to bors workflows, as the runtime will be high while it'll also succeed most of the time. This is a preparation for #8947. --- changelog: none r? `@ghost`
It would be possible, but we don't want to push from auto. If anything goes wrong in the bors CI and it already pushed to gh-pages, we have invalid docs until the next PR is merged successfully. |
Test metadata collection in Bors CI workflow This PR adds a new check to bors CI workflows, which ensures that the metadata collection success, when it's run as part of the `deploy` script. I've only added it to bors workflows, as the runtime will be high while it'll also succeed most of the time. This is a preparation for #8947. --- changelog: none r? `@ghost`
That's also what I thought. With #8988 we now test the metadata collection, which was the main goal with my comment. I'm also interested how much this PR effects the CI time. So, let's give it a go: @bors try |
Add lint output to lint list changelog: Add the ability to show the lint output in the lint list This just adds the logic to produce the output, it hasn't been added to any lints yet. It did help find some mistakes in some docs though 😄. ### Screenshots <details> <summary>A single code block</summary>  </details> <details> <summary>A single code block with a "Use instead" section</summary>  </details> <details> <summary>Multiple code blocks</summary>  </details> This is the last task in #7172 🎉. r? `@xFrednet` (?)
💔 Test failed - checks-action_dev_test |
It looks like this requires a rebase. I'll leave that to @Serial-ATA as this is not time critical and has a low chance of having conflicts since it's an internal lint. @rustbot author |
The CI was just fixed on master, let's try this again. @bors try |
Add lint output to lint list changelog: Add the ability to show the lint output in the lint list This just adds the logic to produce the output, it hasn't been added to any lints yet. It did help find some mistakes in some docs though 😄. ### Screenshots <details> <summary>A single code block</summary>  </details> <details> <summary>A single code block with a "Use instead" section</summary>  </details> <details> <summary>Multiple code blocks</summary>  </details> This is the last task in #7172 🎉. r? `@xFrednet` (?)
☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
After, the changes on master this looks good to me. The collection is also still plenty past. It now took 3 min in the CI with compilation. In the future, it might be nice to have an environment value to disable the output production. But this is not necessary right now. Thank you very much for the addition. I love the change! |
@bors r+ |
📌 Commit fdadebe has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Just noticed that this PR doesn't add any |
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.
Please remove the clippy_dev dependency when next working on this.
@@ -10,6 +10,7 @@ edition = "2021" | |||
|
|||
[dependencies] | |||
cargo_metadata = "0.14" | |||
clippy_dev = { path = "../clippy_dev", optional = true } |
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.
Just noticed during the sync: depending on clippy_dev
feels really wrong. clippy_dev isn't intended to be used as a library, but a standalone binary for clippy dev tools. Nothing should depend on clippy_dev
IMO.
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.
Ups yeah your right, slipped under my radar😅
@@ -188,6 +191,7 @@ impl MetadataCollector { | |||
lints: BinaryHeap::<LintMetadata>::default(), | |||
applicability_info: FxHashMap::<String, ApplicabilityInfo>::default(), | |||
config: collect_configs(), | |||
clippy_project_root: clippy_dev::clippy_project_root(), |
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 is the only place clippy_dev is used. I'm sure we can just hardcode this path.
changelog: Add the ability to show the lint output in the lint list
This just adds the logic to produce the output, it hasn't been added to any lints yet. It did help find some mistakes in some docs though 😄.
Screenshots
A single code block
A single code block with a "Use instead" section
Multiple code blocks
This is the last task in #7172 🎉.
r? @xFrednet (?)