mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Merge pull request #19199 from michaelnebel/csharp/synctestfiles
C#: Accept file sync mismatch for C# testfiles.
This commit is contained in:
@@ -114,15 +114,6 @@ class Test
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
||||
class Bad
|
||||
{
|
||||
long GetLength(string file)
|
||||
{
|
||||
var stream = new FileStream(file, FileMode.Open); // $ Alert
|
||||
return stream.Length;
|
||||
}
|
||||
}
|
||||
|
||||
static class Extensions
|
||||
{
|
||||
public static FileStream Fluent(this FileStream fs) => fs;
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
| NoDisposeCallOnLocalIDisposable.cs:76:25:76:71 | call to method Create | Disposable 'XmlReader' is created but not disposed. |
|
||||
| NoDisposeCallOnLocalIDisposable.cs:76:42:76:64 | object creation of type StringReader | Disposable 'StringReader' is created but not disposed. |
|
||||
| NoDisposeCallOnLocalIDisposable.cs:104:23:104:38 | object creation of type HttpClient | Disposable 'HttpClient' is created but not disposed. |
|
||||
| NoDisposeCallOnLocalIDisposable.cs:121:22:121:56 | object creation of type FileStream | Disposable 'FileStream' is created but not disposed. |
|
||||
| NoDisposeCallOnLocalIDisposableBad.cs:8:22:8:56 | object creation of type FileStream | Disposable 'FileStream' is created but not disposed. |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
class Bad
|
||||
{
|
||||
long GetLength(string file)
|
||||
{
|
||||
var stream = new FileStream(file, FileMode.Open); // $ Alert
|
||||
return stream.Length;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
| ConstantCondition.cs:114:13:114:14 | access to parameter b1 | Condition always evaluates to 'true'. |
|
||||
| ConstantCondition.cs:114:19:114:20 | access to parameter b2 | Condition always evaluates to 'true'. |
|
||||
| ConstantCondition.cs:141:22:141:22 | _ | Pattern always matches. |
|
||||
| ConstantConditionBad.cs:5:16:5:20 | ... > ... | Condition always evaluates to 'false'. |
|
||||
| ConstantConditionalExpressionCondition.cs:11:22:11:34 | ... == ... | Condition always evaluates to 'true'. |
|
||||
| ConstantConditionalExpressionCondition.cs:12:21:12:25 | false | Condition always evaluates to 'false'. |
|
||||
| ConstantConditionalExpressionCondition.cs:13:21:13:30 | ... == ... | Condition always evaluates to 'true'. |
|
||||
@@ -19,7 +20,6 @@
|
||||
| ConstantIfCondition.cs:11:17:11:29 | ... == ... | Condition always evaluates to 'true'. |
|
||||
| ConstantIfCondition.cs:14:17:14:21 | false | Condition always evaluates to 'false'. |
|
||||
| ConstantIfCondition.cs:17:17:17:26 | ... == ... | Condition always evaluates to 'true'. |
|
||||
| ConstantIfCondition.cs:30:20:30:24 | ... > ... | Condition always evaluates to 'false'. |
|
||||
| ConstantIsNullOrEmpty.cs:10:21:10:54 | call to method IsNullOrEmpty | Condition always evaluates to 'false'. |
|
||||
| ConstantIsNullOrEmpty.cs:46:21:46:46 | call to method IsNullOrEmpty | Condition always evaluates to 'true'. |
|
||||
| ConstantIsNullOrEmpty.cs:50:21:50:44 | call to method IsNullOrEmpty | Condition always evaluates to 'true'. |
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class Bad
|
||||
{
|
||||
public int Max(int a, int b)
|
||||
{
|
||||
return a > a ? a : b; // $ Alert
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,6 @@ namespace ConstantIfCondition
|
||||
}
|
||||
}
|
||||
|
||||
public int Max(int a, int b)
|
||||
{
|
||||
return a > a ? a : b; // $ Alert
|
||||
}
|
||||
|
||||
public int Bar()
|
||||
{
|
||||
return ZERO;
|
||||
|
||||
Reference in New Issue
Block a user