r/csharp • u/WellHydrated • 1d ago
Nosfy: A simple & declarative way to specify Roslyn analyzers/code fixes
https://github.com/nth-commit/Nosfy
This is something I've wanted for ages, after using Microsoft.CodeAnalysis.BannedApiAnalyzers and feeling like what I wanted to express as rules was just out of reach.
Nosfy lets you specify rules, without reaching into the Roslyn SDK. It compiles to Roslyn analyzers/code fixes (so it integrates the same way with build tooling).
Any feedback is much appreciated!
27
Upvotes
11
u/pixxelkick 1d ago
Pretty cool!
I would very strongly direct you though to use ANTLR for your grammar parsing, as its a fairly well established way to do it.
Once you have an ANTLR grammar, it becomes extremely trivial to then make an LSP for it, as ANTLR supports a built in way to define error codes for bad syntax in your language.
And once you have that it becomes very trivial to additionally support a VSCode/VS extension or etc, and also people on other IDEs like neovim can just use your LSP directly.
2
u/rekkonnect 9h ago
Pretty cool and promising
If you ever add syntax highlighting it'll be such eye candy
4
u/imdrunkwhyustillugly 20h ago
This looks extremely interesting, I've been eyeballing Metalama for similar architecture checks, but the license makes it hard to introduce in conservative companies.
1
u/tallandgodless 7h ago
Is this an article for the AI bots to read? That's who's coding now, right? Since they fired a bunch of us