[英]Use Reflection to get methods excluding local functions in C# 7.0?
[英]SonarQube MsBuild, support for C# 7.0 local functions?
我有一個問題,SonarQube認為以函數范圍以外的變量賦值結尾的本地函數是無用賦值。 如何使用C#7.0定義清除此錯誤或在SonarQube中繞過該錯誤?
我該如何解決?
功能定義:
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#目前尚不支持C#7功能,因此某些分析結果會產生奇怪的輸出。 您現在唯一能做的就是將SonarQube實例下的問題標記為False Positive
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.