Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S1075: Add FN repro #7816

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ void InvalidCases(string s1, string s2)
var webChemin = "http://www.mywebsite.com"; // FN
var windowsChemin = "c:\\blah\\blah\\blah.txt"; // FN


// The rule only checks the string literals that are [arguments in methods/constructors] or [assignment]
bool ReturnStement(string uri)
{
Expand Down Expand Up @@ -74,3 +73,35 @@ void ValidCases(string s)
}
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/7815
class ReproFN_7815
{
class MyClass
{
public string FilePath { get; set; }
}

void Method()
{
var myClass = new MyClass
{
FilePath = "/my/other/folder" // Compliant - we ignore unix paths by default
};

var myClass2 = new MyClass
{
FilePath = @"\\my-network-drive\folder\file.txt" // FN
};
csaba-sagi-sonarsource marked this conversation as resolved.
Show resolved Hide resolved

var myClass3 = new MyClass
{
FilePath = "http://www.mywebsite.com" // FN
};

var myClass4 = new MyClass
{
FilePath = "c:\\blah\\blah\\blah.txt" // FN
};
}
}