Skip to main content

mdlint/lint/rules/
md006.rs

1use crate::lint::rule::Rule;
2use crate::markdown::MarkdownParser;
3use crate::types::Violation;
4use serde_json::Value;
5
6pub struct MD006;
7
8impl Rule for MD006 {
9    fn name(&self) -> &'static str {
10        "MD006"
11    }
12
13    fn description(&self) -> &'static str {
14        "Consider starting bulleted lists at the beginning of the line"
15    }
16
17    fn tags(&self) -> &[&str] {
18        &["bullet", "ul", "indentation"]
19    }
20
21    fn check(&self, _parser: &MarkdownParser, _config: Option<&Value>) -> Vec<Violation> {
22        // MD006 is deprecated and not enabled by default in markdownlint
23        // Always return no violations for compatibility
24        Vec::new()
25    }
26
27    fn fixable(&self) -> bool {
28        false
29    }
30}
31
32#[cfg(test)]
33mod tests {
34    use super::*;
35
36    #[test]
37    fn test_list_at_start() {
38        let content = "* Item 1\n* Item 2";
39        let parser = MarkdownParser::new(content);
40        let rule = MD006;
41        let violations = rule.check(&parser, None);
42
43        assert_eq!(violations.len(), 0);
44    }
45
46    #[test]
47    fn test_indented_list() {
48        let content = "  * Item 1\n  * Item 2";
49        let parser = MarkdownParser::new(content);
50        let rule = MD006;
51        let violations = rule.check(&parser, None);
52
53        // MD006 is deprecated, always returns 0 violations
54        assert_eq!(violations.len(), 0);
55    }
56
57    #[test]
58    fn test_nested_list() {
59        let content = "* Item 1\n  * Nested item";
60        let parser = MarkdownParser::new(content);
61        let rule = MD006;
62        let violations = rule.check(&parser, None);
63
64        // MD006 is deprecated, always returns 0 violations
65        assert_eq!(violations.len(), 0);
66    }
67
68    #[test]
69    fn test_mixed() {
70        let content = "* Good\n  * Nested (violation)\n+ Also good";
71        let parser = MarkdownParser::new(content);
72        let rule = MD006;
73        let violations = rule.check(&parser, None);
74
75        // MD006 is deprecated, always returns 0 violations
76        assert_eq!(violations.len(), 0);
77    }
78}