Add documentation for mccabe, isort, and flake8-annotations (#2691)

This commit is contained in:
Charlie Marsh 2023-02-09 11:56:18 -05:00 committed by GitHub
parent 8a98cfc4b8
commit 7d5fb0de8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 713 additions and 23 deletions

View file

@ -30,20 +30,13 @@ impl Parse for LintMeta {
fn parse(input: ParseStream) -> Result<Self> {
let attrs = input.call(Attribute::parse_outer)?;
let mut in_code = false;
let mut explanation = String::new();
for attr in &attrs {
if let Some(lit) = parse_attr(["doc"], attr) {
let value = lit.value();
let line = value.strip_prefix(' ').unwrap_or(&value);
if line.starts_with("```") {
explanation += line;
explanation.push('\n');
in_code = !in_code;
} else if !(in_code && line.starts_with("# ")) {
explanation += line;
explanation.push('\n');
}
explanation.push_str(line);
explanation.push('\n');
} else {
return Err(Error::new_spanned(attr, "unexpected attribute"));
}