sbom-tool
sbom-tool copied to clipboard
Fix analyzer warnings
trafficstars
This is an overarching issue to track analyzer warnings that are currently silenced. To fix a single warning:
- Remove the warning silence from
.editorconfig - Run a build locally
- Fix any warnings that are emitted
- Create a pull request
- Link it to this issue
- Once merged check the relevant box below
StyleCop.Analyzers
- [x] SA1000
- Keywords should be spaced correctly
- #362
- [x] SA1028
- Code should not contain trailing whitespace
- #363
- [ ] SA1101
- Prefix local calls with this
- [x] SA1108
- Block statements should not contain embedded comments
- #348
- [x] SA1117
- Parameters should be on same line or separate lines
- #364
- [x] SA1124
- Do not use regions
- #604
- [ ] SA1200
- Using directive should appear within a namespace declaration
- [ ] SA1201
- Elements must appear in the correct order
- [ ] SA1202
- Elements must be ordered by access
- [ ] SA1203
- Constants must appear before fields
- [ ] SA1204
- Static elements must appear before instance elements
- [x] SA1206
- Declaration keywords should follow order
- #365
- [x] SA1207
- Member attributes should follow the order
- #901
- [ ] SA1214
- Readonly fields must appear before non-readonly fields
- [ ] SA1316
- Tuple parameters should use correct casing
- [ ] SA1401
- Fields should be private
- [ ] SA1413
- Use trailing comma in multi-line initializers
- [ ] SA1414
- Tuple types in signatures should have element names
- [ ] SA1500
- Braces for multi-line statements should not share line
- [ ] SA1502
- Element should not be on a single line
- [x] SA1518
- Use line endings correctly
- #351
- [ ] SA1600
- Elements should be documented
- [ ] SA1602
- Enumeration items should be documented
- [ ] SA1604
- Element documentation should have summary
- [ ] SA1611
- Element parameters should be documented
- [ ] SA1612
- Element parameter documentation should match element parameters
- [ ] SA1614
- Element parameter documentation should have text
- [ ] SA1615
- Element return value should be documented
- [ ] SA1616
- Element return value should be documented
- [ ] SA1618
- Generic type parameters should be documented
- [ ] SA1622
- Generic type parameters should be documented
- [x] SA1625
- Element documentation should not be copied and pasted
- #901
- [x] SA1626
- Single-line comments should not use documentation style slashes
- #901
- [ ] SA1627
- Documentation text should not be empty
- [ ] SA1629
- Documentation text should end with a period
- [x] SA1633
- File should have header
- #901
- [ ] SA1642
- Constructor summary documentation should begin with standard text
Microsoft.CodeAnalysis.NetAnalyzers
Quality rules
- [ ] CA1001
- Types that own disposable fields should be disposable
- [ ] CA1002
- Do not expose generic lists
- [ ] CA1012
- Abstract types should not have constructors
- [ ] CA1014
- Mark assemblies with CLSCompliantAttribute
- [ ] CA1019
- Define accessors for attribute arguments
- [ ] CA1024
- Use properties where appropriate
- [ ] CA1031
- Modify 'Main' to catch a more specific allowed exception type, or rethrow the exception
- [ ] CA1032
- Implement standard exception constructors
- [x] CA1040
- Avoid empty interfaces
- #901
- [ ] CA1041
- Provide ObsoleteAttribute message
- [ ] CA1050
- Declare types in namespaces
- [ ] CA1051
- Do not declare visible instance fields
- [ ] CA1052
- Static holder types should be sealed
- [ ] CA1054
- Uri parameters should not be strings
- [ ] CA1055
- Uri return values should not be strings
- [ ] CA1056
- Uri properties should not be strings
- [ ] CA1062
- Validate arguments of public methods
- [ ] CA1063
- Implement IDisposable correctly
- [ ] CA1064
- Exceptions should be public
- [ ] CA1066
- Implement IEquatable when overriding Object.Equals
- [ ] CA1303
- Do not pass literals as localized parameters
- [ ] CA1304
- Specify CultureInfo
- [ ] CA1305
- Specify IFormatProvider
- [ ] CA1307
- Specify StringComparison
- [ ] CA1308
- Normalize strings to uppercase
- [ ] CA1309
- Use ordinal StringComparison
- [ ] CA1311
- Specify a culture in string conversion calls
- [x] CA1508
- Avoid dead conditional code
- #901
- [ ] CA1510
- Use '...' instead of explicitly throwing a new exception instance
- [ ] CA1707
- Identifiers should not contain underscores
- [ ] CA1711
- Identifiers should not have incorrect suffix
- [x] CA1715
- Prefix generic type names with 'T'
- #367
- [ ] CA1716
- Identifiers should not match keywords
- [ ] CA1720
- Identifier contains type name
- [ ] CA1724
- Type names should not match namespaces
- [ ] CA1725
- Parameter names should match base declaration
- [ ] CA1805
- Do not initialize unnecessarily
- [ ] CA1806
- Do not ignore method results
- [ ] CA1812
- Avoid uninstantiated internal classes
- [ ] CA1813
- Avoid unsealed attributes
- [ ] CA1815
- Override equals and operator equals on value types
- [x] CA1816
- Call GC.SuppressFinalize correctly
- #375
- [ ] CA1819
- Properties should not return arrays
- [ ] CA1822
- Mark members as static
- [ ] CA1825
- Avoid zero-length array allocations
- [ ] CA1829
- Use Length/Count property instead of Count() when available
- [ ] CA1849
- '...' synchronously blocks. Await '...' instead.
- [ ] CA1850
- Prefer static '...' method over '...'
- [ ] CA1851
- Possible multiple enumeration of IEnumerable
- [ ] CA1852
- Type '...' can be sealed because it has no subtypes in its containing assembly and is not externally visible
- [ ] CA1854
- Prefer 'TryGetValue' over 'ContainsKey' and 'Item' when accessing dictionary items
- [ ] CA1859
- Use culture-aware string operations
- [ ] CA1860
- Avoid using 'Enumerable.Any()' extension method.
- [ ] CA1861
- Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly
- [ ] CA2000
- Dispose objects before losing scope
- [ ] CA2007
- Consider calling ConfigureAwait on the awaited task
- [ ] CA2201
- Do not raise reserved exception types
- [ ] CA2211
- Non-constant fields should not be visible
- [ ] CA2208
- Instantiate argument exceptions correctly
- [ ] CA2225
- Operator overloads have named alternates
- [ ] CA2227
- Collection properties should be read only
- [ ] CA2229
- Implement serialization constructors
- [ ] CA2231
- Overload operator equals on overriding ValueType.Equals
- [ ] CA2235
Compiler messages
- Mark all non-serializable fields
- [ ] CS1570
- XML comment has badly formed XML -- '...'
- [ ] CS1572
- XML comment has a param tag for '...' but there is no parameter by that name
- [ ] CS1573
- Parameter '...' has no matching param tag in the XML comment for '...'
- [ ] CS1574
- XML comment has cref attribute '...' that could not be resolved
- [ ] CS1584
- XML comment has syntactically incorrect cref attribute '...'
- [ ] CS1591
- Missing XML comment for publicly visible type or member '...'
- [ ] CS1723
- XML comment on '...' has a cref tag for '...' that could not be resolved
- [ ] CS1734
- XML comment on '...' has a paramref tag for '...' that could not be resolved
- [ ] CS3001
- Argument type '...' is not CLS-compliant
- [ ] CS3002
- Return type '...' is not CLS-compliant
- [ ] CS3003
- Type of '...' is not CLS-compliant
- [ ] CS8001
- Referenced assembly '...' does not have a strong name
- [ ] CS8632
- The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
Style rules
- [x] IDE0004
- Cast is redundant
- #345
- [x] IDE0005
- Using directive is unnecessary
- #901
- [x] IDE0007
- use 'var' instead of explicit type
- #405
- [ ] IDE0009
- Add 'this' or 'Me' qualification
- [ ] IDE0010
- Add missing cases
- [x] IDE0017
- Simplify object initialization
- #350
- [ ] IDE0019
- Use pattern matching
- [ ] IDE0021
- Use expression body for constructors
- [ ] IDE0022
- Use expression body for method
- [ ] IDE0023
- Use expression body for operators
- [ ] IDE0024
- Use expression body for constructors
- [ ] IDE0025
- Use expression body for properties
- [ ] IDE0027
- Use expression body for accessors
- [ ] IDE0028
- Simplify collection initialization
- [ ] IDE0032
- Use auto property
- [ ] IDE0036
- Modifiers are not ordered
- [ ] IDE0044
- Make field readonly
- [ ] IDE0048
- Parentheses should be added for clarity
- [ ] IDE0053
- Use expression body for lambda expression
- [ ] IDE0055
- Fix formatting
- [ ] IDE0057
- Use range operator
- [ ] IDE0060
- Remove unused parameter
- [ ] IDE0065
- Using directives must be placed inside of a namespace declaration
- [ ] IDE0066
- Convert switch statement to expression
- [ ] IDE0070
- Use 'System.HashCode' instead of 'GetHashCode()'
- [ ] IDE0072
- Add missing cases to switch statement
- [x] IDE0073
- Require file header
- #347
- [ ] IDE0074
- Use compound assignment
- [ ] IDE0078
- Use pattern matching
- [ ] IDE0083
- Use pattern matching
- [ ] IDE0090
- Use 'new(...)' instead of 'new ...'
- [ ] IDE0110
- Discard can be removed
- [x] IDE0120
- Simplify LINQ expression
- #404
- [x] IDE0200
- Lambda expression can be simplified
- #404
- [ ] IDE0220
- 'foreach' statement implicitly converts '...' to '...'
- [ ] IDE0251
- Member can be made 'readonly'
- [x] IDE0270
- Null check can be simplified
- #404
- [ ] IDE1006
- Naming rule violation: These words must begin with upper case characters: ...