Trellis analyzer rules
Trellis analyzers help you keep Result<T>, Maybe<T>, EF Core integration, and Trellis value objects on the happy path. Every rule below uses the Trellis analyzer category.
Rule index
| ID | Severity | Title | Article |
|---|---|---|---|
| TRLS001 | Warning | Result return value is not handled | TRLS001 |
| TRLS002 | Info | Use Bind instead of Map when lambda returns Result | TRLS002 |
| TRLS003 | Warning | Unsafe access to Result.Value | TRLS003 |
| TRLS004 | Warning | Unsafe access to Result.Error | TRLS004 |
| TRLS005 | Info | Consider using MatchError for error type discrimination | TRLS005 |
| TRLS006 | Warning | Unsafe access to Maybe.Value | TRLS006 |
| TRLS007 | Warning | Use Create instead of TryCreate().Value | TRLS007 |
| TRLS008 | Warning | Result is double-wrapped | TRLS008 |
| TRLS009 | Warning | Incorrect async Result usage | TRLS009 |
| TRLS010 | Info | Use specific error type instead of base Error class | TRLS010 |
| TRLS011 | Warning | Maybe is double-wrapped | TRLS011 |
| TRLS012 | Info | Consider using Result.Combine | TRLS012 |
| TRLS013 | Info | Consider using GetValueOrDefault or Match | TRLS013 |
| TRLS014 | Warning | Use async method variant for async lambda | TRLS014 |
| TRLS015 | Warning | Don't throw exceptions in Result chains | TRLS015 |
| TRLS016 | Warning | Error message should not be empty | TRLS016 |
| TRLS017 | Warning | Don't compare Result or Maybe to null | TRLS017 |
| TRLS018 | Warning | Unsafe access to Value in LINQ expression | TRLS018 |
| TRLS019 | Error | Combine chain exceeds maximum supported tuple size | TRLS019 |
| TRLS020 | Warning | Use SaveChangesResultAsync instead of SaveChangesAsync | TRLS020 |
| TRLS021 | Warning | HasIndex references a Maybe |
TRLS021 |
| TRLS022 | Warning | Wrong [StringLength] or [Range] attribute namespace | TRLS022 |
Code fixes at a glance
These rules currently offer a code fix: TRLS002, TRLS003, TRLS004, TRLS006, TRLS007, TRLS013, TRLS014, and TRLS020.
Suppressing a rule
Use .editorconfig when you want a project-wide or folder-wide setting:
dotnet_diagnostic.TRLS003.severity = none
Use #pragma when you need a narrow, local exception:
#pragma warning disable TRLS003
var customer = result.Value;
#pragma warning restore TRLS003
Tip
Treat analyzer suppressions as documentation. If a rule is intentionally suppressed, leave a short reason nearby.