1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/// analyzer.rs — Rule dispatch and issue collection.
///
/// The analyzer is intentionally thin: it constructs a `RuleContext` from the
/// parsed file data, then calls every registered rule's `run` method.
///
/// # Design choices
///
/// - **No shared mutable state**: Each rule creates its own visitor internally.
/// Rules only communicate with the analyzer by returning `Vec<Issue>`.
///
/// - **Single AST pass per rule**: Each rule gets a reference to the *same*
/// `Program`. Parsing happens exactly once per file in `main.rs`; the
/// analyzer does not re-parse.
///
/// - **Extensible**: Adding a new rule requires only adding it to `rules::all_rules()`.
/// The analyzer loop here never needs to change.
use Path;
use Program;
use crateCategory;
use crate;
/// Run all registered lint rules against a single parsed file.
///
/// # Arguments
/// * `program` — The parsed OXC AST for this file.
/// * `source_text` — Raw source code (used for line/col conversion).
/// * `file_path` — Path of the file (embedded in each `Issue`).
/// * `max_component_lines` — Passed to `large_component` rule.
///
/// # Returns
/// All `Issue`s found across all rules, in the order the rules are registered.
/// Run a custom set of rules — used in tests to exercise individual rules.
///
/// Production callers should use `analyze()` which uses the full registry.