Skip to main content
ANcpLua.Analyzers enforces code quality and prevents common bugs. Included automatically with ANcpLua.NET.Sdk.

Categories

CategoryRulesExamples
Design4Primary constructor patterns, type partialness
Usage6Span comparisons, IXmlSerializable, static lambdas
Style3Pattern matching, null-guard normalization
ASP.NET Core5Form binding, parameter validation
OpenTelemetry2Semantic conventions, schema URLs
Threading1Lock statement best practices
Reliability1Division by zero prevention
VersionManagement1Hardcoded package version detection

Rules

IdCategoryDescriptionSeverityFix
AL0001DesignProhibit reassignment of primary constructor parametersError-
AL0002DesignDon’t repeat negated patternsWarningYes
AL0003ReliabilityDon’t divide by constant zeroError-
AL0004UsageUse pattern matching for Span constantsWarningYes
AL0005UsageUse SequenceEqual for Span non-constantsWarningYes
AL0006DesignField name conflicts with primary constructorWarning-
AL0007UsageGetSchema should be explicitly implementedError-
AL0008UsageGetSchema must return nullErrorYes
AL0009UsageDon’t call IXmlSerializable.GetSchemaError-
AL0010DesignType should be partialInfoYes
AL0011ThreadingAvoid lock on non-Lock typesWarning-
AL0012OpenTelemetryDeprecated semantic conventionWarningYes
AL0013OpenTelemetryMissing telemetry schema URLInfo-
AL0014StylePrefer pattern matching for null/zeroInfoYes
AL0015StyleNormalize null-guard styleInfoYes
AL0016StyleCombine declaration with null-checkInfoYes
AL0017VersionManagementHardcoded package versionWarning-
AL0020ASP.NET CoreIFormCollection requires explicit attributeError-
AL0021ASP.NET CoreMultiple structured form sourcesError-
AL0022ASP.NET CoreMixed form collection and DTOError-
AL0023ASP.NET CoreUnsupported form typeError-
AL0024ASP.NET CoreForm and body conflictError-
AL0025UsageAnonymous function can be staticInfoYes

Refactorings

IdDescription
AR0001Snake case to Pascal case
AR0002Make static lambda

Configuration

Configure via .editorconfig. See Configuration.
[*.cs]
dotnet_diagnostic.AL0014.severity = warning
dotnet_diagnostic.AL0010.severity = none