mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:33:50 +00:00
Add documentation for flake8-quotes rules (#2650)
This commit is contained in:
parent
367f115d83
commit
a9aa96b24f
10 changed files with 192 additions and 8 deletions
|
@ -4,11 +4,10 @@
|
|||
use std::fs;
|
||||
|
||||
use anyhow::Result;
|
||||
use ruff::registry::{Linter, Rule, RuleNamespace};
|
||||
use ruff::AutofixAvailability;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use ruff::registry::{Linter, Rule, RuleNamespace};
|
||||
|
||||
#[derive(clap::Args)]
|
||||
pub struct Args {
|
||||
/// Write the generated docs to stdout (rather than to the filesystem).
|
||||
|
@ -22,10 +21,12 @@ pub fn main(args: &Args) -> Result<()> {
|
|||
let mut output = String::new();
|
||||
output.push_str(&format!("# {} ({})", rule.as_ref(), rule.code()));
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
|
||||
let (linter, _) = Linter::parse_code(rule.code()).unwrap();
|
||||
output.push_str(&format!("Derived from the **{}** linter.", linter.name()));
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
|
||||
if let Some(autofix) = rule.autofixable() {
|
||||
output.push_str(match autofix.available {
|
||||
|
@ -33,6 +34,7 @@ pub fn main(args: &Args) -> Result<()> {
|
|||
AutofixAvailability::Always => "Autofix is always available.",
|
||||
});
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
}
|
||||
|
||||
output.push_str(explanation.trim());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue