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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//! Lint checks for Perl code analysis
//!
//! This module provides various linting checks for detecting deprecated syntax,
//! strict/warnings issues, common mistakes, and security anti-patterns in Perl code.
//!
//! # Architecture
//!
//! Lints are organized into focused submodules:
//!
//! - **deprecated**: Deprecated syntax warnings (e.g., `defined(@array)`)
//! - **strict_warnings**: Missing `use strict` / `use warnings` advisories and
//! misspelled pragma detection
//! - **common_mistakes**: Frequent programming errors (assignment in conditions, etc.)
//! - **security**: Security anti-patterns (two-arg open, string eval, backtick execution)
//!
//! # Diagnostic Code Reference
//!
//! Every diagnostic carries a `code` field that IDEs can use for quick-fix
//! integration, filtering, and documentation lookup.
//!
//! ## Parse errors (`diagnostics.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `parse-error` | Error | Generic parse error from the parser |
//!
//! ## Scope issues (`scope.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `undeclared-variable` | Error | Variable used without declaration |
//! | `variable-redeclaration` | Error | Duplicate `my` in same scope |
//! | `duplicate-parameter` | Error | Same parameter name twice |
//! | `unquoted-bareword` | Error | Bareword not allowed under strict |
//! | `variable-shadowing` | Warning | Inner variable hides outer |
//! | `unused-variable` | Warning | Declared but never read |
//! | `unused-parameter` | Warning | Subroutine parameter never used |
//! | `parameter-shadows-global` | Warning | Parameter hides package var |
//! | `uninitialized-variable` | Warning | Used before assignment |
//!
//! ## Deprecated syntax (`deprecated.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `deprecated-defined` | Warning | `defined(@array)` or `defined(%hash)` |
//! | `deprecated-array-base` | Warning | Use of `$[` variable |
//!
//! ## Strict / warnings (`strict_warnings.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `missing-strict` | Information | `use strict` not found |
//! | `missing-warnings` | Information | `use warnings` not found |
//! | `misspelled-pragma` | Warning | Pragma name appears misspelled |
//!
//! ## Common mistakes (`common_mistakes.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `assignment-in-condition` | Warning | `=` used where `==` likely intended |
//! | `numeric-undef` | Warning | `==`/`!=` with potentially undef value |
//!
//! ## Security (`security.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `security-two-arg-open` | Warning | `open(FH, ">file")` -- use 3-arg open |
//! | `security-string-eval` | Warning | `eval "$string"` is a security risk |
//! | `security-backtick-exec` | Information | Backtick/qx command execution detected |
//!
//! ## Package / subroutine (`package_subroutine.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `PL200` | Warning | File has no package declaration |
//! | `PL201` | Warning | Package name declared more than once |
//! | `PL300` | Warning | Subroutine name defined more than once |
//!
//! ## Dead code (`dead_code.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `dead-code-subroutine` | Hint | Subroutine with no callers |
//! | `dead-code-variable` | Hint | Package variable with no references |
//! | `dead-code-constant` | Hint | Constant with no references |
//! | `dead-code-package` | Hint | Package with no references |
//!
//! ## Unreachable code (`unreachable_code.rs`)
//!
//! | Code | Severity | Description |
//! |------|----------|-------------|
//! | `PL406` | Hint | Statement cannot be reached due to preceding unconditional exit |
//!
//! # Severity Levels
//!
//! Each lint produces diagnostics with appropriate severity:
//!
//! - **Error**: Issues that will cause runtime failures
//! - **Warning**: Potential bugs or deprecated patterns
//! - **Information**: Best practice suggestions
//! - **Hint**: Style recommendations
//!
//! # Integration
//!
//! Lints integrate with the diagnostics pipeline and provide:
//!
//! - Diagnostic codes for IDE quick-fix integration
//! - Related information with suggestions and explanations
//! - Diagnostic tags (Deprecated, Unnecessary) for IDE rendering
/// Missing module detection (PL701)
/// Package and subroutine diagnostics (PL200, PL201, PL300)
/// printf/sprintf format specifier arity validation (PL405)
/// Unreachable code detection (PL406)
/// Unused import detection
/// Perl version compatibility warnings (PL900)