pub enum DiagnosticCode {
Show 44 variants
ParseError,
SyntaxError,
UnexpectedEof,
MissingStrict,
MissingWarnings,
UnusedVariable,
UndefinedVariable,
VariableShadowing,
VariableRedeclaration,
DuplicateParameter,
ParameterShadowsGlobal,
UnusedParameter,
UnquotedBareword,
UninitializedVariable,
MisspelledPragma,
MissingPackageDeclaration,
DuplicatePackage,
DuplicateSubroutine,
MissingReturn,
BarewordFilehandle,
TwoArgOpen,
ImplicitReturn,
AssignmentInCondition,
NumericComparisonWithUndef,
PrintfFormatMismatch,
DeprecatedDefined,
DeprecatedArrayBase,
SecurityStringEval,
SecurityBacktickExec,
UnusedImport,
ModuleNotFound,
HeredocInFormat,
HeredocInBegin,
HeredocDynamicDelimiter,
HeredocInSourceFilter,
HeredocInRegexCode,
HeredocInEval,
HeredocTiedHandle,
VersionIncompatFeature,
CriticSeverity1,
CriticSeverity2,
CriticSeverity3,
CriticSeverity4,
CriticSeverity5,
}Expand description
Stable diagnostic codes for Perl LSP.
Each code has a fixed string representation and associated metadata.
Variants§
ParseError
General parse error
SyntaxError
Syntax error
UnexpectedEof
Unexpected end-of-file
MissingStrict
Missing ‘use strict’ pragma
MissingWarnings
Missing ‘use warnings’ pragma
UnusedVariable
Unused variable
UndefinedVariable
Undefined variable
VariableShadowing
Variable shadowing an outer declaration
VariableRedeclaration
Variable redeclared in the same scope
DuplicateParameter
Duplicate parameter in a subroutine signature
ParameterShadowsGlobal
Subroutine parameter shadows a global variable
UnusedParameter
Subroutine parameter is declared but never used
UnquotedBareword
Bareword used where a quoted string is expected (under strict)
UninitializedVariable
Variable used before being initialized
MisspelledPragma
Pragma name appears to be misspelled
MissingPackageDeclaration
Missing package declaration
DuplicatePackage
Duplicate package declaration
DuplicateSubroutine
Duplicate subroutine definition
MissingReturn
Missing explicit return statement
BarewordFilehandle
Bareword filehandle usage
TwoArgOpen
Two-argument open() call
ImplicitReturn
Implicit return value
AssignmentInCondition
Assignment used where a comparison was likely intended
NumericComparisonWithUndef
Numeric comparison against a potentially undefined value
PrintfFormatMismatch
printf/sprintf format specifier count does not match argument count
DeprecatedDefined
Use of deprecated defined(@array) / defined(%hash)
DeprecatedArrayBase
Use of deprecated $[ array base variable
SecurityStringEval
String eval is a security risk
SecurityBacktickExec
Backtick/qx command execution detected
UnusedImport
Module appears to be unused
ModuleNotFound
Module not found in workspace or configured include paths
HeredocInFormat
Heredoc used inside a format block
HeredocInBegin
Heredoc used inside a BEGIN block
HeredocDynamicDelimiter
Heredoc delimiter is dynamic (variable interpolation)
HeredocInSourceFilter
Heredoc used inside a source filter
HeredocInRegexCode
Heredoc used inside a regex code block
HeredocInEval
Heredoc used inside string eval
HeredocTiedHandle
Heredoc used with a tied filehandle
VersionIncompatFeature
Use of a Perl feature not available in the declared version
CriticSeverity1
Perl::Critic brutal (severity 1) violation
CriticSeverity2
Perl::Critic cruel (severity 2) violation
CriticSeverity3
Perl::Critic harsh (severity 3) violation
CriticSeverity4
Perl::Critic stern (severity 4) violation
CriticSeverity5
Perl::Critic gentle (severity 5) violation
Implementations§
Source§impl DiagnosticCode
impl DiagnosticCode
Sourcepub fn documentation_url(&self) -> Option<&'static str>
pub fn documentation_url(&self) -> Option<&'static str>
Get the documentation URL for this code, if available.
Sourcepub fn severity(&self) -> DiagnosticSeverity
pub fn severity(&self) -> DiagnosticSeverity
Get the default severity for this diagnostic code.
Get any diagnostic tags associated with this code.
Sourcepub fn context_hint(&self) -> Option<&'static str>
pub fn context_hint(&self) -> Option<&'static str>
Return a human-readable context hint for this diagnostic code.
Hints are short, actionable explanations that help users understand
what the diagnostic means and how to resolve it. Perl::Critic codes
return None because their per-policy descriptions already serve this
purpose.
Sourcepub fn from_message(msg: &str) -> Option<DiagnosticCode>
pub fn from_message(msg: &str) -> Option<DiagnosticCode>
Try to infer a diagnostic code from a message.
Sourcepub fn parse_code(code: &str) -> Option<DiagnosticCode>
pub fn parse_code(code: &str) -> Option<DiagnosticCode>
Try to parse a code string into a DiagnosticCode.
Source§impl DiagnosticCode
impl DiagnosticCode
Sourcepub fn category(&self) -> DiagnosticCategory
pub fn category(&self) -> DiagnosticCategory
Get the category of this diagnostic code.
Trait Implementations§
Source§impl Clone for DiagnosticCode
impl Clone for DiagnosticCode
Source§fn clone(&self) -> DiagnosticCode
fn clone(&self) -> DiagnosticCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more