Commit Graph

238 Commits

Author SHA1 Message Date
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
Caden Haustein
bde667af7e
Add missing_panics_doc lint 2021-02-02 16:36:32 +01:00
Philipp Hansch
da26b2149f
clippy_dev: Pass stderr to CommandFailed 2021-01-31 11:21:33 +01:00
Matthias Krüger
5b6a18362b lintcheck: fix paths in the logs 2021-01-23 02:18:11 +01:00
Matthias Krüger
83fcf95f52 rename cargo dev crater to cargo dev lintcheck 2021-01-23 02:18:11 +01:00
Matthias Krüger
48fc948ca3 clippy dev crater: address more review commetns
make serde a feature-dep
save clippy version in the crater log
2021-01-23 02:18:11 +01:00
Matthias Krüger
ec1902ce43 cargo dev crater: throw an error if we can't find our specified crate in the .toml list 2021-01-23 02:18:11 +01:00
Matthias Krüger
b6ef1e282e clippy dev crater: add option to only check a single one of the listed crates with --only crate 2021-01-23 02:18:11 +01:00
Matthias Krüger
d257101109 make stats stable 2021-01-23 02:18:11 +01:00
Matthias Krüger
e56c9a5253 cargo dev crater: gather and save lint statistics (how often a lint triggered) 2021-01-23 02:18:11 +01:00
Matthias Krüger
4ec9cb84bb cargo dev crater: refactor to get a list of all ClippyWarnings 2021-01-23 02:18:11 +01:00
Matthias Krüger
6c5bf2778f clippy dev crater: use and parse clippy messages as json message, to get the lint name of a warning 2021-01-23 02:18:11 +01:00
Matthias Krüger
62337f2842 remove duplicate code and other cleanup 2021-01-23 02:18:11 +01:00
Matthias Krüger
22824d21da rename symbols: krate -> crate 2021-01-23 02:18:11 +01:00
Matthias Krüger
f986d78c5e cargo dev crater: support multiple versions per crate 2021-01-23 02:18:11 +01:00
Matthias Krüger
588efa7da9 use a .toml file to list the crates we want to check
Also sort lint results alphabetically.
2021-01-23 02:18:11 +01:00
Matthias Krüger
a9fce6d2d0 allow clippy::filter_map 2021-01-23 02:18:11 +01:00
Matthias Krüger
ccfaa338ed cargo dev crater: share target dir between clippy runs, enable pedantic and cargo lints, ignore tokei for now. 2021-01-23 02:18:11 +01:00
Matthias Krüger
1e5ac1dfd2 cargo dev crater: add more crates to be checked 2021-01-23 02:18:11 +01:00
Matthias Krüger
dbb8c0020e cargo dev crater: save all warnings into a file 2021-01-23 02:18:11 +01:00
Matthias Krüger
7314133722 cargo dev crater: cleanup, don't re-download and reextract crates on every run 2021-01-23 02:18:11 +01:00
Matthias Krüger
734d2052df print all clippy warnings in the end 2021-01-23 02:18:11 +01:00
Matthias Krüger
2360a7cad0 cargo clippy dev: collecting one-line clippy warnings works now 2021-01-23 02:18:11 +01:00
Matthias Krüger
69c0757334 clippy cargo dev: fix checking of crates 2021-01-23 02:18:11 +01:00
Matthias Krüger
e69147486e cargo clippy dev: fix extraction of downloaded crates 2021-01-23 02:18:11 +01:00
Matthias Krüger
63176834c2 cargo dev crater: fixes and debug prints 2021-01-23 02:18:11 +01:00
Matthias Krüger
30d85942cf crater: hook into main.rs 2021-01-23 02:18:11 +01:00
Matthias Krüger
5353591b1b cargo dev crater: work on downloading and extracting crate sources 2021-01-23 02:18:11 +01:00
Matthias Krüger
bec916d02d cargo dev crater: lay out the base plan 2021-01-23 02:18:11 +01:00
Cameron Steffen
a22915bf48 Remove unneeded allow's 2021-01-21 18:19:53 -06:00
bors
dd52066f74 Auto merge of #6547 - camsteffen:curse-outdated, r=phansch
Curse outdated test output

changelog: internal

Change `cargo dev bless` to only include test output that was generated since the last build of clippy. This is especially useful when running tests with `TESTNAME=...`. The feature may be disabled by `cargo dev bless --ignore-timestamp`.
2021-01-05 08:00:50 +00:00
Cameron Steffen
cbbb188ea9 Bless only updated since clippy build 2021-01-04 09:08:22 -06:00
Cameron Steffen
7acfa4433f Add ui-internal to cargo dev bless 2021-01-04 08:56:46 -06:00
Philipp Hansch
69090550cb
s/test_dir/test_suite_dir
This should make the code slightly more understandable
2020-12-31 12:53:29 +01:00
Philipp Hansch
6b37932268
Fix blessing of test output in subdirectories
The core issue was the usage of `reference_file_path.file_name()`, which
provided a non-existent path if the file to be updated was in a
subdirectory.

Instead we have to provide the whole path after 'tests/ui/' as the
'filename'. This part of the path is called `test_name` in the code now.
2020-12-31 12:49:43 +01:00
Aleksei Latyshev
dfaea9c967
lint &PathBuf instead of &Path in PTR_ARG
- extract get_only_generic_arg_snippet to improve readability
2020-12-25 15:06:34 +03:00
Philipp Hansch
dfb4ea588c
Fix blessing of new reference files
Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious. The shell script did a `-s` test which reads the
file.
2020-12-19 08:43:45 +01:00
Matthias Krüger
27dc565d28 cargo dev: rename ra-setup to ra_setup to be in line with the other commands 2020-12-13 18:52:46 +01:00
Matthias Krüger
91fa25c9de clippy dev fmt: don't format if we have a local rustc repo enabled as path dependency via cargo dev ra-setup.
rustfmt would try to format the entire rustc repo, probably because it sees it as a local dependency.
2020-12-13 18:52:44 +01:00
Matthias Krüger
404c50f562 NFC: clippy cargo dev: move generation of clap config into a function 2020-12-13 18:52:24 +01:00
Philipp Hansch
b8501e1be1
Feed the dog 🐕 2020-12-12 15:14:54 +01:00
Philipp Hansch
41c562d4a5
Improve variable naming 2020-12-12 15:10:01 +01:00
Philipp Hansch
4bd9ed9b88
Rewrite update-all-references bash scripts in Rust
This replaces the `update-all-references` scripts with a single

    cargo dev bless

command.

cc #5394
2020-12-12 15:09:57 +01:00
Matthias Krüger
252083f7e0 address review comments and rebase
ci: always build with internal lints
group up internal lints in lib.rs
dogfood: we already pass --all-features, no need to enable internal-lints again
2020-11-29 23:43:23 +01:00
Matthias Krüger
958e2e20de fix clippy-dev update_lints 2020-11-29 21:07:47 +01:00
flip1995
03f04314dd clippy: Remove now obsolete lintlist module
Also stop updating the lintlist module in clippy_dev update_lints
2020-11-24 10:37:31 +01:00
flip1995
34244190d4 Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup 2020-11-05 14:29:48 +01:00
Eduardo Broto
cdb555f4fc Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup 2020-10-23 22:16:59 +02:00
flip1995
fbf2430f02 Merge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyup 2020-10-09 12:45:29 +02:00
flip1995
d1f9cad102 Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup 2020-09-24 14:49:22 +02:00
flip1995
282c59820b Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup 2020-08-28 18:43:25 +02:00
flip1995
027780ca2c Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
Lzu Tao
8db24840f7 Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy 2020-06-09 14:36:01 +00:00
flip1995
a0e9f9bd0d Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
Matthias Krüger
d021d3ef88 clippy_dev: make it fatal when the regex for updating lint count does not match
Fixes #5510
2020-04-23 16:11:11 +02:00
flip1995
d89bb50f72
Make lint modules private 2020-04-03 21:19:33 +02:00
flip1995
a186d9fafd
Don't filter lints in code generation functions 2020-04-03 21:19:32 +02:00
flip1995
98c30fea8c
Build lint lists once and the reuse them to update files 2020-04-03 21:19:32 +02:00
flip1995
da679825e0
Get rid of Lint::is_internal method 2020-04-03 21:19:32 +02:00
flip1995
ffb2e41234
Clean up update_lints 2020-04-03 21:18:36 +02:00
flip1995
3155eedb68
Don't use an exact lint counter anymore 2020-03-31 17:24:09 +02:00
flip1995
5de019074b
Move update_lints logic to its own module 2020-03-31 17:24:09 +02:00
flip1995
deb1979b8e
Make limit_stderr_length a subcommand 2020-03-31 17:24:09 +02:00
flip1995
8b9d70d349
Define modules in lib.rs instead of main.rs 2020-03-31 17:24:09 +02:00
Lzu Tao
53880a5bd6 Bump itertools 2020-03-29 12:50:11 +07:00
bors
e004b9431d Auto merge of #5329 - matthiaskrgr:int_arith_on_ref_5328, r=flip1995
integer_arithmetic: detect integer arithmetic on references.

changelog: integer_arithmetic fix false negatives with references on integers

Fixes #5328
2020-03-18 14:56:05 +00:00
flip1995
f041dcdb4e
Fix limit-stderr-files test 2020-03-18 15:27:25 +01:00
Matthias Krüger
7545925ffe new_lint.rs: encourage authors to write more detailed code samples in lint descriptions (linted as well as fixed code)
changelog: none
2020-03-18 01:43:39 +01:00
Yuki Okushi
4253aa7137 Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09:00
flip1995
8472ecda0f
Fix fallout 2020-02-21 11:14:18 +01:00
flip1995
50a2f971fc
Adapt gen_lint_group_list test to also generate internal lints 2020-02-14 14:42:24 +01:00
flip1995
07026983f5
Rename lint_count -> usable_lint_count 2020-02-14 14:37:56 +01:00
flip1995
4a9bfe4184
Let update_lints also generate the internal lints 2020-02-14 14:37:56 +01:00
flip1995
3da2c9183a
Save Lint::module as full path of module 2020-02-14 14:37:56 +01:00
flip1995
560559bafe
Make Lint::by_lint_group take impl Iterator as argument 2020-02-14 14:37:55 +01:00
Krishna Sai Veera Reddy
6b4cae18dd Remove unnecessary imports from new_lint tool 2020-02-10 19:24:01 -08:00
Lzu Tao
cf58537bd6 dev: Move DOCS_LINK out of lazy_static and reuse it 2020-02-07 08:33:05 +07:00
Lzu Tao
344603afce dev: Make UpdateMode a copy type 2020-02-07 08:33:05 +07:00
Lzu Tao
729f943c53 dev: Prefer fs::read* and improvement to replace text region 2020-02-07 08:33:05 +07:00
Lzu Tao
8794e41728 dev: Use bytecount for faster line count 2020-02-06 21:39:15 +07:00
Yuki Okushi
7a36a8d98a Decrease line length limit for stderrs 2020-02-03 15:11:02 +09:00
bors
ca2abaf366 Auto merge of #5109 - phansch:ciao_util_dev, r=flip1995
Deprecate util/dev in favor of cargo alias

This means one less shell script and a bit more cross-platform support
for contributors.

If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config` where an alias for calling the `clippy_dev` binary is defined.

changelog: none
2020-01-31 07:18:06 +00:00
Phil Hansch
8f457fa4c9
Mark clippy_project_root as must_use
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2020-01-31 07:32:53 +01:00
Philipp Hansch
3f2532b904
Replace one more copy-pasted clippy_project_root fn 2020-01-31 07:30:44 +01:00
Philipp Hansch
3036a2c30e
Move project_root function to clippy_dev/src/lib.rs
This allows us to use the method in both `fmt.rs` and `lib.rs` in
multiple places. The downside is that we panic inside the method now,
instead of using the error handling in `fmt.rs`. We may want to
centralize the error handling for clippy_dev at some point, though.
2020-01-30 21:34:25 +01:00
Philipp Hansch
4d1a11d354
Deprecate util/dev in favor of cargo alias
If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config`.

This means one less shell script and a bit more cross-platform support
for contributors.
2020-01-30 21:34:31 +01:00
Yuki Okushi
411317bd2c Decrease line length limit for stderr files 2020-01-30 12:08:38 +09:00
Yuki Okushi
c9d5cb9645 Decrease line length limit for stderr files 2020-01-21 06:43:01 +09:00
Krishna Sai Veera Reddy
9ebac161e4 Add lifetimes to LateLintPass 2020-01-16 10:05:29 -08:00
Krishna Sai Veera Reddy
2d352f42cc Fix rustc lint import paths generated by new_lint 2020-01-16 09:44:45 -08:00
Brad Sherman
ea82cbe790 Generate new lints easily
- Add option in clippy_dev to automatically generate boilerplate
  code for adding new lints
2020-01-15 21:20:50 -06:00