# NOTE: Requires **VS2019 16.3** or later

# All Rules Enabled with default severity
# Description: All Rules are enabled with default severity. Rules with IsEnabledByDefault = false are force enabled with default severity.

[*]
indent_style = space

# XML project files
[*.{csproj,proj,j}]
indent_size = 2

[*.json]
indent_size = 2

# Powershell files
[*.ps1]
indent_size = 2

# Shell script files
[*.sh]
end_of_line = lf
indent_size = 4

# Code files
[*.{cs,vb}]

indent_size = 4
# insert_final_newline = true

# TODO: Enable as warning/error and clean unused imports in the next PR
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005#overview
dotnet_diagnostic.CS8019.severity = warning
# https://github.com/dotnet/format/issues/1623
dotnet_diagnostic.IDE0130.severity = none
dotnet_analyzer_diagnostic.category-Style.severity = error

# Code style rules

# IDE0001: Simplify Names
dotnet_diagnostic.IDE0001.severity = suggestion

# IDE0002: Simplify Member Access
dotnet_diagnostic.IDE0002.severity = suggestion

# IDE0003: Remove qualification
dotnet_diagnostic.IDE0003.severity = suggestion

# IDE0004: Remove Unnecessary Cast
dotnet_diagnostic.IDE0004.severity = warning

# Remove unnecessary using directives
dotnet_diagnostic.IDE0005.severity = warning

# Enforce 'var' used
dotnet_diagnostic.IDE0007.severity = none

# Use explicit type instead of 'var'
dotnet_diagnostic.IDE0008.severity = none

# IDE0010: Add missing cases
dotnet_diagnostic.IDE0010.severity = warning

# IDE0011: Add braces
dotnet_diagnostic.IDE0011.severity = suggestion

# IDE0017: Simplify object initialization
dotnet_diagnostic.IDE0017.severity = suggestion

# IDE0018: Variable declaration can be inlined
dotnet_diagnostic.IDE0018.severity = suggestion

# IDE0022: Use block body for method
dotnet_diagnostic.IDE0022.severity = none

# IDE0027: Use expression body for accessor
dotnet_diagnostic.IDE0027.severity = suggestion

# IDE0028: Simplify collection initialization
dotnet_diagnostic.IDE0028.severity = suggestion

# IDE0032: Use auto property
dotnet_diagnostic.IDE0032.severity = suggestion

# IDE0040: Add accessibility modifiers
dotnet_diagnostic.IDE0040.severity = warning

# IDE0042: Deconstruct variable declaration
dotnet_diagnostic.IDE0042.severity = suggestion

# IDE0044: Add readonly modifier
dotnet_diagnostic.IDE0044.severity = warning

# IDE0045: Use conditional expression for assignment
dotnet_diagnostic.IDE0045.severity = suggestion

# IDE0046: Convert to conditional expression
dotnet_diagnostic.IDE0046.severity = suggestion

# IDE0047: Remove unnecessary parentheses
dotnet_diagnostic.IDE0047.severity = suggestion

# IDE0049: Simplify Names
dotnet_diagnostic.IDE0049.severity = suggestion

# IDE0034: Simplify 'default' expression
dotnet_diagnostic.IDE0034.severity = suggestion

# IDE0055: Formatting rule
dotnet_diagnostic.IDE0055.severity = warning

# IDE0057: Substring can be simplified
dotnet_diagnostic.IDE0057.severity = suggestion

# IDE0058: Remove unnecessary expression value
dotnet_diagnostic.IDE0058.severity = none

# IDE0059: Unnecessary assignment of a value
dotnet_diagnostic.IDE0059.severity = suggestion

# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = warning

# IDE0063: Use simple 'using' statement
dotnet_diagnostic.IDE0063.severity = suggestion

# IDE0071: Simplify interpolation
dotnet_diagnostic.IDE0071.severity = suggestion

# IDE0074: Use compound assignment
dotnet_diagnostic.IDE0074.severity = suggestion

# IDE0078: Use pattern matching
dotnet_diagnostic.IDE0078.severity = suggestion

# IDE0083: Use pattern matching
dotnet_diagnostic.IDE0083.severity = suggestion

# IDE0090: Use 'new(...)'
dotnet_diagnostic.IDE0090.severity = suggestion

# IDE1005: Delegate invocation can be simplified.
dotnet_diagnostic.IDE1005.severity = suggestion

# IDE0160: Convert to block scoped namespace
dotnet_diagnostic.IDE0160.severity = none

dotnet_code_quality.ca1711.allowed_suffixes = Flag|Flags

# Do not declare static members on generic types
dotnet_diagnostic.CA1000.severity = error

# Types that own disposable fields should be disposable
dotnet_diagnostic.CA1001.severity = error

# Use generic event handler instances
dotnet_diagnostic.CA1003.severity = error

# Enums should have zero value
dotnet_diagnostic.CA1008.severity = error

# Collections should implement generic interface
dotnet_diagnostic.CA1010.severity = error

# Abstract types should not have constructors
dotnet_diagnostic.CA1012.severity = silent

# Mark assemblies with CLSCompliant
dotnet_diagnostic.CA1014.severity = silent

# Mark assemblies with assembly version
dotnet_diagnostic.CA1016.severity = error

# Mark assemblies with ComVisible
dotnet_diagnostic.CA1017.severity = error

# Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1018.severity = error

# Define accessors for attribute arguments
dotnet_diagnostic.CA1019.severity = error

# Use properties where appropriate
dotnet_diagnostic.CA1024.severity = silent

# Mark enums with FlagsAttribute
dotnet_diagnostic.CA1027.severity = error

# Enum Storage should be Int32
dotnet_diagnostic.CA1028.severity = error

# Use events where appropriate
dotnet_diagnostic.CA1030.severity = silent

# Do not catch general exception types
dotnet_diagnostic.CA1031.severity = silent

# Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = suggestion

# Interface methods should be callable by child types
dotnet_diagnostic.CA1033.severity = silent

# Nested types should not be visible
dotnet_diagnostic.CA1034.severity = silent

# Override methods on comparable types
dotnet_diagnostic.CA1036.severity = error

# Avoid empty interfaces
dotnet_diagnostic.CA1040.severity = error

# Provide ObsoleteAttribute message
dotnet_diagnostic.CA1041.severity = error

# Use Integral Or String Argument For Indexers
dotnet_diagnostic.CA1043.severity = error

# Properties should not be write only
dotnet_diagnostic.CA1044.severity = suggestion

# Declare types in namespaces
dotnet_diagnostic.CA1050.severity = error

# Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = silent

# Static holder types should be Static or NotInheritable
dotnet_diagnostic.CA1052.severity = suggestion

# Uri parameters should not be strings
dotnet_diagnostic.CA1054.severity = silent

# Uri return values should not be strings
dotnet_diagnostic.CA1055.severity = silent

# Uri properties should not be strings
dotnet_diagnostic.CA1056.severity = silent

# Types should not extend certain base types
dotnet_diagnostic.CA1058.severity = error

# Move pinvokes to native methods class
dotnet_diagnostic.CA1060.severity = silent

# Do not hide base class methods
dotnet_diagnostic.CA1061.severity = error

# Validate arguments of public methods
# PARTIALLY COMPLETE
dotnet_diagnostic.CA1062.severity = suggestion

# Implement IDisposable Correctly
dotnet_diagnostic.CA1063.severity = error

# Exceptions should be public
dotnet_diagnostic.CA1064.severity = error

# Do not raise exceptions in unexpected locations
dotnet_diagnostic.CA1065.severity = error

# Type {0} should implement IEquatable<T> because it overrides Equals
dotnet_diagnostic.CA1066.severity = error

# Override Object.Equals(object) when implementing IEquatable<T>
dotnet_diagnostic.CA1067.severity = error

# CancellationToken parameters must come last
dotnet_diagnostic.CA1068.severity = error

# Avoid using cref tags with a prefix
dotnet_diagnostic.CA1200.severity = error

# Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = silent

# Specify CultureInfo
dotnet_diagnostic.CA1304.severity = silent

# Specify IFormatProvider
dotnet_diagnostic.CA1305.severity = silent

# Specify StringComparison
dotnet_diagnostic.CA1307.severity = suggestion

# Normalize strings to uppercase
dotnet_diagnostic.CA1308.severity = suggestion

# Use ordinal stringcomparison
dotnet_diagnostic.CA1309.severity = suggestion

# P/Invokes should not be visible
dotnet_diagnostic.CA1401.severity = suggestion

# Avoid excessive inheritance
dotnet_diagnostic.CA1501.severity = error

# Avoid excessive complexity
dotnet_diagnostic.CA1502.severity = silent

# Avoid unmaintainable code
dotnet_diagnostic.CA1505.severity = error

# Avoid excessive class coupling
dotnet_diagnostic.CA1506.severity = silent

# Use nameof to express symbol names
dotnet_diagnostic.CA1507.severity = error

# Avoid dead conditional code
# TOO MANY FALSE POSITIVES
dotnet_diagnostic.CA1508.severity = silent

# Invalid entry in code metrics rule specification file
dotnet_diagnostic.CA1509.severity = error

# Identifiers should not contain underscores
# Too much work to change now
dotnet_diagnostic.CA1707.severity = silent

# Identifiers should differ by more than case
dotnet_diagnostic.CA1708.severity = suggestion

# Identifiers should have correct suffix
dotnet_diagnostic.CA1710.severity = error

# Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1711.severity = error

# Do not prefix enum values with type name
dotnet_diagnostic.CA1712.severity = error

# Flags enums should have plural names
dotnet_diagnostic.CA1714.severity = error

# Identifiers should have correct prefix
dotnet_diagnostic.CA1715.severity = error

# Identifiers should not match keywords
dotnet_diagnostic.CA1716.severity = error

# Only FlagsAttribute enums should have plural names
dotnet_diagnostic.CA1717.severity = error

# Identifier contains type name
dotnet_diagnostic.CA1720.severity = error

# Property names should not match get methods
dotnet_diagnostic.CA1721.severity = error

# Type names should not match namespaces
dotnet_diagnostic.CA1724.severity = silent

# Parameter names should match base declaration
dotnet_diagnostic.CA1725.severity = silent

# Review unused parameters
dotnet_diagnostic.CA1801.severity = suggestion

# Use literals where appropriate
# this flags 'static readonly' as should be 'const'
dotnet_diagnostic.CA1802.severity = silent

# Do not ignore method results
dotnet_diagnostic.CA1806.severity = suggestion

# Initialize reference type static fields inline
dotnet_diagnostic.CA1810.severity = error

# Avoid uninstantiated internal classes
dotnet_diagnostic.CA1812.severity = error

# Avoid unsealed attributes
dotnet_diagnostic.CA1813.severity = error

# Prefer jagged arrays over multidimensional
dotnet_diagnostic.CA1814.severity = error

# Override equals and operator equals on value types
dotnet_diagnostic.CA1815.severity = suggestion

# Dispose methods should call SuppressFinalize
dotnet_diagnostic.CA1816.severity = suggestion

# Properties should not return arrays
dotnet_diagnostic.CA1819.severity = silent

# Test for empty strings using string length
dotnet_diagnostic.CA1820.severity = suggestion

# Remove empty Finalizers
dotnet_diagnostic.CA1821.severity = error

# Mark members as static
dotnet_diagnostic.CA1822.severity = silent

# Avoid unused private fields
dotnet_diagnostic.CA1823.severity = error

# Mark assemblies with NeutralResourcesLanguageAttribute
dotnet_diagnostic.CA1824.severity = error

# Avoid zero-length array allocations.
dotnet_diagnostic.CA1825.severity = suggestion

# Do not use Enumerable methods on indexable collections. Instead use the collection directly
dotnet_diagnostic.CA1826.severity = suggestion

# Do not use Count() or LongCount() when Any() can be used
dotnet_diagnostic.CA1827.severity = suggestion

# Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used
dotnet_diagnostic.CA1828.severity = error

# Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1829.severity = suggestion

# Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = error

# Do not lock on objects with weak identity
dotnet_diagnostic.CA2002.severity = error

# Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = silent

# Do not create tasks without passing a TaskScheduler
dotnet_diagnostic.CA2008.severity = suggestion

# Do not call ToImmutableCollection on an ImmutableCollection value
dotnet_diagnostic.CA2009.severity = error

# Always consume the value returned by methods marked with PreserveSigAttribute
dotnet_diagnostic.CA2010.severity = error

# Review SQL queries for security vulnerabilities
dotnet_diagnostic.CA2100.severity = error

# Specify marshaling for P/Invoke string arguments
dotnet_diagnostic.CA2101.severity = silent

# Seal methods that satisfy private interfaces
dotnet_diagnostic.CA2119.severity = error

# Do Not Catch Corrupted State Exceptions
dotnet_diagnostic.CA2153.severity = error

# Rethrow to preserve stack details.
dotnet_diagnostic.CA2200.severity = error

# Do not raise reserved exception types
dotnet_diagnostic.CA2201.severity = suggestion

# Initialize value type static fields inline
dotnet_diagnostic.CA2207.severity = error

# Instantiate argument exceptions correctly
dotnet_diagnostic.CA2208.severity = suggestion

# Non-constant fields should not be visible
dotnet_diagnostic.CA2211.severity = suggestion

# Disposable fields should be disposed
dotnet_diagnostic.CA2213.severity = error

# Do not call overridable methods in constructors
dotnet_diagnostic.CA2214.severity = error

# Disposable types should declare finalizer
dotnet_diagnostic.CA2216.severity = error

# Do not mark enums with FlagsAttribute
dotnet_diagnostic.CA2217.severity = suggestion

# Override GetHashCode on overriding Equals
dotnet_diagnostic.CA2218.severity = error

# Do not raise exceptions in finally clauses
dotnet_diagnostic.CA2219.severity = error

# Override Equals on overloading operator equals
dotnet_diagnostic.CA2224.severity = error

# Operator overloads have named alternates
dotnet_diagnostic.CA2225.severity = error

# Operators should have symmetrical overloads
dotnet_diagnostic.CA2226.severity = error

# Collection properties should be read only
dotnet_diagnostic.CA2227.severity = suggestion

# Implement serialization constructors
dotnet_diagnostic.CA2229.severity = error

# Overload operator equals on overriding value type Equals
dotnet_diagnostic.CA2231.severity = error

# Pass system uri objects instead of strings
dotnet_diagnostic.CA2234.severity = suggestion

# Mark all non-serializable fields
dotnet_diagnostic.CA2235.severity = error

# Mark ISerializable types with serializable
dotnet_diagnostic.CA2237.severity = error

# Provide correct arguments to formatting methods
dotnet_diagnostic.CA2241.severity = error

# Test for NaN correctly
dotnet_diagnostic.CA2242.severity = error

# Attribute string literals should parse correctly
dotnet_diagnostic.CA2243.severity = error

# Do not duplicate indexed element initializations
dotnet_diagnostic.CA2244.severity = error

# Do not assign a property to itself.
dotnet_diagnostic.CA2245.severity = error

# Assigning symbol and its member in the same statement.
dotnet_diagnostic.CA2246.severity = error

# Do not use insecure deserializer BinaryFormatter
dotnet_diagnostic.CA2300.severity = error

# Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder
dotnet_diagnostic.CA2301.severity = error

# Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize
dotnet_diagnostic.CA2302.severity = error

# Do not use insecure deserializer LosFormatter
dotnet_diagnostic.CA2305.severity = error

# Do not use insecure deserializer NetDataContractSerializer
dotnet_diagnostic.CA2310.severity = error

# Do not deserialize without first setting NetDataContractSerializer.Binder
dotnet_diagnostic.CA2311.severity = error

# Ensure NetDataContractSerializer.Binder is set before deserializing
dotnet_diagnostic.CA2312.severity = error

# Do not use insecure deserializer ObjectStateFormatter
dotnet_diagnostic.CA2315.severity = error

# Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver
dotnet_diagnostic.CA2321.severity = error

# Ensure JavaScriptSerializer is not initialized with SimpleTypeResolver before deserializing
dotnet_diagnostic.CA2322.severity = error

# Do not use TypeNameHandling values other than None
dotnet_diagnostic.CA2326.severity = error

# Do not use insecure JsonSerializerSettings
dotnet_diagnostic.CA2327.severity = error

# Ensure that JsonSerializerSettings are secure
dotnet_diagnostic.CA2328.severity = error

# Do not deserialize with JsonSerializer using an insecure configuration
dotnet_diagnostic.CA2329.severity = error

# Ensure that JsonSerializer has a secure configuration when deserializing
dotnet_diagnostic.CA2330.severity = error

# Review code for SQL injection vulnerabilities
dotnet_diagnostic.CA3001.severity = error

# Review code for XSS vulnerabilities
dotnet_diagnostic.CA3002.severity = error

# Review code for file path injection vulnerabilities
dotnet_diagnostic.CA3003.severity = error

# Review code for information disclosure vulnerabilities
dotnet_diagnostic.CA3004.severity = error

# Review code for LDAP injection vulnerabilities
dotnet_diagnostic.CA3005.severity = error

# Review code for process command injection vulnerabilities
dotnet_diagnostic.CA3006.severity = error

# Review code for open redirect vulnerabilities
dotnet_diagnostic.CA3007.severity = error

# Review code for XPath injection vulnerabilities
dotnet_diagnostic.CA3008.severity = error

# Review code for XML injection vulnerabilities
dotnet_diagnostic.CA3009.severity = error

# Review code for XAML injection vulnerabilities
dotnet_diagnostic.CA3010.severity = error

# Review code for DLL injection vulnerabilities
dotnet_diagnostic.CA3011.severity = error

# Review code for regex injection vulnerabilities
dotnet_diagnostic.CA3012.severity = error

# Do Not Add Schema By URL
dotnet_diagnostic.CA3061.severity = error

# Insecure DTD processing in XML
dotnet_diagnostic.CA3075.severity = error

# Insecure XSLT script processing.
dotnet_diagnostic.CA3076.severity = error

# Insecure Processing in API Design, XmlDocument and XmlTextReader
dotnet_diagnostic.CA3077.severity = error

# Mark Verb Handlers With Validate Antiforgery Token
dotnet_diagnostic.CA3147.severity = error

# Do Not Use Weak Cryptographic Algorithms
dotnet_diagnostic.CA5350.severity = error

# Do Not Use Broken Cryptographic Algorithms
dotnet_diagnostic.CA5351.severity = error

# Do Not Use Unsafe Cipher Modes
dotnet_diagnostic.CA5358.severity = error

# Do Not Disable Certificate Validation
dotnet_diagnostic.CA5359.severity = error

# Do Not Call Dangerous Methods In Deserialization
dotnet_diagnostic.CA5360.severity = error

# Do Not Disable SChannel Use of Strong Crypto
dotnet_diagnostic.CA5361.severity = error

# Do Not Refer Self In Serializable Class
dotnet_diagnostic.CA5362.severity = error

# Do Not Disable Request Validation
dotnet_diagnostic.CA5363.severity = error

# Do Not Use Deprecated Security Protocols
dotnet_diagnostic.CA5364.severity = error

# Do Not Disable HTTP Header Checking
dotnet_diagnostic.CA5365.severity = error

# Use XmlReader For DataSet Read Xml
dotnet_diagnostic.CA5366.severity = error

# Do Not Serialize Types With Pointer Fields
dotnet_diagnostic.CA5367.severity = error

# Set ViewStateUserKey For Classes Derived From Page
dotnet_diagnostic.CA5368.severity = error

# Use XmlReader For Deserialize
dotnet_diagnostic.CA5369.severity = suggestion

# Use XmlReader For Validating Reader
dotnet_diagnostic.CA5370.severity = error

# Use XmlReader For Schema Read
dotnet_diagnostic.CA5371.severity = error

# Use XmlReader For XPathDocument
dotnet_diagnostic.CA5372.severity = error

# Do not use obsolete key derivation function
dotnet_diagnostic.CA5373.severity = error

# Do Not Use XslTransform
dotnet_diagnostic.CA5374.severity = error

# Do Not Use Account Shared Access Signature
dotnet_diagnostic.CA5375.severity = error

# Use SharedAccessProtocol HttpsOnly
dotnet_diagnostic.CA5376.severity = error

# Use Container Level Access Policy
dotnet_diagnostic.CA5377.severity = error

# Do not disable ServicePointManagerSecurityProtocols
dotnet_diagnostic.CA5378.severity = error

# Do Not Use Weak Key Derivation Function Algorithm
dotnet_diagnostic.CA5379.severity = error

# Do Not Add Certificates To Root Store
dotnet_diagnostic.CA5380.severity = error

# Ensure Certificates Are Not Added To Root Store
dotnet_diagnostic.CA5381.severity = error

# Use Secure Cookies In ASP.Net Core
dotnet_diagnostic.CA5382.severity = error

# Ensure Use Secure Cookies In ASP.Net Core
dotnet_diagnostic.CA5383.severity = error

# Do Not Use Digital Signature Algorithm (DSA)
dotnet_diagnostic.CA5384.severity = error

# Use Rivest–Shamir–Adleman (RSA) Algorithm With Sufficient Key Size
dotnet_diagnostic.CA5385.severity = error

# Avoid hardcoding SecurityProtocolType value
dotnet_diagnostic.CA5386.severity = error

# Do Not Use Weak Key Derivation Function With Insufficient Iteration Count
dotnet_diagnostic.CA5387.severity = error

# Ensure Sufficient Iteration Count When Using Weak Key Derivation Function
dotnet_diagnostic.CA5388.severity = error

# Do Not Add Archive Item's Path To The Target File System Path
dotnet_diagnostic.CA5389.severity = error

# Do not hard-code encryption key
dotnet_diagnostic.CA5390.severity = error

# Use antiforgery tokens in ASP.NET Core MVC controllers
dotnet_diagnostic.CA5391.severity = error

# Use DefaultDllImportSearchPaths attribute for P/Invokes
dotnet_diagnostic.CA5392.severity = silent

# Do not use unsafe DllImportSearchPath value
dotnet_diagnostic.CA5393.severity = error

# Do not use insecure randomness
dotnet_diagnostic.CA5394.severity = error

# Miss HttpVerb attribute for action methods
dotnet_diagnostic.CA5395.severity = error

# Set HttpOnly to true for HttpCookie
dotnet_diagnostic.CA5396.severity = error

# Do not use deprecated SslProtocols values
dotnet_diagnostic.CA5397.severity = error

# Avoid hardcoded SslProtocols values
dotnet_diagnostic.CA5398.severity = error

# HttpClients should enable certificate revocation list checks
dotnet_diagnostic.CA5399.severity = error

# Ensure HttpClient certificate revocation list check is not disabled
dotnet_diagnostic.CA5400.severity = error

# Do not use CreateEncryptor with non-default IV
dotnet_diagnostic.CA5401.severity = suggestion

# Use CreateEncryptor with the default IV
dotnet_diagnostic.CA5402.severity = error

# Do not hard-code certificate
dotnet_diagnostic.CA5403.severity = error

# Analyzer version mismatch
dotnet_diagnostic.CA9999.severity = error
