Skip to main content

rigsql_rules/structure/
st06.rs

1use rigsql_core::SegmentType;
2
3use crate::rule::{CrawlType, Rule, RuleContext, RuleGroup};
4use crate::violation::LintViolation;
5
6/// ST06: Select column order convention.
7///
8/// This is a stub rule. The full sqlfluff ST06 checks for specific column
9/// ordering conventions (e.g., aggregates after non-aggregates) which is
10/// complex to detect reliably.
11#[derive(Debug, Default)]
12pub struct RuleST06;
13
14impl Rule for RuleST06 {
15    fn code(&self) -> &'static str {
16        "ST06"
17    }
18    fn name(&self) -> &'static str {
19        "structure.column_order"
20    }
21    fn description(&self) -> &'static str {
22        "Select column order convention."
23    }
24    fn explanation(&self) -> &'static str {
25        "Columns in a SELECT clause should follow a consistent ordering convention. \
26         For example, wildcards and simple columns before aggregate or window functions. \
27         This rule is currently a stub and does not produce violations."
28    }
29    fn groups(&self) -> &[RuleGroup] {
30        &[RuleGroup::Structure]
31    }
32    fn is_fixable(&self) -> bool {
33        false
34    }
35
36    fn crawl_type(&self) -> CrawlType {
37        CrawlType::Segment(vec![SegmentType::SelectClause])
38    }
39
40    fn eval(&self, _ctx: &RuleContext) -> Vec<LintViolation> {
41        // Stub: not implemented yet
42        vec![]
43    }
44}
45
46#[cfg(test)]
47mod tests {
48    use super::*;
49    use crate::test_utils::lint_sql;
50
51    #[test]
52    fn test_st06_no_false_positives() {
53        let violations = lint_sql("SELECT a, b, COUNT(*) FROM t GROUP BY a, b;", RuleST06);
54        assert_eq!(violations.len(), 0);
55    }
56}