Coder Social home page Coder Social logo

bkoelman / resharpercodecontractnullabilityfxcop Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 250 KB

Reports diagnostics, helping you to annotate your source tree with (Item)NotNull / (Item)CanBeNull attributes.

Home Page: https://www.jetbrains.com/resharper/help/Code_Analysis__Code_Annotations.html

C# 96.97% PowerShell 2.96% Batchfile 0.07%

resharpercodecontractnullabilityfxcop's People

Contributors

bkoelman avatar

Watchers

 avatar  avatar

Forkers

feodorfitsner

resharpercodecontractnullabilityfxcop's Issues

Unexpected report on an array of value type

Repro:

class C
{
    byte[] f;
}

Reports:

Annotate 'f' with [ItemNotNull] or [ItemCanBeNull].

This is incorrect, because the underlying item type, byte in this case, cannot contain null.

Constructed array parameter from open generic interface with external annotation should not be reported

Example:

public class C : ICollection<string>
{
    // ...
    public void CopyTo(string[] array, int arrayIndex) { ... }
}

Reports:

Annotate 'array' with [NotNull] or [CanBeNull].

Which is incorrect, because an external annotation exists for ICollection.CopyTo:

<member name="M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32)">
    <parameter name="array">
      <attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
    </parameter>
  </member>

Because of this, Resharper grays out the annotation after manually adding it.

Parameter name of indexer property is reported as Item; only one parameter is reported

Repro:

class C
{
    public int this[string a, string b, string c]
    {
        get { throw new NotImplementedException();}
        set { throw new NotImplementedException();}
    }
}

Expected:
Annotate 'a' with [NotNull] or [CanBeNull].
Annotate 'b' with [NotNull] or [CanBeNull].
Annotate 'c' with [NotNull] or [CanBeNull].

Actual:
Annotate 'Item' with [NotNull] or [CanBeNull].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.