简体   繁体   中英

SonarQube MsBuild, support for C# 7.0 local functions?

I have a problem where SonarQube thinks that my local function ending in an assignment of a variable out of the scope of the function is useless assignment. How do I clear this error or bypass it in SonarQube using C# 7.0 definitions?

How do I resolve this?

Function Definition:

    public (bool, int) func(string str)
    {
        int variable = 0;

        // C# 7.0 - Local Functions

        void localFunc()
        {
             variable = 1;   //SonarQube complains that this usless assignment needs to be removed
        }


        return (true, variable);
    }

SonarC# doesn't support (yet) C# 7 features and so some analysis results in weird output. The only thing you can do for now is to mark the issue as False Positive under your SonarQube instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM