Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc_markdown a bit too eager #902

Open
Keats opened this issue May 5, 2016 · 10 comments
Open

doc_markdown a bit too eager #902

Keats opened this issue May 5, 2016 · 10 comments
Labels
good-first-issue These issues are a good way to get started with Clippy S-needs-discussion Status: Needs further discussion before merging or work can be started

Comments

@Keats
Copy link

Keats commented May 5, 2016

Running the latest clippy on https://github.com/Keats/tera/ gives the following warning:

Compiling tera v0.1.0 (file:///home/vincent/Code/tera)
src/lexer.rs:133:1: 133:94 warning: you should put `HxaD_trXwRE` between ticks in the documentation, #[warn(doc_markdown)] on by default
src/lexer.rs:133 /// Lexer based on the one used in go templates (https://www.youtube.com/watch?v=HxaD_trXwRE)
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lexer.rs:133:1: 133:94 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#doc_markdown

@mcarton mcarton added good-first-issue These issues are a good way to get started with Clippy S-needs-discussion Status: Needs further discussion before merging or work can be started labels May 5, 2016
@mcarton
Copy link
Member

mcarton commented May 5, 2016

IMHO it’s a feature here. Raw links in doc are ugly.
The lint ignores actual markdown links: [go templates](https://www.youtube.com/watch?v=HxaD_trXwRE) is OK.

@tikue
Copy link

tikue commented Sep 4, 2016

It does not ignore markdown links:

$ cargo clippy
   Compiling tarpc v0.6.0 (file:///Users/tikue/Documents/rust/tarpc)
warning: you should put `gRPC` between ticks in the documentation, #[warn(doc_markdown)] on by default
  --> src/lib.rs:18:45
   |
18 | //! architectures. Two well-known ones are [gRPC](http://www.grpc.io) and
   |                                             ^^^^

@mcarton
Copy link
Member

mcarton commented Sep 4, 2016

@tikue It's a feature. It ignores the link (http://…), not but the text (gRPC). Clippy cannot know every possible weird-cased name and thinks it's a variable, so you can add

doc-valid-idents = ["gRPC"]

to clippy.toml to ignore it.

@tikue
Copy link

tikue commented Sep 4, 2016

Gotcha. I think that's reasonable. Though I'd be interested to get some numbers on precision with this one...

@Keats
Copy link
Author

Keats commented Nov 21, 2016

Running into it again on a markdown link:

warning: you should put `Prevention_Cheat_Sheet` between ticks in the documentation, #[warn(doc_markdown)] on by default
 --> /home/vincent/Code/tera/src/utils.rs:3:76
  |
3 | /// From [OWASP](https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet)
  |                                                                            ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#doc_markdown

@briansmith
Copy link

In briansmith/ring#285 (comment), @pietro wrote:

BTW, currently clippy warns about lack of backticks on documentation [...]. Some of the things clippy warns about are definitively wrong, like SpecialPublications in http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Ar2.pdf

Example:

/// See [NIST SP 800-56A, revision 2].
///
/// [NIST SP 800-56A, revision 2]:
///     http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Ar2.pdf
fn foo() { }

@clarfonthey
Copy link
Contributor

@Keats that isn't a valid markdown link; you need to escape the ( ).

@sanmai-NL
Copy link
Contributor

sanmai-NL commented Mar 3, 2017

Could we please determine the default value of doc-valid-idents based on empirical data?
A practical approach would be to include the top StackOverflow tags that are proper names. Then we must normalize those to their canonical mixed case form, next add them (manually) to clippy_lints/src/utils/conf.rs. This should only have to be done very infrequently.

@mcarton
Copy link
Member

mcarton commented Mar 3, 2017

@sanmai-NL While I think it's a good idea how do you expect us to get such a list from a 47396-item list of lower-case IDs?

@sanmai-NL
Copy link
Contributor

sanmai-NL commented Mar 7, 2017

@mcarton:
I propose we match the top (the no. of entries doesn’t matter) StackOverflow tags against all mixed-case English Wikipedia article titles. Mixed-case meaning, having uppercase letters after the initial. We can match pairs based on the lowest edit distance observed, given a tag, against each title. If I wasn't so busy I'd write a small Rust program to do this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue These issues are a good way to get started with Clippy S-needs-discussion Status: Needs further discussion before merging or work can be started
Projects
None yet
Development

No branches or pull requests

8 participants