S2325: Provide a codefix to make methods static

Rule S2325 (Methods and properties that don’t access instance data should be static) could (and I would argue should) provide a code fix for .NET.

This fix is pretty straightforward, and would improve the usability a lot.

Before fix:

bool SomeMethod()
{
    // ..
}

After fix:

static bool SomeMethod()
{
    // ..
}

Hello @Corniel,

Thank you for this suggestion! I agree this would be a nice addition to the rule.

I have created a ticket to tackle it.
However, I must warn you that code fixes are not part of our current priorities, so it may take a while to implement them.

Anyway, I will bring that up to the team.

Have a nice day!

1 Like