Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix analyzer warnings #340

Open
JamieMagee opened this issue Aug 31, 2023 · 0 comments
Open

Fix analyzer warnings #340

JamieMagee opened this issue Aug 31, 2023 · 0 comments
Labels
tabled We like this idea, but we are not going to action on it in the moment

Comments

@JamieMagee
Copy link
Member

JamieMagee commented Aug 31, 2023

This is an overarching issue to track analyzer warnings that are currently silenced. To fix a single warning:

  1. Remove the warning silence from .editorconfig
  2. Run a build locally
  3. Fix any warnings that are emitted
  4. Create a pull request
  5. Link it to this issue
  6. Once merged check the relevant box below

StyleCop.Analyzers

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
  • CA1040
    • Avoid empty interfaces
  • 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
  • CA1508
    • Avoid dead conditional code
  • CA1510
    • Use '...' instead of explicitly throwing a new exception instance
  • CA1707
    • Identifiers should not contain underscores
  • CA1711
    • Identifiers should not have incorrect suffix
  • CA1715
  • 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
  • CA1816
  • 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

Microsoft.VisualStudio.Threading.Analyzers

  • VSTHRD103
    • ... synchronously blocks. Await ... instead.
  • VSTHRD110
    • Observe result of async calls
  • VSTHRD111
    • Add .ConfigureAwait(bool) to your await expression
  • VSTHRD200
    • Use Async suffix for async methods
JamieMagee added a commit that referenced this issue Sep 1, 2023
JamieMagee added a commit that referenced this issue Sep 1, 2023
JamieMagee added a commit that referenced this issue Sep 1, 2023
JamieMagee added a commit that referenced this issue Sep 6, 2023
@edgarrs edgarrs added the z-aa-triaged (Deprecated label) This issue has been triaged by AA label Sep 18, 2023
@jalkire jalkire added the tabled We like this idea, but we are not going to action on it in the moment label Feb 29, 2024
@jlperkins jlperkins removed the z-aa-triaged (Deprecated label) This issue has been triaged by AA label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tabled We like this idea, but we are not going to action on it in the moment
Projects
None yet
Development

No branches or pull requests

4 participants