Git Product home page Git Product logo

metalama.community's People

Contributors

aweneer avatar gfraiteur avatar postsharpbot avatar prochan2 avatar svick avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

metalama.community's Issues

AutoCancellationToken can add a parameter with conflicting name

If a method has a parameter of some type other than CancellationToken which happens to be named cancellationToken, the weaver will correctly add a parameter of type CancellationToken, but with the same name as the existing parameter. The weaver should choose a different parameter name to avoid the conflict. I am working on a fix for this.

Example:

Original:

    // After transformation, MakeRequest should contain a CancellationToken parameter, and the call to client.GetAsync
    // should include this argument. The weaver must choose a name other than "cancellationToken" for the added parameter.
    public static async Task MakeRequest_ParameterNameCollision( HttpClient client, int cancellationToken )
    {
        await client.GetAsync( "https://httpbin.org/delay/5" );
    }

Transformed (current behaviour):

    // After transformation, MakeRequest should contain a CancellationToken parameter, and the call to client.GetAsync
    // should include this argument. The weaver must choose a name other than "cancellationToken" for the added parameter.
    public static async Task MakeRequest_ParameterNameCollision( HttpClient client, int cancellationToken, CancellationToken cancellationToken )
    {
        await client.GetAsync( "https://httpbin.org/delay/5", cancellationToken );
    }

Transformed (desired behaviour):

    // After transformation, MakeRequest should contain a CancellationToken parameter, and the call to client.GetAsync
    // should include this argument. The weaver must choose a name other than "cancellationToken" for the added parameter.
    public static async Task MakeRequest_ParameterNameCollision( HttpClient client, int cancellationToken, CancellationToken cancellationToken2 )
    {
        await client.GetAsync( "https://httpbin.org/delay/5", cancellationToken2 );
    }

AutoCancellationToken incorrectly adds CT args when the containing method has more than one CT parameter

Example:

Original:

    public static async Task MakeRequests_MultipleCtParams( CancellationToken ct1, CancellationToken ct2 )
    {
        using var client = new HttpClient();

        // After transformation, the call to MakeRequest should *not* include a CancellationToken, because
        // the containing method has two or more CancellationToken parameters.

        await MakeRequest( client );
        ...

Transformed:

    public static async Task MakeRequests_MultipleCtParams( CancellationToken ct1, CancellationToken ct2 )
    {
        using var client = new HttpClient();

        // After transformation, the call to MakeRequest should *not* include a CancellationToken, because
        // the containing method has two or more CancellationToken parameters.

        await MakeRequest( client, ct2 );
        ...

The documented behaviour is that CancellationToken arguments should not be added when the containing method has more than one CancellationToken parameter. I am working on a fix for this.

Permitting style-inconsistent unit test code

CONTRIBUTING.md requires that all code follow the style guidelines, and that code may be automatically reformatted into compliance. Sometimes code to be transformed by Metalama.Testing.AspectTesting unit tests must not follow the style guidelines because the test is covering some specific style-inconsistent scenario. How should this be handled? Is it ok to use // ReSharper disable All in these files?

Might I also note that, as currently configured, .\Build.ps1 codestyle inspect is very noisy for typical coding patterns that occur in aspect test code. Is there some scope for reducing the noise by default for unit test projects?

Contributing and copyright in source files

Most (all?) the source files herein have a header like:

// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.

How should this be handled when making 3rd party contributions?

AutoCancellationToken incorrectly adds a CancellationToken after a final `params` parameter

Example:

Original:

    private static async Task MakeRequest_FinalParamterIsParamsArray( HttpClient client, params object[] args )
    {
        ...
    }

Transformed:

    private static async Task MakeRequest_FinalParamterIsParamsArray( HttpClient client, params object[] args, CancellationToken cancellationToken )
    {
        ...
    }

The transformed code is not valid C#. I am working on a fix.

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.