Closed jeroenk closed 6 years ago
On 02/12/2017 16:24, Jeroen Ketema wrote:
StyleCop.Analyzers is the moral successor of StyleCop.
I disabled a number of warnings:
- Missing copyright header (our default copyright header is not detected)
- Require a space after |//| (this does not work with our copyright header)
Agree with the above two, though we could always change our default header so that it is detected. It might be nice to ensure that we always have a header.
- Enable the generation of XML documentation (there's hardly any in the code base)
Agreed.
- Always require |this| when accessing a member of the current class (we generally do not do this and does not seem worth fixing)
Agreed.
- Always require braces for compound statements (there are quite a few places where we violate this rule, and I do not think it always improves readability of the code)
I disagree with this one - personally I like to always have braces for compound statements. Your call.
Feel free to disagree with the above.
See above :-)
A
Even with the above rules disabled, we get about 2700 warnings (after having fixed around the same number already).
You can view, comment on, or merge this pull request online at:
https://github.com/mc-imperial/gpuverify/pull/11
Commit Summary
Add StyleCope.Analyzers support
Add a rule set for StyleCop suppressing some of its warnings
Replace xbuild by msbuild
File Changes
M .gitignore https://github.com/mc-imperial/gpuverify/pull/11/files#diff-0 (3)
M .travis/build_gpuverify.sh https://github.com/mc-imperial/gpuverify/pull/11/files#diff-1 (2)
M Documentation/developer_guide.rst https://github.com/mc-imperial/gpuverify/pull/11/files#diff-2 (4)
M GPUVerifyBoogieDriver/GPUVerifyBoogieDriver.csproj https://github.com/mc-imperial/gpuverify/pull/11/files#diff-3 (10)
A GPUVerifyBoogieDriver/packages.config https://github.com/mc-imperial/gpuverify/pull/11/files#diff-4 (4)
M GPUVerifyCruncher/GPUVerifyCruncher.csproj https://github.com/mc-imperial/gpuverify/pull/11/files#diff-5 (9)
A GPUVerifyCruncher/packages.config https://github.com/mc-imperial/gpuverify/pull/11/files#diff-6 (4)
M GPUVerifyLib/GPUVerifyLib.csproj https://github.com/mc-imperial/gpuverify/pull/11/files#diff-7 (8)
A GPUVerifyLib/packages.config https://github.com/mc-imperial/gpuverify/pull/11/files#diff-8 (4)
M GPUVerifyVCGen/GPUVerifyVCGen.csproj https://github.com/mc-imperial/gpuverify/pull/11/files#diff-9 (11)
A GPUVerifyVCGen/packages.config https://github.com/mc-imperial/gpuverify/pull/11/files#diff-10 (4)
A StyleCop.ruleset https://github.com/mc-imperial/gpuverify/pull/11/files#diff-11 (10)
Patch Links:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mc-imperial/gpuverify/pull/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AEhSXf6ngfR8BKtI45E2V2t9RfbatcmNks5s8XnHgaJpZM4QzXQt.
I disagree with this one - personally I like to always have braces for compound statements. Your call.
I debated this one with myself for quite a bit here. Usually I would always write them, but StyleCop also enforces the following formatting:
if (...)
{
...
}
So it can get a bit unreadable at some point.
Note that for something like:
foreach (...)
if (...)
...
StyleCop will still warn, and suggest braces for the foreach
, because the the if
-statement is multiline (this warning I left on).
Note that in the commit I added yesterday, I turned off several more warnings: multiple related to missing parts of xml documentation, and the warning that says that with a Debug.Assert
you should always provide not only a condition, but also a string with an error message. I actually like the latter warning a lot, but do not think we will realistically fix all these warnings.
I've disabled a few more rules (any feedback welcome):
With be above and my latest changes, we compile cleanly.
On 05/12/2017 23:28, Jeroen Ketema wrote:
I've disabled a few more rules (any feedback welcome):
- The rule that warns about multiple classes per file. This does not make a lot of sense for, e.g., the expression trees that we have in our interpreter.
- The rules that enforce a specific ordering for the members of a class, e.g. static methods before non-static ones. Although these rules make some sense, we have situations where the rules would require members that logically belong together to be far apart.
I'd keep the latter rule - what you say likely means that we should be splitting some big classes up into smaller classes, which might be a good thing.
A
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mc-imperial/gpuverify/pull/11#issuecomment-349476377, or mute the thread https://github.com/notifications/unsubscribe-auth/AEhSXYX-JKwQujBHwlmc_LF9V-BBPYLrks5s9dG5gaJpZM4QzXQt.
Nice!
A
On 05/12/2017 23:29, Jeroen Ketema wrote:
With be above and my latest changes, we compile cleanly.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mc-imperial/gpuverify/pull/11#issuecomment-349476525, or mute the thread https://github.com/notifications/unsubscribe-auth/AEhSXezAJ1d_WEJvdnqjCNN3EBg-jcTzks5s9dHjgaJpZM4QzXQt.
I'm going to disagree with re-enabling the ordering rules, because it leads to stupid stuff like:
And, yes, large classes probably do need to be refactored in a number of smaller ones.
Question: StyleCop now just produces warnings. I could raised that to the level of errors. Not sure what you do in other projects?
Ah, I had only been thinking about fields. I agree with you regarding methods.
Yes, we raise to errors so that the project’s CI fails - this forces the style to be kept up.
A
From: Jeroen Ketema notifications@github.com Sent: 06 December 2017 07:57:14 To: mc-imperial/gpuverify Cc: Donaldson, Alastair F; Comment Subject: Re: [mc-imperial/gpuverify] Add StyleCop.Analyzers support (#11)
I'm going to disagree with re-enabling the ordering rules, because it leads to stupid stuff like:
And, yes, large classes probably do need to be refactored in a number of smaller ones.
Question: StyleCop now just produces warnings. I could raised that to the level of errors. Not sure what you do in other projects?
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/mc-imperial/gpuverify/pull/11#issuecomment-349563033, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEhSXVW3gjL03vpLEhmU4N21GjboTkfPks5s9kjagaJpZM4QzXQt.
I've merged this under the assumption that we can always re-evaluate the disabled rules.
StyleCop.Analyzers is the moral successor of StyleCop.
I disabled a number of warnings:
//
(this does not work with our copyright header)this
when accessing a member of the current class (we generally do not do this and does not seem worth fixing)Feel free to disagree with the above.
Even with the above rules disabled, we get about 2700 warnings (after having fixed around the same number already).