PureSharp features
PureMethod checks
Annotate methods with [PureMethod] to ask PureSharp to verify selected referential-transparency constraints. The analyzer reports mutable static field access, calls to methods that are not known to be pure, and I/O operations inside marked methods.
Immutable local variables
PureSharp uses an explicit naming convention for immutable locals: names beginning with an underscore are treated as immutable variables. They must be initialized at declaration and cannot be reassigned. Effectively immutable ordinary locals can also receive a naming suggestion.
FluentIf
Fluent.If provides expression-oriented conditional flow. The analyzer verifies that a chain is terminated with .Else(...), preventing incomplete fluent conditions from becoming unnoticed logic errors.
Roslyn-native workflow
PureSharp diagnostics appear during normal IDE analysis and dotnet build. Severity can be configured with standard dotnet_diagnostic.<ID>.severity settings in .editorconfig.
Project components
- PureSharp.Core — attributes and runtime utilities.
- PureSharp.Analyzers — compile-time Roslyn diagnostics.
- PureSharp.Analyzers.Tests — analyzer behavior tests.