Commit Graph

219 Commits

Author SHA1 Message Date
Jason Newcomb 12fce55766 Fix all occurences of needless_borrow internally 2021-04-06 10:43:47 -04:00
Matthias Krüger a62e4263d5 rename cargo dev ra_setup to cargo dev ide_setup 2021-03-17 10:12:45 +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 2546e6f006 lintcheck: move out of clippy-dev into own crate 2021-03-11 13:26:26 +01:00
Matthias Krüger 45424c7e75 lintcheck: add --fix mode which tries to apply lint suggestions to the sources and prints a warning if that fails
Great for spotting false positives/broken suggestions of applicable lints.

There are false positives though becasue I'm not sure yet how to silence rustc warnings while keeping clippy warnings.
Sometimes rustc makes a suggestion that fails to apply and the implementation does not differenciate between clippy and rustc warnings when applying lint suggestions.

changelog: none
2021-03-05 17:11:21 +01:00
flip1995 74eb44834c Extract directory creation into its own function 2021-03-05 14:06:43 +01:00
flip1995 4aaad086d2 Fix dogfood errors in clippy_dev 2021-03-05 13:36:55 +01:00
Matthias Krüger 37c4b11a84 lintcheck: add test 2021-03-04 22:33:35 +01:00
Matthias Krüger bbe641678c lintcheck: fix clippy warnings 2021-03-04 11:00:39 +01:00
Matthias Krüger 25f909863b update lintcheck_crates logs and fix typos 2021-02-28 23:07:12 +01:00
Matthias Krüger 1ebaae8a15 lintcheck: make download path and source path consts, move source directory from traget/lintcheck/crates to target/lintcheck/sources
also update logfile with the dtolnay crates
2021-02-28 23:07:09 +01:00
Matthias Krüger 70d952e751 lintcheck: more fixes
fix a couple of issues when checking if lintcheck needed rerun after clippy binary changed.
I was apparently still comparing the times wrongly, but it should be fixed™ now...
I actually looked at the date of the sources.toml and not at the date of the log file!

Also fix progress report counter not advancing in squential mode
2021-02-28 22:59:46 +01:00
Matthias Krüger 1b1ed9359e lintcheck: put the full paths (target/lintcheck/sources/<crate>...) to the source files of a warning into the lintcheck log
This is more convenient when reviewing new lint warnings that popped up in the logs
2021-02-28 22:59:45 +01:00
Matthias Krüger e3386041a2 lintcheck: uses consts for clippy driver and cargo clippy paths 2021-02-28 22:53:52 +01:00
Matthias Krüger 2d9932d720 lintcheck: don't run clippy in parallel by default 2021-02-28 22:53:52 +01:00
Matthias Krüger d931d1b5e6 lintcheck: refactor: introduce a basic LintcheckConfig struct which holds the job limit and paths to the sources and log files 2021-02-28 22:53:52 +01:00
Matthias Krüger 90cf27e9f6 lintcheck: update logs and do minor fixes 2021-02-26 11:18:59 +01:00
Matthias Krüger 3e1eea6c97 lintcheck: print stats how lint counts have changed between runs 2021-02-26 11:08:42 +01:00
Matthias Krüger 12dc03033f lintcheck: fix bug when getting the config toml path.
In order to check if we need to recheck crates, I was getting the path from clap only
which is None if we don't pass it via cmdline args.

Use the dedicated lintcheck_config_toml() fnuction instead!
2021-02-26 10:59:40 +01:00
Matthias Krüger eaae95b613 lintcheck fix build (forgot to pass function parameter) and runtime (don't check metadata of directory if it does not exist) 2021-02-23 12:58:12 +01:00
Matthias Krüger 363f6d3dc6 lintcheck: rerun if clippy changed
Automatically clean lintchecks shared target dir (will force clippy to recheck sources) if
the clippy binaries are older than the lintcheck logs.

Also update lintcheck logs
2021-02-23 08:32:50 +01:00
Yoshitomo Nakanishi 5fe3b6c41a Quick fix cargo dev bless 2021-02-22 12:45:11 +09:00
Matthias Krüger 8499a32859 lintcheck: add -j <N> option to configure threads.
defaults to 1
-j 0 choses the number of threads automtically (= number of physical cores)
2021-02-19 23:20:05 +01:00
Matthias Krüger 22aeec09e4 lintcheck: sort crates before linting 2021-02-19 22:16:53 +01:00
Matthias Krüger 4974734a24 lintcheck: show progress percentage in the "Linting..." message 2021-02-19 22:06:50 +01:00
Matthias Krüger d198551311 lintheck: show output (and compiler errors!) when compiling clippy for lintcheck 2021-02-19 21:52:34 +01:00
Matthias Krüger bb5f9d18a0 lintcheck: tweak some comments 2021-02-19 21:48:52 +01:00
Matthias Krüger 90d3275b45 lintcheck: parallelize
Use rayon to figure out the threadcount and half that for core count.
For each core, create a target dir that is used.
Otherwise, when running multiple clippys with the same target-dir, cargo would lock the dir and prevent parallelism.
This way we can run multiple clippys at the same time (on root crates) but we sacrifice cache-hits (when we already cargo-checked crate-deps).
2021-02-19 00:14:43 +01:00
flip1995 dd5c9b7dda lintcheck: Slight improvements to the error reporting 2021-02-16 16:58:00 +01:00
flip1995 2a28ea0bea Add command line options option to lintcheck crates config 2021-02-16 16:57:30 +01:00
Matthias Krüger 028692b46a lintcheck: filter out messages that come from cargo-metadata errors or contain absolute paths to rustc source files
The latter is especially annoying because the paths would change every time we bumped the pinned nightly version.
2021-02-15 23:38:50 +01:00
Matthias Krüger 8f1cceb6ff lintcheck: print warnings if we can't check out or clone a git repo 2021-02-15 22:48:33 +01:00
Matthias Krüger f8dbcae9f4 lintcheck: fix bug in downloade_and_extract() for git sources: we need to execute "git checkout xy" inside the repo dir! 2021-02-15 22:48:32 +01:00
Matthias Krüger 214d821268 lintcheck: put some code into a gather_stats() function 2021-02-15 22:13:17 +01:00
Matthias Krüger 4856e5f8fc lintcheck: rename a few symbols, add documentation to functions 2021-02-15 22:13:17 +01:00
Matthias Krüger 1b74439871 lintcheck: rename struct field 2021-02-15 22:13:17 +01:00
Matthias Krüger 5bbb1bc20a lintcheck: env var LINTCHECK_TOML can be used to override toml file location (has precedence over --crates-toml flag) 2021-02-13 00:39:19 +01:00
Matthias Krüger a6d493d52a lintcheck: collect ICEs 2021-02-11 10:43:06 +01:00
Matthias Krüger 5e29aa6fdf lintcheck: add support for path sources 2021-02-11 10:43:04 +01:00
Matthias Krüger c7241b6e5e lintcheck: make the log file be ${source-file}-logs.txt
this allows us to check multiple source.tomls and not worry about overriding our logfiles accidentally
2021-02-11 10:41:31 +01:00
Matthias Krüger 6f3eeac83c lintcheck: add a cmdline option --crates-toml <TOML PATH> to override crate sources file to use.
Fixes #6691
2021-02-07 16:14:43 +01:00
bors c1ce78f0b2 Auto merge of #6686 - matthiaskrgr:lintcheck_git, r=flip1995
lintcheck: support git sources

This adds support for git sources in `cargo dev-lintcheck`

You can add a git source to `clippy_dev/lintcheck_crates.toml` by having a `git_url` and a `git_hash` key instead of the `versions` array.
The repo will the be cloned and checked out to the requested commit before checking it with clippy.

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

changelog: lintcheck: support git sources
2021-02-07 13:25:00 +00:00
bors d792210c26 Auto merge of #6682 - camsteffen:let-underscore-ref, r=llogiq
Fix let_underscore_drop FP

changelog: Fix let_underscore_drop false positives and negatives

Fixes #6633
2021-02-07 08:13:42 +00:00
Cameron Steffen 40ce05654b Eat dogfood 2021-02-06 16:35:38 -06:00
Matthias Krüger 2bffbfccc1 lintcheck: avoid dbg!() calls 2021-02-06 19:12:58 +01:00
Matthias Krüger e1c284bff7 lintcheck: cleanup, fix --only for git crates, better error msgs 2021-02-06 12:24:13 +01:00
Matthias Krüger 9ab505a3c7 lintcheck: add git source as an example and update logs 2021-02-06 12:11:31 +01:00
Matthias Krüger 10fbafa562 implement the download_and_extract() step for git sources 2021-02-06 12:10:47 +01:00
Matthias Krüger 64982cc435 lintcheck: make TomlCrate also accept git-data from lintcheck_crates.toml 2021-02-06 12:10:45 +01:00
flip1995 79dbf10736 Use absolute path to Rust repo in ra_setup
This will convert the path to the Rust repo to an absolute path. This is
important for the clippy_lints/Cargo.toml file. Otherwise if a relative
path is passed, rst-analyzer won't find the Rust repo, because it starts
the relative path search from the clippy_lints dir, not the
rust-clippy dir where the ra_setup command was run from.
2021-02-05 17:23:04 +01:00