Commit graph

48 commits

Author SHA1 Message Date
bors
eecff6d07b Auto merge of #12439 - Jacherr:issue-12185, r=blyxyas
fix ice reporting in lintcheck

Fixes https://github.com/rust-lang/rust-clippy/issues/12185

This PR fixes the lack of reported ICEs within lintcheck by modifying the way in which data is collected from each crate being linted.

Instead of lintcheck only reading `stdout` for warnings, it now also reads `stderr` for any potential ICE (although admittedly, it is not the cleanest method of doing so). If it is detected, it parses the ICE into its message and backtrace separately, and then adds them to the list of outputs via clippy.

Once all outputs are collected, the formatter then proceeds to generate the file as normal.

Note that this PR also has a couple of side effects:
- When clippy fails to process a package, but said failure is not an ICE, the `stderr` will be sent to the console;
- Instead of `ClippyWarning` being the primary struct for everything reported, there is now `ClippyCheckOutput`, an enum which splits the outputs into warnings and ICEs.

changelog: none
2024-04-05 18:16:07 +00:00
Jacherr
42d09703b4 Add support for ICE reporting in lintcheck 2024-04-05 20:14:38 +02:00
Alex Macleod
a24d12b7aa Enable unused_qualifications lint 2024-03-22 15:58:29 +00:00
Guillaume Gomez
5e2707d343 Fix new lint warnings 2024-02-24 15:02:10 +01:00
Jubilee Young
9083b52122 Check $CARGO before $PATH 2023-12-09 14:08:03 -08:00
y21
3e83a521e4 replace Vec with slice in lintcheck 2023-11-15 15:17:38 +01:00
y21
d6fc606259 [map_identity]: recognize tuples 2023-10-21 15:40:34 +02:00
Alex Macleod
2811effe34 Add imports_granularity = "Module" to rustfmt.toml 2023-07-13 12:44:57 +00:00
Jason Newcomb
949712c90a Reborrow mutable references in explicit_iter_loop 2023-06-09 21:40:03 -04:00
Josh Soref
d2061faf9e Spelling
* applying
* binding
* complex
* constituent
* demonstrate
* desugaring
* exact
* expression
* for
* functionalities
* github
* implementation
* infers
* multiple conflicting traits
* mutable
* necessarily
* nightly
* nonexistent
* optional
* parameter
* reassignments
* resources
* substitution
* suggestion
* that
* that array is
* using the

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-23 10:52:27 -04:00
bors
a45f71265c Auto merge of #10458 - samueltardieu:multithreading-lintcheck, r=llogiq
lintcheck: use multithreading unless --fix or --recursive is used

Use multithreading unless there is a reason not to.

changelog: none
2023-03-09 17:01:20 +00:00
Samuel Tardieu
a701af45cb lintcheck: use multithreading unless --fix or --recursive is used 2023-03-08 22:29:57 +01:00
Samuel "Sam" Tardieu
ce3415e87b Add the popular-crates binary
This program downloads crates info from https://crates.io/ and builds
a TOML file that can be fed to `lintcheck`.
2023-03-08 09:43:28 +01:00
Samuel Tardieu
79829d8718 lintcheck: use clap's derive interface
This makes the code shorter and clearer.

The only incompatible change is that an explicit command-line argument
`--crates-toml=` will take precedence over the `LINTCHECK_TOML`
environment variable.
2023-03-04 23:17:27 +01:00
Samuel Tardieu
446ae429a6 lintcheck: fix parallel processing handling
Using `rayon::current_num_threads()` causes a bug:

```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
  ThreadPoolBuildError { kind: GlobalPoolAlreadyInitialized }',
  src/main.rs:632:10
```

Moreover, using the number of threads and dividing it by 2 wouldn't
return the number of physical threads on modern processors which have
a varying number of threads per core.

It makes little sense to restrict ourselves to physical threads,
especially when, in modern architectures, cores with multiple threads
are often faster (performance) while cores with a unique threads are
often slower (efficient). The Rust runtime will make a better choice.
2023-03-04 17:29:58 +01:00
Jirka Vebr
0b1ae20365
Fix dogfood tests by adding type annotations 2023-02-16 13:29:38 +01:00
Samuel Tardieu
aeaa1cc342 lintcheck: fix clap panic 2023-02-12 14:54:14 +01:00
kraktus
2fd10bc59b dogfood with expanded uninlined_format_args 2022-11-25 16:49:05 +01:00
Alex Macleod
bd8369089c Track clippy.toml and Cargo.toml in file_depinfo
Causes cargo to re-run clippy when those paths are modified

Also tracks the path to `clippy-driver` in debug mode to remove the
workarounds in `cargo dev lint` and `lintcheck`
2022-10-25 11:32:49 +00:00
Alex Macleod
ff893366c1 Mark let_underscore_drop as uplifted 2022-10-23 14:06:51 +00:00
Samuel Moelius
bbee1c9d1f Apply manual fixes 2022-10-22 07:42:41 -04:00
Samuel Moelius
e38bb1a963 Apply --fix fixes 2022-10-22 07:42:35 -04:00
Samuel Moelius
9cc8da222b Fix adjacent code 2022-10-07 05:07:44 -04:00
Alex Macleod
fc77d91469 Add cargo lintcheck --recursive to check dependencies of crates 2022-09-24 12:01:08 +00:00
alex-semenyuk
9015884325 Fix small mistakes 2022-07-09 13:00:24 +03:00
Jason Newcomb
cccc750046 Fix clap deprecation warnings 2022-06-13 21:57:17 -04:00
Marcel Hellwig
9b55ea78c8 update dependencies 2022-05-23 09:28:49 +02:00
Alex Macleod
8708a261a1 Some lintcheck cleanup 2022-05-12 13:46:58 +01:00
Matthias Krüger
5b35bd9c3e lintcheck: fix --fix
looks like --allow-no-vcs does no longer exist(?)
2022-04-16 00:56:28 +02:00
whodi
73b7cb9c49 shound -> should 2022-04-15 14:19:01 -07:00
Peter Jaszkowiak
67badbeef6 New lint format_add_strings 2022-04-13 22:48:36 -06:00
Alex Macleod
94fe6719de Allow running lintcheck with a renamed rust-clippy dir 2022-01-06 13:06:24 +00:00
xFrednet
d6fca4657d
Update lintcheck output to use tables and add markdown support 2021-12-09 20:38:43 +01:00
xFrednet
e42f79c0a3
Add filter option to lintcheck 2021-12-09 18:11:46 +01:00
xFrednet
460bef22a3
Remove and ignore lintcheck's log file 2021-12-08 20:12:50 +01:00
togami2864
b5a61aa901 fix typo 2021-11-18 17:37:00 +09:00
Jason Newcomb
41fe5461f4
Retry on some download errors in lintcheck 2021-09-20 12:50:59 -04:00
Lucas Kent
997ddbbfd8 Lintcheck always copies in a fresh crate when provided with a crate path
but skips directories containing CACHEDIR.TAG e.g. the target/ dir
2021-08-16 10:18:24 +10:00
Joshua Nelson
aa40487a84 Stabilize cargo clippy --fix
This has been unstable since it was first introduced in
https://github.com/rust-lang/rust-clippy/pull/5363. In that time, I have
been using it successfully in nightly without issues. I don't think
there are any blocking issues now that RUSTC_WORKSPACE_WRAPPER is
stabilized, so this can be stabilized.
2021-06-28 21:46:57 -04:00
Jason Newcomb
6c423757dd
Fix lintcheck on windows 2021-04-22 13:16:54 -04:00
Cameron Steffen
a45faf66f3 Deprecate filter_map 2021-04-10 16:59:59 -05:00
Matthias Krüger
225f7e0617 lintcheck: warn if checking a program results in bad exit status 2021-03-31 14:36:56 +02:00
Matthias Krüger
528e464b4f lintcheck: fix clippy warnings 2021-03-11 15:28:27 +01:00
Matthias Krüger
b068b742ee lintcheck: fix --fix and document it in the readme.
also hook lintcheck into clippy-dev so that `clippy dev fmt` formats it.
2021-03-11 15:27:30 +01:00
Matthias Krüger
3e60ba073b lintcheck: fix bug where lint messages about macros coming from crate deps would sneak in absolute paths to registry sources.
make the path a relative path that starts at the CARGO_HOME to not print the users home location in the log
2021-03-11 15:27:30 +01:00
Matthias Krüger
fac6da1cfb move testfiles to "lintcheck" and fix more paths 2021-03-11 15:27:26 +01:00
Matthias Krüger
a846945b82 lintcheck: make sure we lauch from the repo root
This will terminate the program if run via "cargo run".
"cargo run" does currently not work because at least a bunch of paths do not take that into account.
2021-03-11 13:26:26 +01:00
Matthias Krüger
2546e6f006 lintcheck: move out of clippy-dev into own crate 2021-03-11 13:26:26 +01:00