Git Product home page Git Product logo

netfabric.hyperlinq.analyzer's Introduction

NetFabric

Defines classes and structs common to other NetFabric projects.

Throw

Defines a set of static methods to throw exceptions.

Methods that throw exceptions cannot be inlined by the JIT compiler. Only if thrown within a called method. Using the methods in this class allows exceptions to be thrown and still let the method be a candidate to be inlined.

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ReadOnlyListWrapper<T> AsReadOnlyList<T>(T[] source)
    => source switch
    {
        null => Throw.ArgumentNullException<ReadOnlyListWrapper<T>>(nameof(source)),
        _ => new ReadOnlyListWrapper<T>(source)
    };

Credits

The following open-source projects are used to build and test this project:

License

This project is licensed under the MIT license. See the LICENSE file for more info.

netfabric.hyperlinq.analyzer's People

Contributors

aalmada avatar dependabot-preview[bot] avatar mend-bolt-for-github[bot] avatar robinvanpoppel avatar xtqqczze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

netfabric.hyperlinq.analyzer's Issues

Update conflict with Microsoft.CodeAnalysis.Common 3.11.0

When trying to update the Microsoft.CodeAnalysis.Common to version 3.11.0, I get the following error :

Error NU1107 Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 3.11.0 directly to project MyProject to resolve this issue.
MyProject -> Microsoft.CodeAnalysis.CSharp 3.11.0 -> Microsoft.CodeAnalysis.Common (= 3.11.0)
MyProject -> NetFabric.Hyperlinq.Analyzer 2.0.4 -> Microsoft.CodeAnalysis.CSharp.Workspaces 3.10.0 -> Microsoft.CodeAnalysis.Common (= 3.10.0).

HLQ004 in yield enumeration

HLQ004 points out that a value passed by ref or ref readonly should be fetched as such, but this should not apply to methods with yield return as it is not possible to use ref variables in this case.
For reference, Children is a protected field in the class parent, in case it has an impact.

Sans titre2

Sans titre

Error NU1608: Detected package version outside of dependency constraint

X:\src\Microsoft.PowerShell.Commands.Utility\Microsoft.PowerShell.Commands.Utility.csproj : error NU1608: Detected package version outside of dependency constraint: Microsoft.CodeAnalysis.CSharp.Workspaces 3.9.0 requires Microsoft.CodeAnalysis.CSharp (= 3.9.0) but version Microsoft.CodeAnalysis.CSharp 3.10.0 was resolved. [X:\src\powershell-win-core\powershell-win-core.csproj]

Error AD0001: Could not load file or assembly 'NetFabric.CodeAnalysis, Version=4.1.0.0'

When upgrading from 2.0.4Β to 2.1.0 my builds start failing with multiple occurences of the following error message:
CSC : error AD0001: Analyzer 'NetFabric.Hyperlinq.Analyzer.AssignmentBoxingAnalyzer' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'NetFabric.CodeAnalysis, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'. . Most of the projects are targeting net48.

VSIX

Would be nice to have a vsix version of this analyzer.

HLQ005: Single is not about performance

The documentation for Enumerable.Single states:

Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

If any of the Single operators is being used to get the first item, then it's being as wrongly used as using the First operators to the the single item.

If query a service for a customer ID and the service returns 2 different customers with the same ID, than something went wrong and you must stop what you're doing. Single assures you that, First allows your to add to the problem.

When you go to a parking lot, you park your car on the first available spot. When you leave, you get the single car - your car - not the first one you find. At least, most of society hopes you do. πŸ˜„

False positive for HLQ002

Hi!

The following code reports a false positive for rule HLQ002. I guess it has to do with the return type. Being a string, it does implement IEnumerable<char>, but returning a null in these kinds of methods should normally be fine in my opinion.

namespace ReproHLQ002
{
    public static class ClaimsExtensions
    {
        public static string SomeMethod()
        {
            const string x = "";
            if (string.IsNullOrEmpty(x))
            {
                // analyzer reports HLQ002 (Enumerable cannot be null. Return an empty enumerable instead.) on the next line
                return null;
            }

            return x;
        }
    }
}

Thanks for your time!

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.