Skip to content

Commit 50cc720

Browse files
authored
Merge branch 'main' into workflow/coverage/update
2 parents 0a8c9da + 6c727b1 commit 50cc720

File tree

21 files changed

+67
-68
lines changed

21 files changed

+67
-68
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public BuildScript Analyse(IAutobuilder<CSharpAutobuildOptions> builder, bool au
3939

4040
if (notDotNetProject is not null)
4141
{
42-
builder.Logger.Log(Severity.Info, "Not using .NET Core because of incompatible project {0}", notDotNetProject);
42+
builder.Logger.LogInfo($"Not using .NET Core because of incompatible project {notDotNetProject}");
4343
return BuildScript.Failure;
4444
}
4545

csharp/autobuilder/Semmle.Autobuild.CSharp/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public static int Main()
2222
}
2323
catch (InvalidEnvironmentException ex)
2424
{
25-
Console.WriteLine("The environment is invalid: {0}", ex.Message);
25+
Console.WriteLine($"The environment is invalid: {ex.Message}");
2626
}
2727
}
2828
catch (ArgumentOutOfRangeException ex)
2929
{
30-
Console.WriteLine("The value \"{0}\" for parameter \"{1}\" is invalid", ex.ActualValue, ex.ParamName);
30+
Console.WriteLine($"The value \"{ex.ActualValue}\" for parameter \"{ex.ParamName}\" is invalid");
3131
}
3232
return 1;
3333
}

csharp/autobuilder/Semmle.Autobuild.Cpp/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ static int Main()
2222
}
2323
catch (InvalidEnvironmentException ex)
2424
{
25-
Console.WriteLine("The environment is invalid: {0}", ex.Message);
25+
Console.WriteLine($"The environment is invalid: {ex.Message}");
2626
}
2727
}
2828
catch (ArgumentOutOfRangeException ex)
2929
{
30-
Console.WriteLine("The value \"{0}\" for parameter \"{1}\" is invalid", ex.ActualValue, ex.ParamName);
30+
Console.WriteLine($"The value \"{ex.ActualValue}\" for parameter \"{ex.ParamName}\" is invalid");
3131
}
3232
return 1;
3333
}

csharp/autobuilder/Semmle.Autobuild.Shared/MsBuildRule.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ BuildScript GetNugetRestoreScript() =>
128128

129129
command.Argument("/t:" + target);
130130
if (platform is not null)
131-
command.Argument(string.Format("/p:Platform=\"{0}\"", platform));
131+
command.Argument($"/p:Platform=\"{platform}\"");
132132
if (configuration is not null)
133-
command.Argument(string.Format("/p:Configuration=\"{0}\"", configuration));
133+
command.Argument($"/p:Configuration=\"{configuration}\"");
134134

135135
// append the build script which invokes msbuild to the overall build script `ret`;
136136
// we insert a check that building the current project or solution was successful:

csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Project(Autobuilder<TAutobuildOptions> builder, string path) : base(build
6666
catch // lgtm[cs/catch-of-all-exceptions]
6767
// Generic catch clause - Version constructor throws about 5 different exceptions.
6868
{
69-
builder.Logger.Log(Severity.Warning, "Project {0} has invalid tools version {1}", path, toolsVersion);
69+
builder.Logger.LogWarning($"Project {path} has invalid tools version {toolsVersion}");
7070
}
7171
}
7272

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/AssemblyInfo.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ public string Id
6060
{
6161
var result = Name;
6262
if (Version is not null)
63-
result = string.Format("{0}, Version={1}", result, Version);
63+
result = $"{result}, Version={Version}";
6464
if (Culture is not null)
65-
result = string.Format("{0}, Culture={1}", result, Culture);
65+
result = $"{result}, Culture={Culture}";
6666
if (PublicKeyToken is not null)
67-
result = string.Format("{0}, PublicKeyToken={1}", result, PublicKeyToken);
67+
result = $"{result}, PublicKeyToken={PublicKeyToken}";
6868
return result;
6969
}
7070
}
@@ -82,8 +82,8 @@ public IEnumerable<string> IndexStrings
8282
if (Version is not null)
8383
{
8484
if (Culture is not null)
85-
yield return string.Format("{0}, Version={1}, Culture={2}", Name, Version, Culture);
86-
yield return string.Format("{0}, Version={1}", Name, Version);
85+
yield return $"{Name}, Version={Version}, Culture={Culture}";
86+
yield return $"{Name}, Version={Version}";
8787
}
8888
yield return Name;
8989
yield return Name.ToLowerInvariant();

csharp/extractor/Semmle.Extraction.CSharp.Standalone/Extractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public static ExitCode Run(Options options)
151151
}
152152
catch (Exception ex) // lgtm[cs/catch-of-all-exceptions]
153153
{
154-
fileLogger.Log(Severity.Error, " Unhandled exception: {0}", ex);
154+
fileLogger.LogError($" Unhandled exception: {ex}");
155155
}
156156

157157
logger.Log(Severity.Info, $"Extraction completed in {overallStopwatch.Elapsed}");

csharp/extractor/Semmle.Extraction.CSharp/Entities/Destructor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public override void Populate(TextWriter trapFile)
1414
PopulateModifiers(trapFile);
1515
ContainingType!.PopulateGenerics();
1616

17-
trapFile.destructors(this, string.Format("~{0}", Symbol.ContainingType.Name), ContainingType, OriginalDefinition(Context, this, Symbol));
17+
trapFile.destructors(this, $"~{Symbol.ContainingType.Name}", ContainingType, OriginalDefinition(Context, this, Symbol));
1818
trapFile.destructor_location(this, Location);
1919
}
2020

csharp/extractor/Semmle.Extraction.CSharp/Entities/OrdinaryMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Symbol.ContainingType is INamedTypeSymbol nt &&
6363
{
6464
if (method.MethodKind == MethodKind.ReducedExtension)
6565
{
66-
cx.ExtractionContext.Logger.Log(Semmle.Util.Logging.Severity.Warning, "Reduced extension method symbols should not be directly extracted.");
66+
cx.ExtractionContext.Logger.LogWarning("Reduced extension method symbols should not be directly extracted.");
6767
}
6868

6969
return OrdinaryMethodFactory.Instance.CreateEntityFromSymbol(cx, method);

csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected Analyser(
5454
this.addAssemblyTrapPrefix = addAssemblyTrapPrefix;
5555
this.progressMonitor = pm;
5656

57-
Logger.Log(Severity.Info, "EXTRACTION STARTING at {0}", DateTime.Now);
57+
Logger.LogInfo($"EXTRACTION STARTING at {DateTime.Now}");
5858
stopWatch.Start();
5959
}
6060

@@ -175,7 +175,7 @@ private void DoAnalyseReferenceAssembly(PortableExecutableReference r)
175175
}
176176
catch (Exception ex) // lgtm[cs/catch-of-all-exceptions]
177177
{
178-
Logger.Log(Severity.Error, " Unhandled exception analyzing {0}: {1}", r.FilePath, ex);
178+
Logger.LogError($" Unhandled exception analyzing {r.FilePath}: {ex}");
179179
}
180180
}
181181

@@ -251,7 +251,7 @@ private void DoAnalyseCompilation()
251251
}
252252
catch (Exception ex) // lgtm[cs/catch-of-all-exceptions]
253253
{
254-
Logger.Log(Severity.Error, " Unhandled exception analyzing {0}: {1}", "compilation", ex);
254+
Logger.LogError($" Unhandled exception analyzing compilation: {ex}");
255255
}
256256
}
257257

@@ -315,12 +315,12 @@ public void PerformExtraction(int numberOfThreads)
315315
public virtual void Dispose()
316316
{
317317
stopWatch.Stop();
318-
Logger.Log(Severity.Info, " Peak working set = {0} MB", Process.GetCurrentProcess().PeakWorkingSet64 / (1024 * 1024));
318+
Logger.LogInfo($" Peak working set = {Process.GetCurrentProcess().PeakWorkingSet64 / (1024 * 1024)} MB");
319319

320320
if (TotalErrors > 0)
321-
Logger.Log(Severity.Info, "EXTRACTION FAILED with {0} error{1} in {2}", TotalErrors, TotalErrors == 1 ? "" : "s", stopWatch.Elapsed);
321+
Logger.LogInfo($"EXTRACTION FAILED with {TotalErrors} error{(TotalErrors == 1 ? "" : "s")} in {stopWatch.Elapsed}");
322322
else
323-
Logger.Log(Severity.Info, "EXTRACTION SUCCEEDED in {0}", stopWatch.Elapsed);
323+
Logger.LogInfo($"EXTRACTION SUCCEEDED in {stopWatch.Elapsed}");
324324

325325
compilationTrapFile?.Dispose();
326326
}
@@ -345,9 +345,9 @@ public virtual void Dispose()
345345
/// </summary>
346346
public void LogExtractorInfo()
347347
{
348-
Logger.Log(Severity.Info, " Extractor: {0}", Environment.GetCommandLineArgs().First());
349-
Logger.Log(Severity.Info, " Extractor version: {0}", Version);
350-
Logger.Log(Severity.Info, " Current working directory: {0}", Directory.GetCurrentDirectory());
348+
Logger.LogInfo($" Extractor: {Environment.GetCommandLineArgs().First()}");
349+
Logger.LogInfo($" Extractor version: {Version}");
350+
Logger.LogInfo($" Current working directory: {Directory.GetCurrentDirectory()}");
351351
}
352352

353353
private static string Version

0 commit comments

Comments
 (0)