SonarAnalyzer Rule Specs

A browsable, filterable reference of every rule specification (RSPEC) shipped with the SonarAnalyzer for .NET.

Full description, code samples, type, severity and tags for each rule — generated from the sonar-dotnet repo.

Branch previews →

Rule specifications: id, language, title, type, severity and tags
RuleLanguageTitleTypeSeverityTags
S100C#Methods and properties should be named in PascalCaseCode smellMinorconvention
S1006C#Method overrides should not change parameter defaultsCode smellCriticalpitfall
S101C#Types should be named in PascalCaseCode smellMinorconvention
S103C#Lines should not be too longCode smellMajorconvention
S104C#Files should not have too many lines of codeCode smellMajorbrain-overload
S1048C#Finalizers should not throw exceptionsBugBlocker
S105C#Tabulation characters should not be usedCode smellMinorconvention
S106C#Standard outputs should not be used directly to log anythingCode smellMajorbad-practice
S1066C#Mergeable "if" statements should be combinedCode smellMajorclumsy
S1067C#Expressions should not be too complexCode smellCriticalbrain-overload
S107C#Methods should not have too many parametersCode smellMajorbrain-overload
S1075C#URIs should not be hardcodedCode smellMinor
S108C#Nested blocks of code should not be left emptyCode smellMajorsuspicious
S109C#Magic numbers should not be usedCode smellMajorbrain-overload
S110C#Inheritance tree of classes should not be too deepCode smellMajor
S1104C#Fields should not have public accessibilityCode smellMinorcwe
S1109C#A close curly brace should be located at the beginning of a lineCode smellMinorconvention
S1110C#Redundant pairs of parentheses should be removedCode smellMajorconfusing
S1116C#Empty statements should be removedCode smellMinorunused
S1117C#Local variables should not shadow class fields or propertiesCode smellMajorsuspicious, pitfall
S1118C#Utility classes should not have public constructorsCode smellMajordesign
S112C#General or reserved exceptions should never be thrownCode smellMajorcwe, error-handling
S1121C#Assignments should not be made from within sub-expressionsCode smellMajorcwe, suspicious
S1123C#"Obsolete" attributes should include explanationsCode smellMajorobsolete, bad-practice
S1125C#Boolean literals should not be redundantCode smellMinorclumsy
S1128C#Unnecessary "using" should be removedCode smellMinorunused
S113C#Files should end with a newlineCode smellMinorconvention
S1133C#Deprecated code should be removedCode smellInfoobsolete
S1134C#Track uses of "FIXME" tagsCode smellMajorcwe
S1135C#Track uses of "TODO" tagsCode smellInfocwe
S1144C#Unused private types or members should be removedCode smellMajorunused
S1147C#Exit methods should not be calledCode smellBlockercwe, suspicious
S1151C#"switch case" clauses should not have too many lines of codeCode smellMajorbrain-overload
S1155C#"Any()" should be used to test for emptinessCode smellMinorperformance
S1163C#Exceptions should not be thrown in finally blocksCode smellCriticalerror-handling, suspicious
S1168C#Empty arrays and collections should be returned instead of nullCode smellMajor
S1172C#Unused method parameters should be removedCode smellMajorunused
S1185C#Overriding members should do more than simply call the same member in the base classCode smellMinorredundant, clumsy
S1186C#Methods should not be emptyCode smellCriticalsuspicious
S1192C#String literals should not be duplicatedCode smellMinordesign
S1199C#Nested code blocks should not be usedCode smellMinorbad-practice
S1200C#Classes should not be coupled to too many other classesCode smellMajorbrain-overload
S1206C#"Equals(Object)" and "GetHashCode()" should be overridden in pairsBugMinorcwe
S121C#Control structures should use curly bracesCode smellCriticalpitfall
S1210C#"Equals" and the comparison operators should be overridden when implementing "IComparable"Code smellMinor
S1215C#"GC.Collect" should not be calledCode smellCriticalperformance, unpredictable, bad-practice
S122C#Statements should be on separate linesCode smellMajorconvention
S1226C#Method parameters, caught exceptions and foreach variables' initial values should not be ignoredBugMinor
S1227C#break statements should not be used except for switch casesCode smellMinor
S1244C#Floating point numbers should not be tested for equalityBugMajor
S125C#Sections of code should not be commented outCode smellMajorunused
S126C#"if ... else if" constructs should end with "else" clausesCode smellCritical
S1264C#A "while" loop should be used instead of a "for" loopCode smellMinorclumsy
S127C#"for" loop stop conditions should be invariantCode smellMajorpitfall
S1301C#"switch" statements should have at least 3 "case" clausesCode smellMinorbad-practice
S1309C#Track uses of in-source issue suppressionsCode smellInfo
S131C#"switch/Select" statements should contain a "default/Case Else" clausesCode smellCriticalcwe
S1312C#Logger fields should be "private static readonly"Code smellMinorconvention, logging
S1313C#IP addresses should not be hardcodedCode smellMinorformer-hotspot
S134C#Control flow statements "if", "switch", "for", "foreach", "while", "do" and "try" should not be nested too deeplyCode smellCriticalbrain-overload
S138C#Functions should not have too many lines of codeCode smellMajorbrain-overload
S1449C#Culture should be specified for "string" operationsCode smellMinorunpredictable
S1450C#Private fields only used as local variables in methods should become local variablesCode smellMinorpitfall
S1451C#Track lack of copyright and license headersCode smellBlockerconvention
S1479C#"switch" statements with many "case" clauses should have only one statementCode smellMajorbrain-overload
S1481C#Unused local variables should be removedCode smellMinorunused
S1541C#Methods and properties should not be too complexCode smellCriticalbrain-overload
S1607C#Tests should not be ignoredCode smellMajortests, bad-practice, confusing
S1643C#Strings should not be concatenated using '+' in a loopCode smellMinorperformance
S1656C#Variables should not be self-assignedBugMajor
S1659C#Multiple variables should not be declared on the same lineCode smellMinorconvention
S1694C#An abstract class should have both abstract and concrete methodsCode smellMinorconvention
S1696C#NullReferenceException should not be caughtCode smellMajorcwe, error-handling
S1698C#"==" should not be used when "Equals" is overriddenCode smellMinorcwe, suspicious
S1699C#Constructors should only call non-overridable methodsCode smellCriticalpitfall
S1751C#Loops with at most one iteration should be refactoredBugMajorconfusing, bad-practice
S1764C#Identical expressions should not be used on both sides of operatorsBugMajorsuspicious
S1821C#"switch" statements should not be nestedCode smellCriticalpitfall
S1848C#Objects should not be created to be dropped immediately without being usedBugMajor
S1854C#Unused assignments should be removedCode smellMajorcwe, unused
S1858C#"ToString()" calls should not be redundantCode smellMinorfinding, clumsy
S1862C#Related "if/else if" statements should not have the same conditionBugMajorunused, pitfall
S1871C#Two branches in a conditional structure should not have exactly the same implementationCode smellMajordesign, suspicious
S1905C#Redundant casts should not be usedCode smellMinorredundant, clumsy
S1939C#Inheritance list should not be redundantCode smellMinorclumsy
S1940C#Boolean checks should not be invertedCode smellMinorpitfall
S1944C#Invalid casts should be avoidedCode smellCriticalcwe, suspicious
S1994C#"for" loop increment clauses should modify the loops' countersCode smellCriticalconfusing
S2053C#Password hashing functions should use an unpredictable saltVulnerabilityCriticalcwe, symbolic-execution
S2068C#Credentials should not be hard-codedVulnerabilityMajorcwe, former-hotspot, secret
S2077C#SQL queries should not be dynamically formattedVulnerabilityMajorcwe, bad-practice, sql, former-hotspot
S2092C#Cookies should have the "secure" flagVulnerabilityMinorcwe, former-hotspot, privacy
S2094C#Classes should not be emptyCode smellMinorclumsy
S2114C#Collections should not be passed as arguments to their own methodsBugMajor
S2115C#A secure password should be used when connecting to a databaseVulnerabilityBlockercwe, secret
S2123C#Values should not be uselessly incrementedBugMajorunused
S2139C#Exceptions should be either logged or rethrown but not bothCode smellMajorlogging, error-handling
S2148C#Underscores should be used to make large numbers readableCode smellMinorconvention
S2156C#"sealed" classes should not have "protected" membersCode smellMinorconfusing
S2166C#Classes named like "Exception" should extend "Exception" or a subclassCode smellMajorconvention, error-handling, pitfall
S2178C#Short-circuit logic should be used in boolean contextsCode smellBlocker
S2183C#Integral numbers should not be shifted by zero or more than their number of bits-1BugMinor
S2184C#Results of integer division should not be assigned to floating point variablesBugMinorcwe, overflow
S2187C#Test classes should contain at least one test caseCode smellBlockertests, unused, confusing
S2190C#Loops and recursions should not be infiniteBugBlockersuspicious
S2197C#Modulus results should not be checked for direct equalityCode smellCriticalsuspicious
S2198C#Unnecessary mathematical comparisons should not be madeCode smellCriticalsuspicious
S2201C#Methods without side effects should not have their return values ignoredBugMajorsuspicious, confusing
S2219C#Runtime type checking should be simplifiedCode smellMinorclumsy
S2221C#"Exception" should not be caughtCode smellMinorcwe, error-handling
S2222C#Locks should be released on all pathsBugCriticalcwe, multi-threading, symbolic-execution
S2223C#Non-constant static fields should not be visibleCode smellCriticalpitfall
S2225C#"ToString()" method should not return nullBugMajorcwe
S2234C#Arguments should be passed in the same order as the method parametersCode smellMajor
S2245C#Pseudorandom number generators (PRNGs) should not be used in security contextsVulnerabilityMajorcwe, former-hotspot
S2251C#A "for" loop update clause should move the counter in the right directionBugMajor
S2252C#For-loop conditions should be true at least onceBugMajor
S2257C#Custom cryptographic algorithms should not be usedVulnerabilityCriticalcwe, former-hotspot
S2259C#Null pointers should not be dereferencedBugMajorcwe, symbolic-execution
S2275C#Composite format strings should not lead to unexpected behavior at runtimeBugBlocker
S2290C#Field-like events should not be virtualCode smellCritical
S2291C#Overflow checking should not be disabled for "Enumerable.Sum"Code smellCriticalerror-handling
S2292C#Trivial properties should be auto-implementedCode smellMinorclumsy
S2302C#"nameof" should be usedCode smellCriticalbad-practice
S2306C#"async" and "await" should not be used as identifiersCode smellBlockerpitfall
S2325C#Methods and properties that don't access instance data should be staticCode smellMinorpitfall
S2326C#Unused type parameters should be removedCode smellMajorunused
S2327C#"try" statements with identical "catch" and/or "finally" blocks should be mergedCode smellMajorclumsy
S2328C#"GetHashCode" should not reference mutable fieldsBugMinor
S2330C#Array covariance should not be usedCode smellCriticalpitfall
S2333C#Redundant modifiers should not be usedCode smellMinorunused, finding, clumsy
S2339C#Public constant members should not be usedCode smellCriticalpitfall
S2342C#Enumeration types should comply with a naming conventionCode smellMinorconvention
S2344C#Enumeration type names should not have "Flags" or "Enum" suffixesCode smellMinorconvention
S2345C#Flags enumerations should explicitly initialize all their membersBugMinor
S2346C#Flags enumerations zero-value members should be named "None"Code smellCriticalconvention
S2357C#Fields should be privateCode smellMajorpitfall
S2360C#Optional parameters should not be usedCode smellCriticalpitfall
S2365C#Properties should not make collection or array copiesCode smellCriticalapi-design, performance
S2368C#Public methods should not have multidimensional array parametersCode smellBlockerpitfall
S2372C#Exceptions should not be thrown from property gettersCode smellMajorerror-handling
S2376C#Write-only properties should not be usedCode smellMajorpitfall
S2386C#Mutable fields should not be "public static"Code smellMinorcwe, unpredictable
S2387C#Child class fields should not shadow parent class fieldsCode smellBlocker
S2436C#Types and methods should not have too many generic parametersCode smellMajorbrain-overload
S2437C#Unnecessary bit operations should not be performedCode smellBlockersuspicious
S2445C#Blocks should be synchronized on read-only fieldsBugMajorcwe, multi-threading
S2479C#Whitespace and control characters in string literals should be explicitCode smellCriticalpitfall
S2486C#Generic exceptions should not be ignoredCode smellMinorcwe, error-handling, suspicious
S2551C#Shared resources should not be used for lockingBugCriticalmulti-threading
S2583C#Conditionally executed code should be reachableBugMajorcwe, unused, suspicious, pitfall, symbolic-execution
S2589C#Boolean expressions should not be gratuitousCode smellMajorcwe, suspicious, redundant, symbolic-execution
S2612C#File permissions should not be set to world-accessible valuesVulnerabilityMajorcwe, former-hotspot
S2629C#Logging templates should be constantCode smellMajorperformance, logging
S2674C#The length returned from a stream read should be checkedBugMinor
S2681C#Multiline blocks should be enclosed in curly bracesCode smellMajorcwe
S2688C#"NaN" should not be used in comparisonsBugMajor
S2692C#"IndexOf" checks should not be for positive numbersCode smellCriticalsuspicious
S2696C#Instance members should not write to "static" fieldsCode smellCriticalmulti-threading
S2699C#Tests should include assertionsCode smellBlockertests
S2701C#Literal boolean values should not be used in assertionsCode smellCriticaltests
S2737C#"catch" clauses should do more than rethrowCode smellMinorerror-handling, unused, finding, clumsy
S2743C#Static fields should not be used in generic typesCode smellMajor
S2755C#XML parsers should not be vulnerable to XXE attacksVulnerabilityBlockercwe
S2757C#Non-existent operators like "=+" should not be usedBugMajor
S2760C#Sequential tests should not check the same conditionCode smellMinorsuspicious, clumsy
S2761C#Doubled prefix operators "!!" and "~~" should not be usedBugMajor
S2857C#SQL keywords should be delimited by whitespaceBugBlockersql
S2925C#"Thread.Sleep" should not be used in testsCode smellMajortests, bad-practice
S2930C#"IDisposables" should be disposedBugBlockercwe, denial-of-service
S2931C#Classes with "IDisposable" members should implement "IDisposable"BugBlockercwe, denial-of-service
S2933C#Fields that are only assigned in the constructor should be "readonly"Code smellMajorconfusing
S2934C#Property assignments should not be made for "readonly" fields not constrained to reference typesBugMinor
S2952C#Classes should "Dispose" of members from the classes' own "Dispose" methodsBugCriticalcwe, denial-of-service
S2953C#Methods named "Dispose" should implement "IDisposable.Dispose"Code smellBlockerpitfall
S2955C#Generic parameters not constrained to reference types should not be compared to "null"BugMinor
S2970C#Assertions should be completeCode smellBlockertests
S2971C#LINQ expressions should be simplifiedCode smellMajorclumsy
S2995C#"Object.ReferenceEquals" should not be used for value typesBugMajor
S2996C#"ThreadStatic" fields should not be initializedBugMajormulti-threading
S2997C#"IDisposables" created in a "using" statement should not be returnedBugMajor
S3005C#"ThreadStatic" should not be used on non-static fieldsBugMajorunused
S3010C#Static fields should not be updated in constructorsCode smellMajor
S3011C#Reflection should not be used to increase accessibility of classes, methods, or fieldsCode smellMajor
S3052C#Members should not be initialized to default valuesCode smellMinorconvention, finding
S3059C#Types should not have members with visibility set higher than the type's visibilityCode smellMajorconfusing
S3060C#"is" should not be used with "this"Code smellBlockerapi-design, bad-practice
S3063C#"StringBuilder" data should be usedCode smellMajorperformance
S3168C#"async" methods should not return "void"BugMajormulti-threading, async-await
S3169C#Multiple "OrderBy" calls should not be usedCode smellMajorperformance
S3172C#Delegates should not be subtractedBugMajor
S3215C#"interface" instances should not be cast to concrete typesCode smellCriticaldesign
S3216C#"ConfigureAwait(false)" should be usedCode smellCriticalmulti-threading, async-await, suspicious, performance
S3217C#"Explicit" conversions of "foreach" loops should not be usedCode smellCriticalsuspicious
S3218C#Inner class members should not shadow outer class "static" or type membersCode smellCriticaldesign, pitfall
S3220C#Method calls should not resolve ambiguously to overloads with "params"Code smellMinorpitfall
S3234C#"GC.SuppressFinalize" should not be invoked for types without destructorsCode smellMinorunused, confusing
S3235C#Redundant parentheses should not be usedCode smellMinorunused, finding
S3236C#Caller information arguments should not be provided explicitlyCode smellMinorsuspicious
S3237C#"value" contextual keyword should be usedCode smellBlockerpitfall
S3240C#The simplest possible condition syntax should be usedCode smellMinorclumsy
S3241C#Methods should not return values that are never usedCode smellMinordesign, unused
S3242C#Method parameters should be declared with base typesCode smellMinorapi-design
S3244C#Anonymous delegates should not be used to unsubscribe from EventsBugMajor
S3246C#Generic type parameters should be co/contravariant when possibleCode smellMajorapi-design
S3247C#Duplicate casts should not be madeCode smellMinorperformance
S3249C#Classes directly extending "object" should not call "base" in "GetHashCode" or "Equals"BugMajor
S3251C#Implementations should be provided for "partial" methodsCode smellMinorsuspicious
S3253C#Constructor and destructor declarations should not be redundantCode smellMinorfinding, clumsy
S3254C#Default parameter values should not be passed as argumentsCode smellMinorfinding, clumsy
S3256C#"string.IsNullOrEmpty" should be usedCode smellMinorclumsy
S3257C#Declarations and initializations should be as concise as possibleCode smellMinorfinding, clumsy
S3260C#Non-derived "private" classes and records should be "sealed"Code smellMinorperformance
S3261C#Namespaces should not be emptyCode smellMinorunused
S3262C#"params" should be used on overridesCode smellMajorconfusing
S3263C#Static fields should appear in the order they must be initialized BugMajor
S3264C#Events should be invokedCode smellMajorunused
S3265C#Non-flags enums should not be used in bitwise operationsCode smellCriticalconvention
S3267C#Loops should be simplified with "LINQ" expressionsCode smellMinor
S3329C#Cipher Block Chaining IVs should be unpredictableVulnerabilityCriticalcwe, symbolic-execution
S3330C#Cookies should have the "HttpOnly" flagVulnerabilityMinorcwe, privacy, former-hotspot
S3343C#Caller information parameters should come at the end of the parameter listBugMajorapi-design
S3346C#Expressions used in "Debug.Assert" should not produce side effectsBugMajor
S3353C#Unchanged variables should be marked as "const"Code smellCriticalperformance
S3358C#Ternary operators should not be nestedCode smellMajorconfusing
S3363C#Date and time should not be used as a type for primary keysBugMinor
S3366C#"this" should not be exposed from constructorsCode smellMajormulti-threading, suspicious
S3376C#Attribute, EventArgs, and Exception type names should end with the type being extendedCode smellMinorconvention
S3397C#"base.Equals" should not be used to check for reference equality in "Equals" if "base" is not "object"BugMinor
S3398C#"private" methods called only by inner classes should be moved to those classesCode smellMinorconfusing
S3400C#Methods should not return constantsCode smellMinorconfusing
S3415C#Assertion arguments should be passed in the correct orderCode smellMajortests, suspicious
S3416C#Loggers should be named for their enclosing typesCode smellMinorconfusing, logging
S3427C#Method overloads with default parameter values should not overlapCode smellBlockerunused, pitfall
S3431C#"[ExpectedException]" should not be usedCode smellMajortests
S3433C#Test method signatures should be correctCode smellBlockertests
S3440C#Variables should not be checked against the values they're about to be assignedCode smellMinorconfusing
S3441C#Redundant property names should be omitted in anonymous classesCode smellMinorfinding, clumsy
S3442C#"abstract" classes should not have "public" constructorsCode smellMajorconfusing
S3443C#Type should not be examined on "System.Type" instancesCode smellBlockersuspicious
S3444C#Interfaces should not simply inherit from base interfaces with colliding membersCode smellMinordesign
S3445C#Exceptions should not be explicitly rethrownCode smellMajorerror-handling, confusing
S3447C#"[Optional]" should not be used on "ref" or "out" parametersCode smellCriticalpitfall
S3449C#Right operands of shift operators should be integersBugCritical
S3450C#Parameters with "[DefaultParameterValue]" attributes should also be marked "[Optional]"Code smellMinorpitfall
S3451C#"[DefaultValue]" should not be used when "[DefaultParameterValue]" is meantCode smellCriticalsuspicious
S3453C#Classes should not have only "private" constructorsBugMajordesign
S3456C#"string.ToCharArray()" and "ReadOnlySpan<T>.ToArray()" should not be called redundantlyBugMinorclumsy
S3457C#Composite format strings should be used correctlyCode smellMajorconfusing
S3458C#Empty "case" clauses that fall through to the "default" should be omittedCode smellMinorfinding, clumsy
S3459C#Unassigned members should be removedCode smellMinorsuspicious
S3464C#Type inheritance should not be recursiveBugBlocker
S3466C#Optional parameters should be passed to "base" callsBugMajor
S3532C#Empty "default" clauses should be removedCode smellMinorunused, finding, clumsy
S3597C#"ServiceContract" and "OperationContract" attributes should be used togetherCode smellMajorapi-design
S3598C#One-way "OperationContract" methods should have "void" return typeBugMajor
S3600C#"params" should not be introduced on overridesCode smellCriticalconfusing
S3603C#Methods with "Pure" attribute should return a value BugMajor
S3604C#Member initializer values should not be redundantCode smellMinor
S3610C#Nullable type comparison should not be redundantBugMajorredundant
S3626C#Jump statements should not be redundantCode smellMinorredundant, clumsy
S3655C#Empty nullable value should not be accessedBugMajorcwe, symbolic-execution
S3717C#Track use of "NotImplementedException"Code smellMinor
S3776C#Cognitive Complexity of methods should not be too highCode smellCriticalbrain-overload
S3869C#"SafeHandle.DangerousGetHandle" should not be calledBugBlockerleak, unpredictable
S3871C#Exception types should be "public"Code smellCriticalerror-handling, api-design
S3872C#Parameter names should not duplicate the names of their methodsCode smellMinorconvention, confusing
S3874C#"out" and "ref" parameters should not be usedCode smellCriticalsuspicious
S3875C#"operator==" should not be overloaded on reference typesCode smellBlockerpitfall
S3876C#Strings or integral types should be used for indexersCode smellMinordesign
S3877C#Exceptions should not be thrown from unexpected methodsCode smellBlockerpitfall
S3878C#Arrays should not be created for params parametersCode smellMinorclumsy
S3880C#Finalizers should not be emptyCode smellMajorperformance
S3881C#"IDisposable" should be implemented correctlyCode smellMajorpitfall
S3884C#"CoSetProxyBlanket" and "CoInitializeSecurity" should not be usedVulnerabilityBlocker
S3885C#"Assembly.Load" should be usedCode smellMajorunpredictable
S3887C#Mutable, non-private fields should not be "readonly"BugMinor
S3889C#"Thread.Resume" and "Thread.Suspend" should not be usedBugBlockermulti-threading, unpredictable
S3897C#Classes that provide "Equals(<T>)" should implement "IEquatable<T>"Code smellMinorapi-design
S3898C#Value types should implement "IEquatable<T>"Code smellMajorperformance
S3900C#Arguments of public methods should be validated against nullCode smellMajorconvention, symbolic-execution
S3902C#"Assembly.GetExecutingAssembly" should not be calledCode smellMajorperformance
S3903C#Types should be defined in named namespacesBugMajor
S3904C#Assemblies should have version informationCode smellCriticalpitfall
S3906C#Event Handlers should have the correct signatureCode smellMajorconvention
S3908C#Generic event handlers should be usedCode smellMajor
S3909C#Collections should implement the generic interfaceCode smellMajor
S3923C#All branches in a conditional structure should not have exactly the same implementationBugMajor
S3925C#"ISerializable" should be implemented correctlyCode smellMajorpitfall
S3926C#Deserialization methods should be provided for "OptionalField" membersBugMajorserialization
S3927C#Serialization event handlers should be implemented correctlyBugMajor
S3928C#Parameter names used into ArgumentException constructors should match an existing one Code smellMajor
S3937C#Number patterns should be regularCode smellCriticalsuspicious
S3949C#Calculations should not overflowBugMajoroverflow, symbolic-execution
S3956C#"Generic.List" instances should not be part of public APIsCode smellMajorapi-design
S3962C#"static readonly" constants should be "const" insteadCode smellMinorperformance
S3963C#"static" fields should be initialized inlineCode smellMinor
S3966C#Objects should not be disposed more than onceCode smellMajorconfusing, pitfall, symbolic-execution
S3967C#Multidimensional arrays should not be usedCode smellMinordesign
S3971C#"GC.SuppressFinalize" should not be calledCode smellMajor
S3972C#Conditionals should start on new linesCode smellCriticalsuspicious
S3973C#A conditionally executed single line should be denoted by indentationCode smellCriticalconfusing, suspicious
S3981C#Collection sizes and array length comparisons should make senseBugMajorconfusing
S3984C#Exceptions should not be created without being thrownBugMajorerror-handling
S3990C#Assemblies should be marked as CLS compliantCode smellMajorapi-design
S3992C#Assemblies should explicitly specify COM visibilityCode smellMajorapi-design
S3993C#Custom attributes should be marked with "System.AttributeUsageAttribute"Code smellMajorapi-design
S3994C#URI Parameters should not be stringsCode smellMajor
S3995C#URI return values should not be stringsCode smellMajor
S3996C#URI properties should not be stringsCode smellMajor
S3997C#String URI overloads should call "System.Uri" overloadsCode smellMajor
S3998C#Threads should not lock on objects with weak identityCode smellCriticalmulti-threading, pitfall
S4000C#Pointers to unmanaged memory should not be visibleCode smellCritical
S4002C#Disposable types should declare finalizersCode smellMajor
S4004C#Collection properties should be readonlyCode smellMajor
S4005C#"System.Uri" arguments should be used instead of stringsCode smellMajor
S4015C#Inherited member visibility should not be decreasedCode smellCriticalpitfall
S4016C#Enumeration members should not be named "Reserved"Code smellMajor
S4017C#Method signatures should not contain nested generic typesCode smellMajorconfusing
S4018C#All type parameters should be used in the parameter list to enable type inferenceCode smellMinor
S4019C#Base class methods should not be hiddenCode smellCriticalpitfall
S4022C#Enumerations should have "Int32" storageCode smellMinor
S4023C#Interfaces should not be emptyCode smellMinor
S4025C#Child class fields should not differ from parent class fields only by capitalizationCode smellCriticalpitfall
S4026C#Assemblies should be marked with "NeutralResourcesLanguageAttribute"Code smellMinorperformance
S4027C#Exceptions should provide standard constructorsCode smellMinorconvention
S4035C#Classes implementing "IEquatable<T>" should be sealedCode smellMajorpitfall
S4036C#OS commands should not rely on PATH resolutionVulnerabilityMinorcwe, former-hotspot
S4039C#Interface methods should be callable by derived typesCode smellCriticalpitfall
S4040C#Strings should be normalized to uppercaseCode smellMinorpitfall
S4041C#Type names should not match namespacesCode smellMinorconvention
S4047C#Generics should be used when appropriateCode smellMinor
S4049C#Properties should be preferredCode smellMinorconvention
S4050C#Operators should be overloaded consistentlyCode smellMajorpitfall
S4052C#Types should not extend outdated base typesCode smellMinor
S4055C#Literals should not be passed as localized parametersCode smellMajorlocalisation, pitfall
S4056C#Overloads with a "CultureInfo" or an "IFormatProvider" parameter should be usedCode smellMinorlocalisation, pitfall
S4057C#Locales should be set for data typesCode smellMajorlocalisation
S4058C#Overloads with a "StringComparison" parameter should be usedCode smellMinor
S4059C#Property names should not match get methodsCode smellMajorconfusing
S4060C#Non-abstract attributes should be sealedCode smellMinorperformance
S4061C#"params" should be used instead of "varargs"Code smellMinor
S4069C#Operator overloads should have named alternativesCode smellMinorconvention
S4070C#Non-flags enums should not be marked with "FlagsAttribute"Code smellMajor
S4136C#Method overloads should be grouped togetherCode smellMinorconvention
S4143C#Collection elements should not be replaced unconditionallyBugMajorsuspicious
S4144C#Methods should not have identical implementationsCode smellMajorconfusing, duplicate, suspicious
S4158C#Empty collections should not be accessed or iteratedBugMinorsymbolic-execution
S4159C#Classes should implement their "ExportAttribute" interfacesBugBlockermef, pitfall
S4200C#Native methods should be wrappedCode smellMajorpitfall
S4201C#Null checks should not be combined with "is" operator checksCode smellMinorredundant
S4210C#Windows Forms entry points should be marked with STAThreadBugMajorwinforms, pitfall
S4211C#Members should not have conflicting transparency annotationsVulnerabilityMajorpitfall
S4212C#Serialization constructors should be securedVulnerabilityMajorserialization
S4214C#"P/Invoke" methods should not be visibleCode smellMajor
S4220C#Events should have proper argumentsCode smellMajorevent, pitfall
S4225C#Extension methods should not extend "object"Code smellMinor
S4226C#Extensions should be in separate namespacesCode smellMinorconfusing
S4260C#"ConstructorArgument" parameters should exist in constructorsBugMajorxaml, wpf
S4261C#Methods should be named according to their synchronicitiesCode smellMinor
S4275C#Getters and setters should access the expected fieldsBugCriticalpitfall
S4277C#"Shared" parts should not be created with "new"BugCriticalmef, pitfall
S4347C#Secure random number generators should not output predictable valuesVulnerabilityCriticalcwe, pitfall, symbolic-execution
S4423C#Weak SSL/TLS protocols should not be usedVulnerabilityCriticalcwe, privacy
S4426C#Cryptographic keys should be robustVulnerabilityCriticalcwe, privacy
S4428C#"PartCreationPolicyAttribute" should be used with "ExportAttribute"BugMajormef, pitfall
S4433C#LDAP connections should be authenticatedVulnerabilityCriticalcwe
S4456C#Parameter validation in yielding methods should be wrappedCode smellMajoryield
S4457C#Parameter validation in "async"/"await" methods should be wrappedCode smellMajorasync-await
S4462C#Calls to "async" methods should not be blockingCode smellBlockerasync-await, deadlock
S4487C#Unread "private" fields should be removedCode smellCriticalcwe, unused
S4502C#CSRF protections should not be disabledVulnerabilityCriticalcwe, former-hotspot
S4507C#Debugging features should not be enabled in productionVulnerabilityMinorcwe, error-handling, debug, user-experience, former-hotspot
S4524C#"default" clauses should be first or lastCode smellCritical
S4545C#"DebuggerDisplayAttribute" strings should reference existing membersCode smellMajor
S4581C#"new Guid()" should not be usedCode smellMajor
S4583C#Calls to delegate's method "BeginInvoke" should be paired with calls to "EndInvoke"BugCritical
S4586C#Non-async "Task/Task<T>" methods should not return nullBugCriticalasync-await
S4635C#Start index should be used instead of calling SubstringCode smellCriticalperformance
S4663C#Comments should not be emptyCode smellMinor
S4790C#Weak hashing algorithms should not be usedVulnerabilityCriticalcwe, former-hotspot
S4830C#Server certificates should be verified during SSL/TLS connectionsVulnerabilityCriticalcwe, privacy, ssl
S5034C#"ValueTask" should be consumed correctlyCode smellCriticalasync-await
S5042C#Expanding archive files should not be done without controlling resource consumptionCode smellMajorcwe, former-hotspot
S5122C#Cross-Origin Resource Sharing (CORS) policy should be restricted to trusted originsVulnerabilityMajorcwe, former-hotspot
S5332C#Clear-text protocols should not be usedVulnerabilityMinorcwe, former-hotspot
S5344C#Passwords should not be stored in plaintext or with a fast hashing algorithmVulnerabilityCriticalcwe, spring
S5443C#Temporary files should not be created in publicly writable directoriesVulnerabilityCriticalcwe, former-hotspot
S5445C#Insecure temporary file creation methods should not be usedVulnerabilityCriticalcwe
S5542C#Encryption algorithms should be used with secure mode and padding schemeVulnerabilityCriticalcwe, privacy
S5547C#Cipher algorithms should be robustVulnerabilityCriticalcwe, privacy
S5659C#JWT should be signed and verified with strong cipher algorithmsVulnerabilityCriticalcwe, privacy
S5693C#HTTP request content length should be limitedVulnerabilityMajorcwe, former-hotspot
S5753C#ASP.NET Request Validation should not be disabledVulnerabilityMajorcwe, former-hotspot
S5766C#Serializable objects should validate data during deserializationVulnerabilityMajorcwe, former-hotspot
S5773C#Types allowed to be deserialized should be restrictedVulnerabilityMajorcwe, symbolic-execution
S5856C#Regular expressions should be syntactically validBugCriticalregex
S6354C#Use a testable date/time providerCode smellMajor
S6377C#XML signatures should be validated securelyVulnerabilityMajor
S6418C#Secrets should not be hard-codedVulnerabilityBlockercwe, former-hotspot, secret
S6419C#Azure Functions should be statelessCode smellMajorazure, bad-practice
S6420C#Client instances should not be recreated on each Azure Function invocationCode smellMajorazure, bad-practice, design
S6421C#Azure Functions should use Structured Error HandlingCode smellMajorazure, error-handling
S6422C#Calls to "async" methods should not be blocking in Azure FunctionsCode smellBlockerazure, async-await
S6423C#Azure Functions should log all failuresCode smellMajorazure, error-handling
S6424C#Interfaces for durable entities should satisfy the restrictionsCode smellBlockerazure, design
S6444C#Regular expressions should be executed with a timeoutVulnerabilityMinorcwe, regex, former-hotspot
S6507C#Blocks should not be synchronized on local variablesBugMajorcwe, multi-threading
S6513C#"ExcludeFromCodeCoverage" attributes should include a justificationCode smellMinorbad-practice
S6561C#Avoid using "DateTime.Now" for benchmarking or timing operationsCode smellMajor
S6562C#Always set the "DateTimeKind" when creating new "DateTime" instancesCode smellMajorlocalisation, pitfall
S6563C#Use UTC when recording DateTime instantsCode smellMajorpitfall
S6566C#Use "DateTimeOffset" instead of "DateTime"Code smellMajor
S6575C#Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter"Code smellMajor
S6580C#Use a format provider when parsing date and timeCode smellMajorpitfall, bug
S6585C#Don't hardcode the format when turning dates and times to stringsCode smellMinor
S6588C#Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epochCode smellMinor
S6602C#"Find" method should be used instead of the "FirstOrDefault" extensionCode smellMinorperformance
S6603C#The collection-specific "TrueForAll" method should be used instead of the "All" extensionCode smellMinorperformance
S6605C#Collection-specific "Exists" method should be used instead of the "Any" extensionCode smellMinorperformance
S6607C#The collection should be filtered before sorting by using "Where" before "OrderBy"Code smellMinorperformance
S6608C#Prefer indexing instead of "Enumerable" methods on types implementing "IList"Code smellMinorperformance
S6609C#"Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methodsCode smellMinorperformance
S6610C#"StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string"Code smellMinorperformance
S6612C#The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methodsCode smellMinorperformance
S6613C#"First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methodsCode smellMinorperformance
S6617C#"Contains" should be used instead of "Any" for simple equality checksCode smellMinorperformance
S6618C#"string.Create" should be used instead of "FormattableString"Code smellMinorperformance
S6640C#Unsafe code blocks should not be usedVulnerabilityMajorformer-hotspot
S6664C#The code block contains too many logging callsCode smellMinorlogging
S6667C#Logging in a catch clause should pass the caught exception as a parameter.Code smellMinorerror-handling, logging
S6668C#Logging arguments should be passed to the correct parameterCode smellMinorlogging
S6669C#Logger field or property name should comply with a naming conventionCode smellMinorlogging
S6670C#"Trace.Write" and "Trace.WriteLine" should not be usedCode smellMinorlogging
S6672C#Generic logger injection should match enclosing typeCode smellMinorconfusing, logging
S6673C#Log message template placeholders should be in the right orderCode smellMajorlogging
S6674C#Log message template should be syntactically correctBugCriticallogging
S6675C#"Trace.WriteLineIf" should not be used with "TraceSwitch" levelsCode smellMinorconfusing, clumsy, logging
S6677C#Message template placeholders should be uniqueBugMajorlogging
S6678C#Use PascalCase for named placeholdersCode smellMinorlogging
S6781C#JWT secret keys should not be disclosedVulnerabilityBlockercwe, secret, symbolic-execution
S6797C#Blazor query parameter type should be supportedBugMajorblazor
S6798C#[JSInvokable] attribute should only be used on public methodsBugMajorblazor
S6800C#Component parameter type should match the route parameter type constraintBugMajorblazor
S6802C#Using lambda expressions in loops should be avoided in Blazor markup sectionCode smellMajorblazor
S6803C#Parameters with SupplyParameterFromQuery attribute should be used only in routable componentsCode smellMajorblazor
S6930C#Backslash should be avoided in route templatesBugMajorasp.net
S6931C#ASP.NET controller actions should not have a route template starting with "/"Code smellMajorasp.net
S6932C#Use model binding instead of reading raw request dataCode smellMajorasp.net
S6934C#A Route attribute should be added to the controller when a route template is specified at the action levelCode smellMajorasp.net
S6960C#Controllers should not have mixed responsibilitiesCode smellMajorasp.net
S6961C#API Controllers should derive from ControllerBase instead of ControllerCode smellMajorasp.net, performance
S6962C#You should pool HTTP connections with HttpClientFactoryCode smellMajorasp.net
S6964C#Value type property used as input in a controller action should be nullable, required or annotated with the JsonRequiredAttribute to avoid under-posting.Code smellMajorasp.net
S6965C#REST API actions should be annotated with an HTTP verb attributeCode smellMajorasp.net
S6966C#Awaitable method should be usedCode smellMajorasync-await
S6967C#ModelState.IsValid should be called in controller actionsCode smellCriticalasp.net
S6968C#Actions that return a value should be annotated with ProducesResponseTypeAttribute containing the return typeCode smellMajorasp.net
S7039C#Content Security Policies should be restrictiveVulnerabilityMajor
S7130C#First/Single should be used instead of FirstOrDefault/SingleOrDefault on collections that are known to be non-emptyCode smellMajorsymbolic-execution
S7131C#A write lock should not be released when a read lock has been acquired and vice versaBugCriticalsymbolic-execution
S7133C#Locks should be released within the same methodBugCriticalsymbolic-execution
S818C#Literal suffixes should be upper caseCode smellMinorconvention, pitfall
S8367C#Identifiers should not conflict with the C# 14 "field" contextual keywordCode smellCriticalcsharp-14, compatibility, upgrade
S8368C#Identifiers should not conflict with the C# 14 "extension" contextual keywordCode smellCriticalcsharp14, breaking-change, contextual-keyword
S8380C#Return types named "partial" should be escaped with "@"Code smellCriticalbreaking-change, csharp14
S8381C#"scoped" should be escaped when used as an identifier or type name in parenthesized lambda parameter listsCode smellCriticalcsharp14, breaking-change, lambda
S8717C#Multiple "[Key]" attributes should not be used to define a composite keyBugBlockerentity-framework-core, entity-framework, orm, database
S8718C#Client-evaluated default values should use database functionsBugBlockerentity-framework-core, entity-framework, database, orm
S8733C#Potential Cartesian ExplosionBugMajorentity-framework-core, entity-framework, database, orm, performance
S8747C#Migrations should not narrow column types without converting existing dataBugMajorentity-framework-core, entity-framework, orm, database, migration
S881C#Increment (++) and decrement (--) operators should not be used in a method call or mixed with other operators in an expressionCode smellMajor
S8949C#The overload accepting a 'CancellationToken' should be usedBugMajorasync, concurrency, performance
S8969C#Null-forgiving operators should not be redundantCode smellMinorredundant
S8970C#Null-forgiving operators should not be used when nullable warnings are disabledCode smellMinorredundant
S9022C#Redundant "Include" calls should be removedCode smellMinorentity-framework-core, entity-framework, orm, database
S907C#"goto" statement should not be usedCode smellMajorbrain-overload
S9118C#Default values should be compatible with their entity property typeBugMajorentity-framework-core, entity-framework, database, orm
S9129C#"Include" and "ThenInclude" chains of reference navigations should be merged into a single "Include" callCode smellMinorentity-framework-core, entity-framework, orm, database
S927C#Parameter names should match base declaration and other partial definitionsCode smellCriticalsuspicious
S101VB.NETClass names should comply with a naming conventionCode smellMinorconvention
S103VB.NETLines should not be too longCode smellMajorconvention
S104VB.NETFiles should not have too many lines of codeCode smellMajorbrain-overload
S1048VB.NETFinalize method should not throw exceptionsBugBlocker
S105VB.NETTabulation characters should not be usedCode smellMinorconvention
S1066VB.NETMergeable "if" statements should be combinedCode smellMajorclumsy
S1067VB.NETExpressions should not be too complexCode smellCriticalbrain-overload
S107VB.NETProcedures should not have too many parametersCode smellMajorbrain-overload
S1075VB.NETURIs should not be hardcodedCode smellMinor
S108VB.NETNested blocks of code should not be left emptyCode smellMajorsuspicious
S1110VB.NETRedundant pairs of parentheses should be removedCode smellMajorconfusing
S112VB.NETGeneral or reserved exceptions should never be thrownCode smellMajorcwe, error-handling
S1123VB.NET"Obsolete" attributes should include explanationsCode smellMajorobsolete, bad-practice
S1125VB.NETBoolean literals should not be redundantCode smellMinorclumsy
S1133VB.NETDeprecated code should be removedCode smellInfoobsolete
S1134VB.NETTrack uses of "FIXME" tagsCode smellMajorcwe
S1135VB.NETTrack uses of "TODO" tagsCode smellInfocwe
S114VB.NETInterface names should comply with a naming conventionCode smellMinorconvention
S1147VB.NET"End" statements should not be usedCode smellBlockercwe, suspicious
S1151VB.NET"Select...Case" clauses should not have too many lines of codeCode smellMajorbrain-overload
S1155VB.NET"Any()" should be used to test for emptinessCode smellMinorperformance
S1163VB.NETExceptions should not be thrown in finally blocksCode smellCriticalerror-handling, suspicious
S117VB.NETLocal variable names should comply with a naming conventionCode smellMinorconvention
S1172VB.NETUnused procedure parameters should be removedCode smellMajorunused
S1186VB.NETMethods should not be emptyCode smellCriticalsuspicious
S119VB.NETGeneric type parameter names should comply with a naming conventionCode smellMinorconvention
S1192VB.NETString literals should not be duplicatedCode smellMinordesign
S1197VB.NETArray designators "()" should be on the type, not the variableCode smellMinorconvention
S122VB.NETStatements should be on separate linesCode smellMajorconvention
S1226VB.NETMethod parameters and caught exceptions should not be reassignedBugMinor
S126VB.NET"If ... ElseIf" constructs should end with "Else" clausesCode smellCritical
S1301VB.NET"Select" statements should have at least 3 "Case" clausesCode smellMinorbad-practice
S131VB.NET"Select" statements should end with a "Case Else" clauseCode smellCriticalcwe
S1313VB.NETIP addresses should not be hardcodedCode smellMinorformer-hotspot
S134VB.NETControl flow statements "If", "For", "For Each", "Do", "While", "Select" and "Try" should not be nested too deeplyCode smellCriticalbrain-overload
S138VB.NETProcedures should not have too many lines of codeCode smellMajorbrain-overload
S139VB.NETComments should not be located at the end of lines of codeCode smellMinorconvention
S1451VB.NETTrack lack of copyright and license headersCode smellBlockerconvention
S1479VB.NET"Select Case" statement with many "Case" clauses should have only one statementCode smellMajorbrain-overload
S1481VB.NETUnused local variables should be removedCode smellMinorunused
S1541VB.NETFunctions, procedures and properties should not be too complexCode smellCriticalbrain-overload
S1542VB.NETFunctions and procedures should comply with a naming conventionCode smellMajorconvention
S1643VB.NETStrings should not be concatenated using "+" or "&" in a loopCode smellMinorperformance
S1645VB.NETThe "&" operator should be used to concatenate stringsCode smellCriticalsuspicious
S1654VB.NETMethod parameters should follow a naming conventionCode smellMajorconvention
S1656VB.NETVariables should not be self-assignedBugMajor
S1659VB.NETMultiple variables should not be declared on the same lineCode smellMinorconvention
S1751VB.NETLoops with at most one iteration should be refactoredBugMajorconfusing, bad-practice
S1764VB.NETIdentical expressions should not be used on both sides of a binary operatorBugMajorsuspicious
S1821VB.NET"Select Case" statements should not be nestedCode smellCriticalpitfall
S1862VB.NETRelated "If/ElseIf" statements should not have the same conditionBugMajorunused, pitfall
S1871VB.NETTwo branches in a conditional structure should not have exactly the same implementationCode smellMajordesign, suspicious
S1940VB.NETBoolean checks should not be invertedCode smellMinorpitfall
S1944VB.NETInvalid casts should be avoidedCode smellMajorcwe, suspicious
S2053VB.NETPassword hashing functions should use an unpredictable saltVulnerabilityCriticalcwe, symbolic-execution
S2068VB.NETCredentials should not be hard-codedVulnerabilityMajorcwe, former-hotspot, secret
S2077VB.NETSQL queries should not be dynamically formattedVulnerabilityMajorcwe, bad-practice, sql, former-hotspot
S2094VB.NETClasses should not be emptyCode smellMinorclumsy
S2166VB.NETClasses named like "Exception" should extend "Exception" or a subclassCode smellMajorconvention, error-handling, pitfall
S2178VB.NETShort-circuit logic should be used in boolean contextsCode smellBlocker
S2222VB.NETLocks should be released on all pathsBugCriticalcwe, multi-threading, symbolic-execution
S2225VB.NET"ToString()" method should not return NothingBugMajorcwe
S2234VB.NETArguments should be passed in the same order as the procedure parametersCode smellMajor
S2257VB.NETCustom cryptographic algorithms should not be usedVulnerabilityCriticalcwe, former-hotspot
S2259VB.NETNull pointers should not be dereferencedBugMajorcwe, symbolic-execution
S2302VB.NET"NameOf" should be usedCode smellCriticalbad-practice
S2304VB.NETNamespace names should comply with a naming conventionCode smellMinorconvention
S2339VB.NETPublic constant members should not be usedCode smellCriticalpitfall
S2340VB.NET"Do" loops should not be used without a "While" or "Until" conditionCode smellCriticalpitfall
S2342VB.NETEnumeration types should comply with a naming conventionCode smellMinorconvention
S2343VB.NETEnumeration values should comply with a naming conventionCode smellMinorconvention
S2344VB.NETEnumeration type names should not have "Flags" or "Enum" suffixesCode smellMinorconvention
S2345VB.NETFlags enumerations should explicitly initialize all their membersBugMinor
S2346VB.NETFlags enumerations zero-value members should be named "None"Code smellCriticalconvention
S2347VB.NETEvent handlers should comply with a naming conventionCode smellMinorconvention
S2348VB.NETEvents should comply with a naming conventionCode smellMinorconvention
S2349VB.NETEvent names should not have "Before" or "After" as a prefix or suffixCode smellMinorconvention
S2352VB.NETIndexed properties with more than one parameter should not be usedCode smellMajorclumsy
S2354VB.NETLine continuations should not be usedCode smellMinorconvention
S2355VB.NETArray literals should be used instead of array creation expressionsCode smellMinorclumsy
S2357VB.NETFields should be privateCode smellMajorpitfall
S2358VB.NET"IsNot" should be used instead of "Not ... Is ..."Code smellMajorclumsy
S2359VB.NET"On Error" statements should not be usedCode smellMajorbad-practice
S2360VB.NETOptional parameters should not be usedCode smellCriticalpitfall
S2362VB.NETPrivate constants should comply with a naming conventionCode smellMinorconvention
S2363VB.NET"Private Shared ReadOnly" fields should comply with a naming conventionCode smellMinorconvention
S2364VB.NET"Private" fields should comply with a naming conventionCode smellMinorconvention
S2365VB.NETProperties should not make collection or array copiesCode smellCriticalapi-design, performance
S2366VB.NETProperties should comply with a naming conventionCode smellMinorconvention
S2367VB.NETNon-private constants should comply with a naming conventionCode smellMinorconvention
S2368VB.NETPublic methods should not have multidimensional array parametersCode smellBlockerpitfall
S2369VB.NETNon-private fields should comply with a naming conventionCode smellMinorconvention
S2370VB.NETNon-private "Shared ReadOnly" fields should comply with a naming conventionCode smellMinorconvention
S2372VB.NETExceptions should not be thrown from property gettersCode smellMajorerror-handling
S2373VB.NETGeneric type parameter names should comply with a naming conventionCode smellMinor
S2374VB.NETSigned types should be preferred to unsigned onesCode smellCriticalpitfall
S2375VB.NET"With" statements should be used for a series of calls to the same objectCode smellMinorclumsy
S2376VB.NETWrite-only properties should not be usedCode smellMajorpitfall
S2387VB.NETChild class fields should not shadow parent class fieldsCode smellBlocker
S2429VB.NETArrays should be initialized using the "... = {}" syntaxCode smellMinorclumsy
S2437VB.NETUnnecessary bit operations should not be performedCode smellBlockersuspicious
S2551VB.NETShared resources should not be used for lockingBugCriticalmulti-threading
S2583VB.NETConditionally executed code should be reachableBugMajorcwe, unused, suspicious, pitfall, symbolic-execution
S2589VB.NETBoolean expressions should not be gratuitousCode smellMajorcwe, suspicious, redundant, symbolic-execution
S2612VB.NETFile permissions should not be set to world-accessible valuesVulnerabilityMajorcwe, former-hotspot
S2692VB.NET"IndexOf" checks should not be for positive numbersCode smellCriticalsuspicious
S2737VB.NET"catch" clauses should do more than rethrowCode smellMinorerror-handling, unused, finding, clumsy
S2757VB.NETNon-existent operators like "=+" should not be usedBugMajor
S2761VB.NET'Not' boolean operator should not be repeatedBugMajor
S2925VB.NET"Thread.Sleep" should not be used in testsCode smellMajortests, bad-practice
S2951VB.NET"Exit Select" statements should not be used redundantlyCode smellMinorunused, clumsy
S3011VB.NETReflection should not be used to increase accessibility of classes, methods, or fieldsCode smellMajor
S3063VB.NET"StringBuilder" data should be usedCode smellMajorperformance
S3329VB.NETCipher Block Chaining IVs should be unpredictableVulnerabilityCriticalcwe, symbolic-execution
S3358VB.NETIf operators should not be nestedCode smellMajorconfusing
S3363VB.NETDate and time should not be used as a type for primary keysBugMinor
S3385VB.NET"Exit" statements should not be usedCode smellMajorbrain-overload, bad-practice
S3431VB.NET"[ExpectedException]" should not be usedCode smellMajortests
S3449VB.NETRight operands of shift operators should be integersBugCritical
S3453VB.NETClasses should not have only "private" constructorsBugMajordesign
S3464VB.NETType inheritance should not be recursiveBugBlocker
S3466VB.NETOptional parameters should be passed to "base" callsBugMajor
S3598VB.NETOne-way "OperationContract" methods should have "void" return typeBugMajor
S3603VB.NETMethods with "Pure" attribute should return a value BugMajor
S3655VB.NETEmpty nullable value should not be accessedBugMajorcwe, symbolic-execution
S3776VB.NETCognitive Complexity of methods should not be too highCode smellCriticalbrain-overload
S3860VB.NET"ByVal" should not be usedCode smellMinorclumsy
S3866VB.NET"IIf" should not be usedCode smellCriticalperformance
S3869VB.NET"SafeHandle.DangerousGetHandle" should not be calledBugBlockerleak, unpredictable
S3871VB.NETException types should be "Public"Code smellCriticalerror-handling, api-design
S3878VB.NETArrays should not be created for ParamArray parametersCode smellMinorclumsy
S3884VB.NET"CoSetProxyBlanket" and "CoInitializeSecurity" should not be usedVulnerabilityBlocker
S3889VB.NET"Thread.Resume" and "Thread.Suspend" should not be usedBugBlockermulti-threading, unpredictable
S3898VB.NETValue types should implement "IEquatable<T>"Code smellMajorperformance
S3900VB.NETArguments of public methods should be validated against NothingCode smellMajorconvention, symbolic-execution
S3903VB.NETTypes should be defined in named namespacesBugMajor
S3904VB.NETAssemblies should have version informationCode smellCriticalpitfall
S3923VB.NETAll branches in a conditional structure should not have exactly the same implementationBugMajor
S3926VB.NETDeserialization methods should be provided for "OptionalField" membersBugMajorserialization
S3927VB.NETSerialization event handlers should be implemented correctlyBugMajor
S3949VB.NETCalculations should not overflowBugMajoroverflow, symbolic-execution
S3966VB.NETObjects should not be disposed more than onceCode smellMajorconfusing, pitfall, symbolic-execution
S3981VB.NETCollection sizes and array length comparisons should make senseBugMajorconfusing
S3990VB.NETAssemblies should be marked as CLS compliantCode smellMajorapi-design
S3992VB.NETAssemblies should explicitly specify COM visibilityCode smellMajorapi-design
S3998VB.NETThreads should not lock on objects with weak identityCode smellCriticalmulti-threading, pitfall
S4025VB.NETChild class fields should not differ from parent class fields only by capitalizationCode smellCriticalpitfall
S4036VB.NETOS commands should not rely on PATH resolutionVulnerabilityMinorcwe, former-hotspot
S4060VB.NETNon-abstract attributes should be sealedCode smellMinorperformance
S4136VB.NETMethod overloads should be grouped togetherCode smellMinorconvention
S4143VB.NETMap values should not be replaced unconditionallyBugMajorsuspicious
S4144VB.NETMethods should not have identical implementationsCode smellMajorconfusing, duplicate, suspicious
S4158VB.NETEmpty collections should not be accessed or iteratedBugMinorsymbolic-execution
S4159VB.NETClasses should implement their "ExportAttribute" interfacesBugBlockermef, pitfall
S4201VB.NETNull checks should not be combined with "TypeOf Is" operator checksCode smellMinorredundant
S4210VB.NETWindows Forms entry points should be marked with STAThreadBugMajorwinforms, pitfall
S4225VB.NETExtension methods should not extend "Object"Code smellMinor
S4260VB.NET"ConstructorArgument" parameters should exist in constructorsBugMajorxaml, wpf
S4275VB.NETProperty procedures should access the expected fieldsBugCriticalpitfall
S4277VB.NET"Shared" parts should not be created with "new"BugCriticalmef, pitfall
S4423VB.NETWeak SSL/TLS protocols should not be usedVulnerabilityCriticalcwe, privacy
S4428VB.NET"PartCreationPolicyAttribute" should be used with "ExportAttribute"BugMajormef, pitfall
S4507VB.NETDebugging features should not be enabled in productionVulnerabilityMinorcwe, error-handling, debug, user-experience, former-hotspot
S4545VB.NET"DebuggerDisplayAttribute" strings should reference existing membersCode smellMajor
S4581VB.NET"new Guid()" should not be usedCode smellMajor
S4583VB.NETCalls to delegate's method "BeginInvoke" should be paired with calls to "EndInvoke"BugCritical
S4586VB.NETNon-async "Task/Task<T>" methods should not return nullBugCriticalasync-await
S4663VB.NETComments should not be emptyCode smellMinor
S4790VB.NETWeak hashing algorithms should not be usedVulnerabilityCriticalcwe, former-hotspot
S4830VB.NETServer certificates should be verified during SSL/TLS connectionsVulnerabilityCriticalcwe, privacy, ssl
S5042VB.NETExpanding archive files should not be done without controlling resource consumptionCode smellMajorcwe, former-hotspot
S5443VB.NETTemporary files should not be created in publicly writable directoriesVulnerabilityCriticalcwe, former-hotspot
S5445VB.NETInsecure temporary file creation methods should not be usedVulnerabilityCriticalcwe
S5542VB.NETEncryption algorithms should be used with secure mode and padding schemeVulnerabilityCriticalcwe, privacy
S5547VB.NETCipher algorithms should be robustVulnerabilityCriticalcwe, privacy
S5659VB.NETJWT should be signed and verified with strong cipher algorithmsVulnerabilityCriticalcwe, privacy
S5693VB.NETHTTP request content length should be limitedVulnerabilityMajorcwe, former-hotspot
S5753VB.NETASP.NET Request Validation should not be disabledVulnerabilityMajorcwe, former-hotspot
S5773VB.NETTypes allowed to be deserialized should be restrictedVulnerabilityMajorcwe, symbolic-execution
S5856VB.NETRegular expressions should be syntactically validBugCriticalregex
S5944VB.NET"Return" statements should be used instead of assigning values to function namesCode smellMajorbad-practice, confusing
S6145VB.NET"Option Strict" should be enabledCode smellMajorbad-practice
S6146VB.NET"Option Explicit" should be enabledCode smellCriticalbad-practice
S6354VB.NETUse a testable date/time providerCode smellMajor
S6418VB.NETSecrets should not be hard-codedVulnerabilityBlockercwe, former-hotspot, secret
S6444VB.NETRegular expressions should be executed with a timeoutVulnerabilityMinorcwe, regex, former-hotspot
S6513VB.NET"ExcludeFromCodeCoverage" attributes should include a justificationCode smellMinorbad-practice
S6561VB.NETAvoid using "DateTime.Now" for benchmarking or timing operationsCode smellMajor
S6562VB.NETAlways set the "DateTimeKind" when creating new "DateTime" instancesCode smellMajorlocalisation, pitfall
S6563VB.NETUse UTC when recording DateTime instantsCode smellMajorpitfall
S6566VB.NETUse "DateTimeOffset" instead of "DateTime"Code smellMajor
S6575VB.NETUse "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter"Code smellMajor
S6580VB.NETUse a format provider when parsing date and timeCode smellMajorpitfall, bug
S6585VB.NETDon't hardcode the format when turning dates and times to stringsCode smellMinor
S6588VB.NETUse the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epochCode smellMinor
S6602VB.NET"Find" method should be used instead of the "FirstOrDefault" extensionCode smellMinorperformance
S6603VB.NETThe collection-specific "TrueForAll" method should be used instead of the "All" extensionCode smellMinorperformance
S6605VB.NETCollection-specific "Exists" method should be used instead of the "Any" extensionCode smellMinorperformance
S6607VB.NETThe collection should be filtered before sorting by using "Where" before "OrderBy"Code smellMinorperformance
S6608VB.NETPrefer indexing instead of "Enumerable" methods on types implementing "IList"Code smellMinorperformance
S6609VB.NET"Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methodsCode smellMinorperformance
S6610VB.NET"StartsWith" and "EndsWith" overloads that take a "char" should be used instead of the ones that take a "string"Code smellMinorperformance
S6612VB.NETThe lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methodsCode smellMinorperformance
S6613VB.NET"First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methodsCode smellMinorperformance
S6617VB.NET"Contains" should be used instead of "Any" for simple equality checksCode smellMinorperformance
S6930VB.NETBackslash should be avoided in route templatesBugMajorasp.net
S6931VB.NETASP.NET controller actions should not have a route template starting with "/"Code smellMajorasp.net
S7130VB.NETFirst/Single should be used instead of FirstOrDefault/SingleOrDefault on collections that are known to be non-emptyCode smellMajorsymbolic-execution
S7131VB.NETA write lock should not be released when a read lock has been acquired and vice versaBugCriticalsymbolic-execution
S7133VB.NETLocks should be released within the same methodBugCriticalsymbolic-execution
S907VB.NET"GoTo" statements should not be usedCode smellMajorbrain-overload
S927VB.NETParameter names should match base declarationCode smellCriticalsuspicious

↑ Back to top