Categories
| Category | Rules | Examples |
|---|---|---|
| Design | 4 | Primary constructor patterns, type partialness |
| Usage | 17 | Span comparisons, IXmlSerializable, static lambdas, Roslyn utils |
| Style | 3 | Pattern matching, null-guard normalization |
| ASP.NET Core | 5 | Form binding, parameter validation |
| OpenTelemetry | 2 | Semantic conventions, schema URLs |
| Threading | 1 | Lock statement best practices |
| Reliability | 3 | Division by zero, trim/AOT safety |
| VersionManagement | 2 | Hardcoded version, Version.props import |
| AOT/Trim Safety | 4 | AotTest return codes, TrimSafe/AotSafe violations |
Rules
| Id | Category | Description | Severity | Fix |
|---|---|---|---|---|
| AL0001 | Design | Prohibit reassignment of primary constructor parameters | Error | - |
| AL0002 | Design | Don’t repeat negated patterns | Warning | Yes |
| AL0003 | Reliability | Don’t divide by constant zero | Error | - |
| AL0004 | Usage | Use pattern matching for Span constants | Warning | Yes |
| AL0005 | Usage | Use SequenceEqual for Span non-constants | Warning | Yes |
| AL0006 | Design | Field name conflicts with primary constructor | Warning | - |
| AL0007 | Usage | GetSchema should be explicitly implemented | Error | - |
| AL0008 | Usage | GetSchema must return null | Error | Yes |
| AL0009 | Usage | Don’t call IXmlSerializable.GetSchema | Error | - |
| AL0010 | Design | Type should be partial | Info | Yes |
| AL0011 | Threading | Avoid lock on non-Lock types | Warning | Yes |
| AL0012 | OpenTelemetry | Deprecated semantic convention | Warning | Yes |
| AL0013 | OpenTelemetry | Missing telemetry schema URL | Info | - |
| AL0014 | Style | Prefer pattern matching for null/zero | Warning | Yes |
| AL0015 | Style | Normalize null-guard style | Info | Yes |
| AL0016 | Style | Combine declaration with null-check | Info | Yes |
| AL0017 | VersionManagement | Hardcoded package version | Warning | - |
| AL0018 | VersionManagement | Version.props not imported | Warning | - |
| AL0020 | ASP.NET Core | IFormCollection requires explicit attribute | Error | - |
| AL0021 | ASP.NET Core | Multiple structured form sources | Error | - |
| AL0022 | ASP.NET Core | Mixed form collection and DTO | Error | - |
| AL0023 | ASP.NET Core | Unsupported form type | Error | - |
| AL0024 | ASP.NET Core | Form and body conflict | Error | - |
| AL0025 | Usage | Anonymous function can be static | Warning | Yes |
| AL0026 | Usage | Avoid DateTime.Now/UtcNow, use TimeProvider | Warning | - |
| AL0027 | Usage | Avoid Newtonsoft.Json, use System.Text.Json | Warning | - |
| AL0028 | Usage | Use IsEqualTo() for symbol comparison | Info | - |
| AL0029 | Usage | Use HasAttribute() for attribute checks | Info | - |
| AL0030 | Usage | Use type hierarchy extensions | Info | - |
| AL0031 | Usage | Use operation extensions | Info | - |
| AL0032 | Usage | Use OrEmpty() extension | Info | - |
| AL0033 | Usage | Use ToImmutableArrayOrEmpty() extension | Info | - |
| AL0034 | Usage | Use WhereNotNull() extension | Info | - |
| AL0035 | Usage | Use GetFullyQualifiedName/GetMetadataName() | Info | - |
| AL0036 | Usage | Use Guard.NotNull() extension | Warning | - |
| AL0037 | Usage | Use TryParse extensions | Warning | - |
| AL0038 | Usage | Use GetOrNull/GetOrDefault extensions | Warning | - |
| AL0039 | Usage | Use StringComparison extensions | Warning | - |
| AL0040 | Usage | Use attribute argument extensions | Warning | - |
| AL0041 | AOT/Trim | [AotTest]/[TrimTest] must return int | Error | - |
| AL0042 | AOT/Trim | [AotTest]/[TrimTest] should return 100 | Warning | - |
| AL0043 | Reliability | [TrimSafe] violates trim safety | Warning | - |
| AL0044 | Reliability | [AotSafe] violates AOT safety | Warning | - |
Refactorings
Configuration
Configure via.editorconfig. See Configuration.
