Skip to content

lintcheck: Add JSON output, diff subcommand #9764

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

Closed
wants to merge 1 commit into from

Conversation

Alexendoo
Copy link
Member

@Alexendoo Alexendoo commented Nov 1, 2022

This adds a JSON output to lintcheck, cargo lintcheck --json ... will create a JSON file that is the serialisation of the Vec<ClippyWarning> results

cargo lintcheck diff a.json b.json can then be used to show the difference between two runs

Moves the path rewriting to --remap-path-prefix in order to have it reflected in the rendered diagnostics

changelog: none

@rust-highfive
Copy link

r? @giraffate

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 1, 2022
@Alexendoo
Copy link
Member Author

r? @matthiaskrgr (whoops, forgot to do that)

Here's an example output for the diff of running cargo lintcheck --recursive --json before/after #9743:

35 added, 0 removed, 136 changed

Added

warning: the following explicit lifetimes could be elided: 'a
   --> serde_derive-1.0.123/src/ser.rs:869:1
    |
869 | / fn serialize_struct_variant<'a>(
870 | |     context: StructVariant<'a>,
871 | |     params: &Parameters,
872 | |     fields: &[Field],
873 | |     name: &str,
874 | | ) -> Fragment {
    | |_____________^
    |
help: replace with `'_` in generic arguments such as here
   --> serde_derive-1.0.123/src/ser.rs:870:28
    |
870 |     context: StructVariant<'a>,
    |                            ^^
    = note: `#[warn(clippy::needless_lifetimes)]` implied by `#[warn(clippy::all)]`

warning: the following explicit lifetimes could be elided: 'a
   --> serde_derive-1.0.110/src/ser.rs:865:1
    |
865 | / fn serialize_struct_variant<'a>(
866 | |     context: StructVariant<'a>,
867 | |     params: &Parameters,
868 | |     fields: &[Field],
869 | |     name: &str,
870 | | ) -> Fragment {
    | |_____________^
    |
help: replace with `'_` in generic arguments such as here
   --> serde_derive-1.0.110/src/ser.rs:866:28
    |
866 |     context: StructVariant<'a>,
    |                            ^^
    = note: `#[warn(clippy::needless_lifetimes)]` implied by `#[warn(clippy::all)]`

[ trimmed ]

Changed

-warning: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
+warning: the following explicit lifetimes could be elided: 'a
   --> bstr-0.2.17/src/ext_slice.rs:70:1
    |
 70 | pub fn B<'a, B: ?Sized + AsRef<[u8]>>(bytes: &'a B) -> &'a [u8] {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
 
 
-warning: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
+warning: the following explicit lifetimes could be elided: 'r
     --> regex-1.4.3/src/re_bytes.rs:1168:5
      |
 1168 |     fn no_expansion<'r>(&'r mut self) -> Option<Cow<'r, [u8]>> {
      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+     |
+help: replace with `'_` in generic arguments such as here
+    --> regex-1.4.3/src/re_bytes.rs:1168:53
+     |
+1168 |     fn no_expansion<'r>(&'r mut self) -> Option<Cow<'r, [u8]>> {
+     |                                                     ^^
 
[ trimmed ]

@Alexendoo Alexendoo mentioned this pull request Nov 4, 2022
@bors
Copy link
Contributor

bors commented Nov 25, 2022

☔ The latest upstream changes (presumably #9945) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Feb 16, 2023

☔ The latest upstream changes (presumably #10356) made this pull request unmergeable. Please resolve the merge conflicts.

@Alexendoo
Copy link
Member Author

Superseded by #10398

@Alexendoo Alexendoo closed this Feb 24, 2023
bors added a commit that referenced this pull request Jun 16, 2024
Run a diff of lintcheck against the merge base for pull requests

changelog: none
<!-- changelog_checked -->

This is an MVP of sorts, it consists of #9764 + a GitHub action that feeds the output to the [job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary). It doesn't yet do anything fancy like `--recursive` or adding comments to the PR, so you'd have to click through to the action to see the results

Example output of a change (Alexendoo@0be1ab8): https://github.com/Alexendoo/rust-clippy/actions/runs/4264858870#summary-11583333018

r? `@flip1995`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants