mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C#: Base API Abuse/UncheckedReturnValue test case on stubs, clean up test and update expected output.
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
class HashSet<T>
|
||||
{
|
||||
public bool Add(T t)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
class C1
|
||||
{
|
||||
@@ -30,11 +25,6 @@ class C1
|
||||
}
|
||||
}
|
||||
|
||||
class StringBuilder
|
||||
{
|
||||
public StringBuilder Append(string s) { return this; }
|
||||
}
|
||||
|
||||
class C2
|
||||
{
|
||||
static void Main(string[] args)
|
||||
@@ -59,20 +49,6 @@ class C2
|
||||
}
|
||||
}
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
public abstract class Stream
|
||||
{
|
||||
public abstract int Read(byte[] buffer, int offset, int count);
|
||||
public virtual int ReadByte() { return 0; }
|
||||
}
|
||||
|
||||
public class MemoryStream : Stream
|
||||
{
|
||||
public override int Read(byte[] buffer, int offset, int count) { return 0; }
|
||||
}
|
||||
}
|
||||
|
||||
class C3
|
||||
{
|
||||
static void Main(string[] args)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
| UncheckedReturnValue.cs:29:9:29:31 | call to method Add | Result of call to 'Add' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValue.cs:91:9:91:26 | call to method Read | Result of call to 'Read' is ignored, but should always be checked. |
|
||||
| UncheckedReturnValue.cs:92:9:92:20 | call to method ReadByte | Result of call to 'ReadByte' is ignored, but should always be checked. |
|
||||
| UncheckedReturnValue.cs:109:9:109:17 | call to method M1<Int32> | Result of call to 'M1<Int32>' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValue.cs:130:9:130:21 | call to method M2<Decimal> | Result of call to 'M2<Decimal>' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValue.cs:142:9:142:20 | call to method M3<C6> | Result of call to 'M3<C6>' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValue.cs:24:9:24:31 | call to method Add | Result of call to 'Add' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValue.cs:67:9:67:26 | call to method Read | Result of call to 'Read' is ignored, but should always be checked. |
|
||||
| UncheckedReturnValue.cs:68:9:68:20 | call to method ReadByte | Result of call to 'ReadByte' is ignored, but should always be checked. |
|
||||
| UncheckedReturnValue.cs:85:9:85:17 | call to method M1<Int32> | Result of call to 'M1<Int32>' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValue.cs:106:9:106:21 | call to method M2<Decimal> | Result of call to 'M2<Decimal>' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValue.cs:118:9:118:20 | call to method M3<C6> | Result of call to 'M3<C6>' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValueBad.cs:29:9:29:20 | call to method DoPrint | Result of call to 'DoPrint' is ignored, but 90% of calls to this method have their result used. |
|
||||
| UncheckedReturnValueBad.cs:36:13:36:40 | call to method Read | Result of call to 'Read' is ignored, but should always be checked. |
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
semmle-extractor-options: /nostdlib /noconfig
|
||||
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
|
||||
Reference in New Issue
Block a user