Commit graph

51 commits

Author SHA1 Message Date
bors
920112d723 Auto merge of #3824 - phansch:adding_lints, r=phansch
Add lint writing documentation

[Rendered](https://github.com/phansch/rust-clippy/blob/adding_lints/doc/adding_lints.md)

This adds a new documentation page that explains how to write Clippy
lints. It guides the reader through creating a `foo` function lint.

I plan to iterate a bit more on the prose of some sections, but I think the
general structure is fine now, so I'm looking forward to feedback =)

One thing I'm not sure about: I felt like this is too big for CONTRIBUTING.md
so I put it into a new `doc/` directory. I can imagine having more
documentation in the future, so we might even want to create a book using
mdbook instead? Or should everything go into CONTRIBUTING.md?

Further things left to do:

- [x] Link from CONTRIBUTING.md
- [x] Remove things covered in this guide from CONTRIBUTING.md
- [x] Section about `clippy::author` attribute
- [x] Run `remark-lint` on CI over the `doc` directory and fix things
2019-03-09 15:05:38 +00:00
Michael Wright
fbcf7eefb9 Add [rustfmt::skip] to unused_unit test 2019-03-07 08:13:59 +02:00
Michael Wright
131c8f6bf2 Add [rustfmt::skip] to doc_markdown tests 2019-03-07 08:03:15 +02:00
Philipp Hansch
680dc8a105
Run remark in doc directory, too. 2019-03-03 15:03:25 +01:00
Michael Wright
6e6e39b4a8 Add rustfmt::skip to double_parens tests 2019-02-28 08:02:45 +02:00
Michael Wright
11682b4cd2 Add rustfmt::skip to outer attr format tests 2019-02-27 07:41:07 +02:00
Michael Wright
7fd0fbf435 Add [rustfmt::skip] to formatting lint tests 2019-02-26 07:49:46 +02:00
Michael Wright
0182a6640e Fix useless_format suggestions 2019-02-24 07:30:08 +02:00
Michael Wright
7a43509cc4 rustfmt tests/ui/methods.rs 2019-02-22 08:05:21 +02:00
bors
e176324fc5 Auto merge of #3665 - jsgf:master, r=oli-obk
Start making clippy easier to invoke in non-cargo contexts

Clippy (clippy-driver) currently has a couple of strong but unnecessary couplings with cargo. This series:
1. makes detection of check builds more robust, and
2. make clippy-driver use the --sysroot specified on the command line as its internal sysroot.
2019-02-06 15:43:07 +00:00
Jeremy Fitzhardinge
47563a13eb Add setup-toolchain.sh script to configure the master version of rustc,
and update CONTRIBUTING.md accordingly.
2019-02-03 14:41:46 -08:00
Jeremy Fitzhardinge
f0131fbab6 Add a CI test for cargoless use of clippy-driver 2019-02-02 19:35:06 -08:00
Jeremy Fitzhardinge
b07f1b0974 base-tests: use subshells to manage current directory
It saves on having to pair `cd <path> && think && cd ..`.
2019-02-02 11:43:21 -08:00
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
Matthias Krüger
38fabcbdf2 tests: fix formatting and update test output
fix script one last time™
2018-12-27 17:03:53 +01:00
Matthias Krüger
84ee884cc4 base tests: make sure to fail CI if tests need formatting 2018-12-27 16:56:08 +01:00
Matthias Krüger
bcc309f27d base tests: switch to nightly toolchain before checking formatting of tests with rustfmt
this errored because rustfmt is not available on the master toolchain
2018-12-27 16:56:07 +01:00
Matthias Krüger
9fb8022026 base tests: make sure cargo-clippy binary can be called directly 2018-12-14 21:43:40 +01:00
bors
f5d6aca197 Auto merge of #3537 - matthiaskrgr:fix_script_2, r=matthiaskrgr
base-tests: don't print all commands to stdout during the loop

Fixes thinko in #3529
2018-12-12 09:56:38 +00:00
Matthias Krüger
591738c35a base-tests: don't print all commands to stdout during the loop 2018-12-12 10:27:13 +01:00
Matthias Krüger
7fe39c9c6e fix typo in script 2018-12-12 09:17:43 +01:00
Matthias Krüger
743e9e3561 Merge branch 'master' into rustfmt_tests 2018-12-11 01:42:38 +01:00
Matthias Krüger
0a6e568f07 test formatting: don't format tests/ui/formatting.rs 2018-12-10 15:46:01 +01:00
Matthias Krüger
7bcc2cd9c8 update test stderr 2018-12-10 08:22:07 +01:00
Matthias Krüger
31d3bd92be travis: base-tests: share CARGO_TARGET_DIR between check runs of subcrates to avoid unneccessarily recompiling deps. 2018-12-09 22:47:22 +01:00
Matthias Krüger
1218145bc9 base tests: assert that tests are properly formatted. 2018-12-09 22:43:45 +01:00
Wayne Warren
72247d8e2e Fix dogfood tests. 2018-12-05 18:18:17 -06:00
Philipp Hansch
d8166bf141
Travis: Add rustc sysroot bin to PATH for windows build 2018-12-02 14:33:19 +01:00
flip1995
4e0938d349
Let travis run cargo fmt --all -- --check 2018-11-27 21:11:05 +01:00
Philipp Hansch
90f31e21ab
RIIR update lints: Add check mode (update_lints.py rewrite complete)
This finishes up the rewrite of `update_lints.py` in Rust. More
specifically, this

* adds the `--check` flag and handling to clippy_dev
* tracks file changes over the different calls to `replace_region_in_file`
* only writes changes to files if the `--check` flag is *not* used
* runs `./util/dev update_lints --check` on CI instead of the old script
* replaces usage of the `update_lints.py` script with an error

`./util/dev update_lints` behaves 99% the same as the python script.
The only difference that I'm aware of is an ordering change to
`clippy_lints/src/lib.rs` because underscores seem to be sorted
differently in Rust and in Python.

🏁
2018-11-05 07:18:47 +01:00
bors[bot]
a07c271559 Merge #3399
3399: RIIR update lints: Generate modules section and lint group sections r=flip1995 a=phansch

This adds the last missing parts of the generating code.

cc #2882

Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-11-03 19:11:35 +00:00
Philipp Hansch
6e3320c7ef
Test clippy_dev on CI and fix test 2018-11-03 10:58:45 +01:00
Matthias Krüger
df7cff31dc clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase.
Turn on pedantic lints in dogfood and base tests.

needless_bool: fix clippy::items-after-statements
redundant_pattern_matching: fix clippy::similar-names
mods.rs: fix clippy::explicit-iter-loop
returns.rs: allow clippy::cast-possible-wrap

Fixes #3172
2018-11-02 12:16:43 +01:00
Matthias Krüger
a90084d587 slightly simplify integration tests 2018-10-27 10:54:46 +02:00
Matthias Krüger
d6ca12a70d simplify ci base-tests 2018-10-26 20:00:43 +02:00
Philipp Hansch
f5a38f2323
Only run markdown linter on linux
Because:

* There's no need to run it on more than one platform
* It doesn't work on windows
2018-10-12 08:39:55 +02:00
Manish Goregaokar
23e5e24f52 Add license header to other files 2018-10-06 09:43:08 -07:00
Michael Wright
c52b33decb Make travis check lint list 2018-09-19 07:05:36 +02:00
flip1995
146b25e39b
Also run internal lints on the code base 2018-09-12 01:33:28 +02:00
Matthias Krüger
a14155088b rustc_tools_util: add test 2018-09-07 19:18:45 +02:00
Matthias Krüger
fa11aad92a print git commit hash and commit date in version output
clippy 0.0.212 (964fcbe0 2018-09-06)
2018-09-06 14:45:12 +02:00
Philipp Hansch
be995dc0e8
Run clippy on clippy_dev, too 2018-09-03 22:20:36 +02:00
Philipp Hansch
f3839f0c1a
Fix clippy -> clippy::all warning in CI 2018-09-03 08:03:05 +02:00
Corey Farwell
05f637cf88 Make clippy_lints::{utils,consts} modules private, remove unused items. 2018-08-28 21:32:20 -05:00
Matthias Krüger
a2343bfe7f integration tests: add more clippy warnings for greater coverage
integration/base tests: add a few code comments
2018-07-30 00:11:58 +02:00
Matthias Krüger
e0214397bd travis: run tests of external projects with --all-targets --all-features -- --cap-lints warn 2018-07-30 00:11:58 +02:00
Manish Goregaokar
e58eb520a4 Fix travis build by removing cargo-clippy 2018-07-16 14:14:37 -07:00
Philipp Hansch
b4482ce381
Make build output cleaner 2018-05-17 21:40:23 +02:00
Philipp Hansch
3314c5fda7
No -e in integration_tests
Because that makes the script stop early and not print any clippy error
output.
2018-05-16 19:54:30 +02:00
Philipp Hansch
9e6dc8d2d5
Add exec bit, add set -ex to ci test files 2018-05-16 18:55:21 +02:00