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
Refactor: Cleanup one part of assign_ops lint
Removes a lot of indentation and separates lint emission from lint
logic. Only touches the `hir::ExprKind::AssignOp` part of the lint.
Refactor: Extract `trait_ref_of_method` function
This pattern was used in three places after #3844, so I think it's worth moving it into `utils/mod.rs` and documenting it.
Cognitive Complexity (step 1 out of 3+): name changes
Following up on #3793
**Overall checklist:**
1. **Name changes**
2. MVP of functionality
3. Tests
After this PR, we will start working on the implementation itself.
* Ran automatic naming update
* Formalized rename of `cyclomatic_complexity` to `cognitive_complexity`
** Added the rename to `lib.rs`
** Added rename test
* Added warning for deprecated key `cyclomatic_complexity_threshold` and tests for it
* Added deprecation status for Clippy's builtin attribute
* Updated tests for new builtin attribute renaming
move lint documentation into macro invocations
This PR moves lint documentation inside `declare_clippy_lint!` macro invocations, to avoid triggering the `unused_doc_comments` lint once it's modified in rust-lang/rust#57882. This PR is necessary to unblock that work, since the large number of warnings generated in `clippy_lints` causes Travis to hit the log length limit.
This PR also updates the documentation and website generation script.
It would be nice to get a clippy update in the Rust repo once this is merged.
cc @phansch