Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Change CC0001 so that it does not apply to primitives #407

Copy link
Copy link
@OsirisTerje

Description

@OsirisTerje
Issue body actions

Change CC0001 so that it only works on non primitives. Raise the new CC0105 for primitives.
There is a list of primitives types on MSDN of primitives from C#:

The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single.

Remarks:

  • DateTime is not a primitive and should still be covered by CC0001.
  • String is not a primitive and should still be covered by CC0001.
  • CC0105 Should apply to both when the type is declared using an identifier name (System.Int32 i;) or using a predefined type (int i;).
  • CC0105 should follow CC0001 category and severity level (Style and Warning).
  • The code fix provider for CC0001 should updated to support CC0105, but not other change should be made to it.

Just as a reference, this is @OsirisTerje original comment:

As it is now, the CC0001 rule, "Use 'var' instead of specifying the type name" applies to any type. It could be wise to separate this into two rules, or, if possible, have an option for it, so that one can have it apply to only non-primitive types. Resharper also have this as an option.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.