Skip to content

Commit f3b4cb4

Browse files
authored
Merge pull request #848 from calumgrant/cs/lgtm-suppress-alerts
C#: Suppress cs/catch-of-all-exceptions
2 parents 5327ca7 + f39daae commit f3b4cb4

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

csharp/autobuilder/Semmle.Autobuild/DotNetRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static BuildScript DownloadDotNet(Autobuilder builder, string installDir)
112112
var o = JObject.Parse(File.ReadAllText(path));
113113
version = (string)o["sdk"]["version"];
114114
}
115-
catch
115+
catch // lgtm[cs/catch-of-all-exceptions]
116116
{
117117
// not a valid global.json file
118118
continue;

csharp/autobuilder/Semmle.Autobuild/Project.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public Project(Autobuilder builder, string path) : base(builder, path)
6363
ToolsVersion = new Version(toolsVersion);
6464
ValidToolsVersion = true;
6565
}
66-
catch // Generic catch clause - Version constructor throws about 5 different exceptions.
66+
catch // lgtm[cs/catch-of-all-exceptions]
67+
// Generic catch clause - Version constructor throws about 5 different exceptions.
6768
{
6869
builder.Log(Severity.Warning, "Project {0} has invalid tools version {1}", path, toolsVersion);
6970
}

csharp/extractor/Semmle.Util/CanonicalPathCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public override string GetCanonicalPath(string path, IPathCache cache)
136136
entries[0] :
137137
Path.Combine(parentPath, name);
138138
}
139-
catch (Exception)
139+
catch // lgtm[cs/catch-of-all-exceptions]
140140
{
141141
// IO error or security error querying directory.
142142
return Path.Combine(parentPath, name);

0 commit comments

Comments
 (0)