mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
C#: Add extraction error diagnostic query
This commit is contained in:
18
csharp/ql/src/Diagnostics/DiagnosticExtractionErrors.ql
Normal file
18
csharp/ql/src/Diagnostics/DiagnosticExtractionErrors.ql
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @name Extraction errors
|
||||
* @description List all errors reported by the extractor. The returned issues are
|
||||
* limited to those files where there are no compilation errors. This
|
||||
* indicates a bug or limitation in the extractor, and could lead to
|
||||
* inaccurate results.
|
||||
* @kind diagnostic
|
||||
* @id cs/diagnostics/extraction-errors
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import semmle.code.csharp.commons.Diagnostics
|
||||
|
||||
from ExtractorError error
|
||||
where not exists(CompilerError ce | ce.getLocation().getFile() = error.getLocation().getFile())
|
||||
select error,
|
||||
"Unexpected " + error.getOrigin() + " error: " + error.getText() + " in " +
|
||||
error.getLocation().getFile(), 3
|
||||
@@ -0,0 +1 @@
|
||||
Diagnostics/DiagnosticExtractionErrors.ql
|
||||
17
csharp/ql/test/library-tests/diagnostics/Program.cs
Normal file
17
csharp/ql/test/library-tests/diagnostics/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
// semmle-extractor-options: --standalone
|
||||
|
||||
using System;
|
||||
|
||||
class Class
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int z = GetParamLength(__arglist(1, 2));
|
||||
}
|
||||
|
||||
public static int GetParamLength(__arglist)
|
||||
{
|
||||
ArgIterator iterator = new ArgIterator(__arglist);
|
||||
return iterator.GetRemainingCount();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user