A class has only static members but is not declared static
What it finds
A class whose members are all static is never meant to be instantiated; declaring it static says so and lets the compiler refuse instances and instance members. Classes that inherit, are abstract, partial, or have no members are left alone.
From the rule's source, static_holder_class.rs.
class Helperstx0 reports: Helpers has only static members but is not static{ public const int Max = 3; public static int Twice(int x) => x * 2;} static class Fine{ public static int Once(int x) => x;} class Mixed{ public static int A() => 1; public int B() => 2;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:static-holder-class" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:static-holder-class] reason="..."tx0 explain tx0/csharp:static-holder-class shows the same in the terminal. Found a false positive? Report it.