ReadabilityRules.md

April 12, 2019 ยท View on GitHub

Readability Rules (SA1100-)

Rules which ensure that the code is well-formatted and readable.

IdentifierNameDescription
SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExistsA call to a member from an inherited class begins with base., and the local class does not contain an override or implementation of the member.
SA1101PrefixLocalCallsWithThisA call to an instance member of the local class or a base class is not prefixed with 'this.', within a C# code file.
SA1102QueryClausesA C# query clause does not begin on the same line as the previous clause, or on the next line.
SA1103QueryClausesThe clauses within a C# query expression are not all placed on the same line, and each clause is not placed on its own line.
SA1104QueryClausesA clause within a C# query expression begins on the same line as the previous clause, when the previous clause spans across multiple lines.
SA1105QueryClausesA clause within a C# query expression spans across multiple lines, and does not begin on its own line.
SA1106CodeMustNotContainEmptyStatementsThe C# code contains an extra semicolon.
SA1107CodeMustNotContainMultipleStatementsOnOneLineThe C# code contains more than one statement on a single line.
SA1108BlockStatementsMustNotContainEmbeddedCommentsA C# statement contains a comment between the declaration of the statement and the opening brace of the statement.
SA1109BlockStatementsMustNotContainEmbeddedRegionsA C# statement contains a region tag between the declaration of the statement and the opening brace of the statement.
SA1110OpeningParenthesisMustBeOnDeclarationLineThe opening parenthesis or bracket in a call to a C# method or indexer, or the declaration of a method or indexer, is not placed on the same line as the method or indexer name.
SA1111ClosingParenthesisMustBeOnLineOfLastParameterThe closing parenthesis or bracket in a call to a C# method or indexer, or the declaration of a method or indexer, is not placed on the same line as the last parameter.
SA1112ClosingParenthesisMustBeOnLineOfOpeningParenthesisThe closing parenthesis or bracket in a call to a C# method or indexer, or the declaration of a method or indexer, is not placed on the same line as the opening bracket when the element does not take any parameters.
SA1113CommaMustBeOnSameLineAsPreviousParameterA comma between two parameters in a call to a C# method or indexer, or in the declaration of a method or indexer, is not placed on the same line as the previous parameter.
SA1114ParameterListMustFollowDeclarationThe start of the parameter list for a method or indexer call or declaration does not begin on the same line as the opening bracket, or on the line after the opening bracket.
SA1115ParameterMustFollowCommaA parameter within a C# method or indexer call or declaration does not begin on the same line as the previous parameter, or on the next line.
SA1116SplitParametersMustStartOnLineAfterDeclarationThe parameters to a C# method or indexer call or declaration span across multiple lines, but the first parameter does not start on the line after the opening bracket.
SA1117ParametersMustBeOnSameLineOrSeparateLinesThe parameters to a C# method or indexer call or declaration are not all on the same line or each on a separate line.
SA1118ParameterMustNotSpanMultipleLinesA parameter to a C# method or indexer, other than the first parameter, spans across multiple lines.
SA1120CommentsMustContainTextThe C# comment does not contain any comment text.
SA1121UseBuiltInTypeAliasThe code uses one of the basic C# types, but does not use the built-in alias for the type.
SA1122UseStringEmptyForEmptyStringsThe C# code includes an empty string, written as "".
SA1123DoNotPlaceRegionsWithinElementsThe C# code contains a region within the body of a code element.
SA1124DoNotUseRegionsThe C# code contains a region.
SA1125UseShorthandForNullableTypesThe Nullable type has been defined not using the C# shorthand.
SA1126PrefixCallsCorrectlyA call to a member is not prefixed with the 'this.', 'base.', 'object.' or 'typename.' prefix to indicate the intended method call, within a C# code file.
SA1127GenericTypeConstraintsMustBeOnOwnLineA generic constraint on a type or method declaration is on the same line as the declaration, within a C# code file.
SA1128ConstructorInitializerMustBeOnOwnLineA constructor initializer is on the same line as the constructor declaration, within a C# code file.
SA1129DoNotUseDefaultValueTypeConstructorA value type was constructed using the syntax new T().
SA1130UseLambdaSyntaxAn anonymous method was declared using the form delegate (parameters) { }, when a lambda expression would provide equivalent behavior with the syntax (parameters) => { }.
SA1131UseReadableConditionsA comparison was made between a variable and a literal or constant value, and the variable appeared on the right-hand side of the expression.
SA1132DoNotCombineFieldsTwo or more fields were declared in the same field declaration syntax.
SA1133DoNotCombineAttributesTwo or more attributes appeared within the same set of square brackets.
SA1134AttributesMustNotShareLineAn attribute is placed on the same line of code as another attribute or element.
SA1135UsingDirectivesMustBeQualifiedA using directive is not qualified.
SA1136EnumValuesShouldBeOnSeparateLinesMultiple enum values are placed on the same line of code.
SA1137ElementsShouldHaveTheSameIndentationTwo sibling elements which each start on their own line have different levels of indentation.
SA1139UseLiteralsSuffixNotationInsteadOfCastingUse literal suffix notation instead of casting.
SA1141UseTupleSyntaxUse tuple syntax instead of the underlying ValueTuple implementation type.
SA1142ReferToTupleElementsByNameAn element of a tuple was referenced by its metadata name when an element name is available.