Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 重构代码,不要使用绝对路径或URI_C#_Sonarqube_Sonarqube Scan - Fatal编程技术网

C# 重构代码,不要使用绝对路径或URI

C# 重构代码,不要使用绝对路径或URI,c#,sonarqube,sonarqube-scan,C#,Sonarqube,Sonarqube Scan,我有一份C表格申请表。我有一些菜单项可以用预定义的URI打开google chrome。但是现在我的SonarQube扫描给了我这个错误/警告1075来重构我的代码。我该怎么办 private void HelpDocMenu_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("https://docs.google.com/document/d/142SFA/edit?

我有一份C表格申请表。我有一些菜单项可以用预定义的URI打开google chrome。但是现在我的SonarQube扫描给了我这个错误/警告1075来重构我的代码。我该怎么办

private void HelpDocMenu_Click(object sender, EventArgs e)
{           
   System.Diagnostics.Process.Start("https://docs.google.com/document/d/142SFA/edit?usp=sharing");
}

您有三种选择:

要忽略它: 要使用这样的临时变量,请执行以下操作: 要将其放在配置文件中,请选择一些settings.json。
第三个选项是推荐的。

谢谢您的帮助。请帮我理解一下。我不熟悉。如果你不认为这是一个问题,就忽略它。好吧,至少在我尝试使用sonarqube时,您不能基于每行/方法禁用警告,所以请忽略它或禁用它,查看答案。哪个警告?是否有信息或ID?S1075是代码。是。我也这么想。我找不到任何解决办法。抑制这一错误将是一条出路。
private void HelpDocMenu_Click(object sender, EventArgs e)
{       
   #pragma warning disable S1075 // URIs should not be hardcoded    
   System.Diagnostics.Process.Start("https://docs.google.com/document/d/142SFA/edit?usp=sharing");
   #pragma warning restore S1075 // URIs should not be hardcoded
}
private void HelpDocMenu_Click(object sender, EventArgs e)
{           
    var url = "https://docs.google.com/document/d/142SFA/edit?usp=sharing";
    System.Diagnostics.Process.Start(url);
}