mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Fix length/emptiness checks
This commit is contained in:
@@ -170,7 +170,7 @@ namespace Semmle.Autobuild.CSharp
|
||||
{
|
||||
return BuildScript.Bind(GetInstalledSdksScript(builder.Actions), (sdks, sdksRet) =>
|
||||
{
|
||||
if (sdksRet == 0 && sdks.Count() == 1 && sdks[0].StartsWith(version + " ", StringComparison.Ordinal))
|
||||
if (sdksRet == 0 && sdks.Count == 1 && sdks[0].StartsWith(version + " ", StringComparison.Ordinal))
|
||||
// The requested SDK is already installed (and no other SDKs are installed), so
|
||||
// no need to reinstall
|
||||
return BuildScript.Failure;
|
||||
|
||||
@@ -555,7 +555,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
yield return Tuples.cil_method(this, Name, DeclaringType, constructedTypeSignature.ReturnType);
|
||||
yield return Tuples.cil_method_source_declaration(this, SourceDeclaration);
|
||||
|
||||
if (typeParams.Count() != unboundMethod.GenericParameterCount)
|
||||
if (typeParams.Length != unboundMethod.GenericParameterCount)
|
||||
throw new InternalError("Method type parameter mismatch");
|
||||
|
||||
for (int p = 0; p < typeParams.Length; ++p)
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
static Namespace? createParentNamespace(Context cx, string fqn)
|
||||
{
|
||||
if (fqn == "") return null;
|
||||
if (fqn.Length == 0) return null;
|
||||
var i = fqn.LastIndexOf('.');
|
||||
return i == -1 ? cx.GlobalNamespace : cx.Populate(new Namespace(cx, fqn.Substring(0, i)));
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ namespace Semmle.Extraction.CSharp.Standalone
|
||||
|
||||
output.Log(Severity.Info, "Running C# standalone extractor");
|
||||
using var a = new Analysis(output, options);
|
||||
int sourceFiles = a.Extraction.Sources.Count();
|
||||
int sourceFileCount = a.Extraction.Sources.Count;
|
||||
|
||||
if (sourceFiles == 0)
|
||||
if (sourceFileCount == 0)
|
||||
{
|
||||
output.Log(Severity.Error, "No source files found");
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user