Skip to content

neolution-ch2/Neolution.CodeAnalysis

 
 

Repository files navigation

Neolution Ruleset

Rule IDActionDescription/TitleReason/Remarks
S4055
CA1303
None Literals should not be passed as localized parameters Localization is not needed in every project and for every message. This rule disallows string literals everywhere e.g. for log messages, content that does not need to be translated etc.
S1451
SA1633
None Each source file should start with a header stating file ownership and the license which must be used to distribute the application Header is not needed for each file. The developers are not used to writing headers for each source code file. Furthermore, the default template of Visual Studio also comes without a header. Forcing this rule generates work without value. If the source code of a project will be distributed, the text can be added to each file individually at a later point in time to satisfy this rule.
SX1309
SX1309S
None A field name in C# does not begin with an underscore. Field names must not begin with an underscore. The `this.` qualifier is used in favor of the underscore
SX1101
IDE0003
None Do not prefix local calls with `this.`. Always prefix local calls with "this.". The "this." qualifier is used in favor of the underscore.
IDE0008 None Use explicit type Do not force explicit type usage. Prefer using the implicit type (var) but you can use the explicit type to improve reading flow and comprehension.
S1309 Info Track uses of in-source issue suppressions Suppressions should be allowed, but still tracked.
CA1014
S3992
S3990
None Mark assemblies with CLSCompliant It is not needed to mark assemblies with CLSCompliant. We actively use libraries that are not compliant. If we mark our assemblies as CLS compliant we cannot use these anymore.
S2221
CA1031
None "Exception" should not be caught when not required by called methods This rule probably originates from Java where you have to declare the Exception that will be throwed by a method and will subsequently being checked by the compiler.
CA2210 None Assemblies should have valid strong names Strong names are usually not needed for our typical deployments.
CA1020 None Avoid namespaces with few types It happens often that a namespace contains only a few classes, but is extended later during development. Merging it with some parent namespace at first and extracting to separate namespace later (when there are enough classes), is just a pain and unnecessary waste of time.
CA1024 None Use properties where appropriate Developers can make a correct decision when the property is a better option than a method.
CA2234
CA1056
S3996
S3994
None URI properties or parameters should not be strings Team decided to drop this rule due to inconveniences resulting from System.Uri not having a parameterless constructor.
S3235 None Redundant parentheses should not be used Team decided to drop this rule because most of the team members are used to write redundant parentheses.
CA2227
S4004
None Collection properties should be read only Team decided to drop this rule due to the additional effort that is needed to write methods that add items for these type of properties.
IDE0045
IDE0046
None Convert to conditional expression Conflicts with rule S3358.
CA1506 None Avoid excessive class coupling Even if this rule might sound useful, in practice it was generating too many false-positives. Also, EF LINQ Queries are very prone to this. Unit and Integration tests must setup and configure numerous dependencies.
S4018 None Generic methods should provide type parameters Using the generic argument as return type does not lead to bugs. Only when using the method, you need to write a little more explicit code.
CA1822 None Mark members as static We prefer S2325 over this rule.
SA1609 None PropertyDocumentationMustHaveValue The documentation of the value is doomed to become a hollow echo of the name and the summary.
SA1133 None DoNotCombineAttributes The team voted to deactivate this rule on 28.02.2019.
CA1308
S4040
None Normalize strings to uppercase Too many false positives for paths, URLs etc.
S1135 Info Track uses of "TODO" tags Still show it to the developer in his IDE.
CS1591 None Missing XML comment for publicly visible type or member 'Type_or_Member' Can be deactivated because SA1600 already checks for the XML comment.
IDE0058 None C# Expression value is never used Is reporting way too many false negatives.
S1541
CA1502
None Methods and properties should not be too complex Deactivated in favor of better rule S3776 (Cognitive Complexity of methods should not be too high).
SA1629 None Documentation text should end with a period Does not add too much quality and developers find it too annoying to comply with this.
IDE0065 None Misplaced using directive Placing using directives outside of the namespace conflicts with our code style.
CA1001 None Types that own disposable fields should be disposable Favor S2931 instead of this rule.
CA1307
S4058
None Overloads with a "StringComparison" parameter should be used. Generated too many false positives for EF queries.
CA2201 None Do not raise reserved exception types Deactivated in favor of S112
IDE0050 None Convert anonymous type to tuple Since tuple names cannot be resolved on runtime, this creates problematic false positives (e.g. Serialization).
IDE0001 None Name can be simplified Can lead to conflicting scenarios in the using directives with SA1135.
S103 None Lines should not be too long Dvelopers should be in charge to decide when the line is too long. Horizontal scrolling is not such a big issue anymore with todays display sizes and resolutions.
S109 Info Magic numbers should not be used Developers are advised to add a comment to demystify the meaning of such a number.
S2228 None Magic numbers should not be used This rule has been superseded by S106. (Specification)[https://jira.sonarsource.com/browse/RSPEC-2228]
SA1005 None Single line comments should begin with single space Dropped in favor of S125.
S1128
IDE0005
None Unnecessary using directive Dropped in favor of CS8019.
CA1062 None Validate arguments of public methods Dropped in favor of S3900.
CA1305 None Specify IFormatProvider Dropped in favor of S4056.
IDE0010 Info Add missing cases for switch The rule is not always desired, but the quick fix can be helpful,
IDE0052 None Unread "private" fields should be removed Dropped in favor of S4487
S1301 None "switch" statements should have at least 3 "case" clauses Removed based on team vote. Some developers prefer "switch" even if it has only one "case" clause.

Tests Ruleset

Rule IDActionDescription/TitleReason/Remarks.
CA1707 None Identifiers should not contain underscores We use underscores in test method names to make them easier to read.
S112 None Do not raise reserved exception types In Tests we should be able to raise any Exception we like.
CA1031 None Do not catch general exception types Since we can raise any Exception we like In Tests we should also be able to catch any Exception we like.
CA2000 None Dispose objects before losing scope Tests are never run continuously in a production environment. Resources are freed as soon as the Test run ends, so there is no need to worry about the pitfalls of not freeing resources.
S131 None "switch/Select" statements should contain a "default/Case Else" clauses There is no need for defensive programming in Tests
S126 None "if ... else if" constructs should end with "else" clauses There is no need for defensive programming in Tests

About

Code analyzers and rulesets used for Neolution projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published