Skip to content

Add StyleCop.Analyzers #1663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 14, 2025
Merged

Add StyleCop.Analyzers #1663

merged 3 commits into from
Apr 14, 2025

Conversation

manfred-brands
Copy link
Member

@manfred-brands manfred-brands commented Apr 13, 2025

Partly addresses #1590

Settings are taken from nunit framework project.

With the following exceptions:

  1. Braces are optional as per your preferences.
  2. The this. prefix is not defined yet.
    We can either leave it, or enforce the use of 'this.' or deny the the use of 'this.'.
    The latter has my preference.

Settings are taken from nunit framework project.
With the following exceptions:
1. Braces are optional.
2. The this. prefix is not defined
Copy link
Member

@CharliePoole CharliePoole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, not much to argue about here except for the two items I noted. But rather than dispute the principles, let's see if anyone gets annoyed by them.

That's my main guideline for enforced rules on a team: they should not annoy anyone. :-)

@@ -36,7 +37,8 @@ public static ProcessResult Run(ProcessStartInfo startInfo)
};
process.ErrorDataReceived += (sender, e) =>
{
if (e.Data == null) return;
if (e.Data == null)
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another kind of thing where I find the rule overly pedantic, but at least it doesn't force adding parens.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it starts to annoy you we can disable rule SA1501, but until them leave it.

public TestSelectionParserException(string message, Exception innerException) : base(message, innerException) { }
public TestSelectionParserException(string message, Exception innerException) : base(message, innerException)
{
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a number of these. Depending on what happens when I try to put the empty braces on the same line, I may get annoyed at StyleCop for not being smart enough to see that there is nothing in the braces so don't worry. :-)

But let's give it a go anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it starts to annoys you we can switch off rule SA1502.

@manfred-brands manfred-brands merged commit 41a45a9 into version4 Apr 14, 2025
4 checks passed
@manfred-brands manfred-brands deleted the version4_StyleCopAnalyzer branch April 14, 2025 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants