mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C#: Mark members static (remove unused members)
This commit is contained in:
@@ -268,7 +268,7 @@ Invoke-Command -ScriptBlock $ScriptBlock";
|
||||
static string DotNetCommand(IBuildActions actions, string? dotNetPath) =>
|
||||
dotNetPath != null ? actions.PathCombine(dotNetPath, "dotnet") : "dotnet";
|
||||
|
||||
BuildScript GetInfoCommand(IBuildActions actions, string? dotNetPath, IDictionary<string, string>? environment)
|
||||
static BuildScript GetInfoCommand(IBuildActions actions, string? dotNetPath, IDictionary<string, string>? environment)
|
||||
{
|
||||
var info = new CommandBuilder(actions, null, environment).
|
||||
RunCommand(DotNetCommand(actions, dotNetPath)).
|
||||
@@ -276,7 +276,7 @@ Invoke-Command -ScriptBlock $ScriptBlock";
|
||||
return info.Script;
|
||||
}
|
||||
|
||||
CommandBuilder GetCleanCommand(IBuildActions actions, string? dotNetPath, IDictionary<string, string>? environment)
|
||||
static CommandBuilder GetCleanCommand(IBuildActions actions, string? dotNetPath, IDictionary<string, string>? environment)
|
||||
{
|
||||
var clean = new CommandBuilder(actions, null, environment).
|
||||
RunCommand(DotNetCommand(actions, dotNetPath)).
|
||||
@@ -284,7 +284,7 @@ Invoke-Command -ScriptBlock $ScriptBlock";
|
||||
return clean;
|
||||
}
|
||||
|
||||
CommandBuilder GetRestoreCommand(IBuildActions actions, string? dotNetPath, IDictionary<string, string>? environment)
|
||||
static CommandBuilder GetRestoreCommand(IBuildActions actions, string? dotNetPath, IDictionary<string, string>? environment)
|
||||
{
|
||||
var restore = new CommandBuilder(actions, null, environment).
|
||||
RunCommand(DotNetCommand(actions, dotNetPath)).
|
||||
@@ -309,7 +309,7 @@ Invoke-Command -ScriptBlock $ScriptBlock";
|
||||
/// hence the need for CLR tracing), by adding a
|
||||
/// `/p:UseSharedCompilation=false` argument.
|
||||
/// </summary>
|
||||
BuildScript GetBuildScript(Autobuilder builder, string? dotNetPath, IDictionary<string, string>? environment, bool compatibleClr, string projOrSln)
|
||||
static BuildScript GetBuildScript(Autobuilder builder, string? dotNetPath, IDictionary<string, string>? environment, bool compatibleClr, string projOrSln)
|
||||
{
|
||||
var build = new CommandBuilder(builder.Actions, null, environment);
|
||||
var script = builder.MaybeIndex(build, DotNetCommand(builder.Actions, dotNetPath)).
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Semmle.Autobuild.Shared
|
||||
|
||||
bool IBuildActions.FileExists(string file) => File.Exists(file);
|
||||
|
||||
ProcessStartInfo GetProcessStartInfo(string exe, string arguments, string? workingDirectory, IDictionary<string, string>? environment, bool redirectStandardOutput)
|
||||
static ProcessStartInfo GetProcessStartInfo(string exe, string arguments, string? workingDirectory, IDictionary<string, string>? environment, bool redirectStandardOutput)
|
||||
{
|
||||
var pi = new ProcessStartInfo(exe, arguments)
|
||||
{
|
||||
|
||||
@@ -33,8 +33,6 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
{
|
||||
}
|
||||
|
||||
public bool NeedsPopulation { get { return true; } }
|
||||
|
||||
public Label Label { get; set; }
|
||||
|
||||
public void WriteId(TextWriter trapFile)
|
||||
@@ -52,7 +50,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
trapFile.Write('\"');
|
||||
}
|
||||
|
||||
public string IdSuffix => ";cil-field";
|
||||
private const string IdSuffix = ";cil-field";
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace Semmle.Extraction.CSharp.Standalone
|
||||
/// <summary>
|
||||
/// Outputs the command line options to the console.
|
||||
/// </summary>
|
||||
public void ShowHelp(System.IO.TextWriter output)
|
||||
public static void ShowHelp(System.IO.TextWriter output)
|
||||
{
|
||||
output.WriteLine("C# standalone extractor\n\nExtracts a C# project in the current directory without performing a build.\n");
|
||||
output.WriteLine("Additional options:\n");
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Semmle.Extraction.CSharp.Standalone
|
||||
|
||||
if (options.Help)
|
||||
{
|
||||
options.ShowHelp(System.Console.Out);
|
||||
Options.ShowHelp(System.Console.Out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,11 +59,6 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
public sealed override Microsoft.CodeAnalysis.Location ReportingLocation => Node.GetLocation();
|
||||
|
||||
public IEnumerable<Tuple> GetTuples()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Semmle.Extraction.CSharp.Populators
|
||||
return Visit(method.Identifier, method.Body ?? (SyntaxNode)method.ExpressionBody);
|
||||
}
|
||||
|
||||
public LineCounts Visit(SyntaxToken identifier, SyntaxNode body)
|
||||
public static LineCounts Visit(SyntaxToken identifier, SyntaxNode body)
|
||||
{
|
||||
int start = identifier.GetLocation().SourceSpan.Start;
|
||||
int end = body.GetLocation().SourceSpan.End - 1;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Semmle.Extraction.CommentProcessing
|
||||
|
||||
// Ensure that commentBlock and element refer to the same file
|
||||
// which can happen when processing multiple files.
|
||||
void EnsureSameFile(ICommentBlock commentBlock, ref KeyValuePair<Location, Label>? element)
|
||||
static void EnsureSameFile(ICommentBlock commentBlock, ref KeyValuePair<Location, Label>? element)
|
||||
{
|
||||
if (element != null && element.Value.Key.SourceTree != commentBlock.Location.SourceTree)
|
||||
element = null;
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Semmle.Extraction
|
||||
|
||||
public readonly Layout.SubProject Directories;
|
||||
|
||||
string? ReadVariable(string name, string line)
|
||||
static string? ReadVariable(string name, string line)
|
||||
{
|
||||
string prefix = name + "=";
|
||||
if (!line.StartsWith(prefix))
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace SemmleTests.Semmle.Util
|
||||
CleanUp();
|
||||
}
|
||||
|
||||
void CleanUp()
|
||||
static void CleanUp()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Semmle.Util
|
||||
GetRealPath("."); // Test that it works
|
||||
}
|
||||
|
||||
string GetRealPath(string path)
|
||||
static string GetRealPath(string path)
|
||||
{
|
||||
path = UnixPath.GetFullPath(path);
|
||||
return UnixPath.GetCompleteRealPath(path);
|
||||
|
||||
Reference in New Issue
Block a user