This repository contains my common analyzers. See the supported rules.
An analyzer that ensures that class members are ordered by type, keyword, accessibility level, and then by name. It also includes a code fix to reorder members appropriately.
This analyzer was heavily inspired by the fantastic CodeMaid. There are some important differences.
Improvements over CodeMaid:
- Uses modern Roslyn analyzer tooling.
- As a Roslyn analyzer, the rules can be integrated into the build to enforce member ordering at build time.
- The code fixups associated with the analyzer work anywhere Roslyn code fixups are supported: Visual Studio, Visual Studio Code, etc.. No extension required.
- In addition to
interface
,class
, andstruct
, the analyzer supports the newerrecord
andrecord struct
declaration types as well. - Running code fixups will not remove newer C# keywords like
required
, which happens today when reordering using CodeMaid.
Limitations compared to CodeMaid:
- The analyzer is not yet configurable.
- The analyzer does not support code regions:
#region MyRegion
. - Likely others.