hobofan / ronat Goto Github PK
View Code? Open in Web Editor NEWRust linter for documentation
License: Apache License 2.0
Rust linter for documentation
License: Apache License 2.0
Via docstrings
Example:
/// This is an header.
///
/// # Parameters
///
/// - `foo`: Incorrect variable name
#[deny(doc_params_mismatch)]
pub fn somefunction(bar: isize) {
}
Should give a warning that there is no parameter named foo
.
Some lints on simple grammar and language style would be nice.
Via docstrings
Example:
/// This is an header.
///
/// # Parameters
///
/// - `second`: Another parameter
/// - `first`: Some parameter
#[deny(doc_params_unordered)]
pub fn somefunction(first: isize, second: usize) {
}
Should give a warning that baz
is documented before bar
. Not sure if that provides much value, but why not? ๐
Having a cargo command that acts similar to the way clippy does, would be awesome to have.
Currently, the markdown parser that is used destroys the line/character information, making it hard to impossible to restore the correct association to the misspelled word in the original comment.
One easy workaround would be to search for the misspelled word in the original comment, which could lead to finding the wrong instance of the word. This might not be a problem, since every instance of the misspelled word should be marked.
Another solution would be to replace the markdown parser with a pull-parser, which should make it easier to keep the association to the original comment location.
As mentioned in rust-lang/style-team#17 (comment):
Comments should be complete sentences. Start with a capital letter, (usually) end with a period (.)
Via docstrings
Example:
/// This is an header.
///
/// # Parameters
///
/// - `bar`: Some parameter
#[deny(doc_params_incomplete)]
pub fn somefunction(bar: isize, baz: usize) {
}
Should give a warning that there is no documentation for baz
. Should only error if at least one of the parameters is documented.
I just found out that rustfmt has some style checks (though not lints):
https://github.com/rust-lang-nursery/rustfmt/blob/49e86a1e6501b261e6fef530d478ad0ea5ff3814/src/comment.rs
I haven't really looked into it in-depth, but there might be a few things in there that could be interesting.
There is also a fmt-RFC that could provide some inspiration for lints: rust-lang/style-team#17
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.