File tree Expand file tree Collapse file tree 9 files changed +155
-0
lines changed
csharp/ql/src/Diagnostics
javascript/ql/src/Diagnostics
python/ql/src/Diagnostics
ruby/ql/src/queries/diagnostics
rust/ql/src/queries/diagnostics Expand file tree Collapse file tree 9 files changed +155
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id cpp/diagnostics/extraction-errors
6
+ */
7
+
8
+ import cpp
9
+ import ExtractionErrors
10
+
11
+ from ExtractionError error
12
+ select error .getFile ( ) , error .getErrorMessage ( )
13
+
14
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction error msft
3
+ * @description An error message reported by the extractor, limited to those files where there are no
4
+ * compilation errors. This indicates a bug or limitation in the extractor, and could lead
5
+ * to inaccurate results.
6
+ * @kind diagnostic
7
+ * @id cs/extraction-error-msft
8
+ * @tags security
9
+ */
10
+
11
+ import csharp
12
+ import semmle.code.csharp.commons.Diagnostics
13
+
14
+ from ExtractorError error
15
+ select error .getLocation ( ) .getFile ( ) , error .getText ( )
16
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @id go/diagnostics/extraction-errors-msft
3
+ * @name Extraction errors msft
4
+ * @description List all extraction errors for files in the source code directory.
5
+ * @kind diagnostic
6
+ */
7
+
8
+ import go
9
+ import semmle.go.DiagnosticsReporting
10
+
11
+ // Go does not have warnings, so all errors have error severity
12
+ predicate reportableDiagnosticsMsft ( Diagnostic d , File f , string msg ) {
13
+ // Only report errors for files that would have been extracted
14
+ f = d .getFile ( ) and
15
+ exists ( f .getAChild ( ) ) and
16
+ msg = removeAbsolutePaths ( d .getMessage ( ) )
17
+ }
18
+
19
+ from Diagnostic d , File f , string msg
20
+ where reportableDiagnostics ( d , f , msg )
21
+ select f , msg
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description A list of extraction errors for files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id java/diagnostics/extraction-errors-msft
6
+ */
7
+
8
+ import java
9
+ import DiagnosticsReporting
10
+
11
+ private predicate knownErrorsMsft ( Diagnostic d , File f , string msg ) {
12
+ d .getSeverity ( ) = [ 6 , 7 , 8 ] and
13
+ f = d .getLocation ( ) .getFile ( )
14
+ msg = d .getMessage ( )
15
+ }
16
+
17
+ private predicate unknownErrorsMsft ( Diagnostic d , File f , string msg ) {
18
+ not knownErrors ( d , _, _) and
19
+ d .getSeverity ( ) > 3 and
20
+ d .getLocation ( ) .getFile ( ) = f and
21
+ exists ( f .getRelativePath ( ) ) and
22
+ msg = "Unknown error"
23
+ }
24
+
25
+ from Diagnostic d , File f , string msg
26
+ where
27
+ knownErrorsMsft ( Diagnostic d , File f , string msg ) or
28
+ unknownErrorsMsft( Diagnostic d, File f , string msg )
29
+ select f, msg
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id js/diagnostics/extraction-errors-msft
6
+ */
7
+
8
+ import javascript
9
+
10
+ from Error error
11
+ where
12
+ exists ( error .getFile ( ) .getRelativePath ( ) ) and
13
+ error .isFatal ( )
14
+ select error .getFile ( ) , error .getMessage ( )
15
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Python extraction warnings msft
3
+ * @description List all extraction warnings for Python files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id py/diagnostics/extraction-warnings-msft
6
+ */
7
+
8
+ import python
9
+
10
+ from SyntaxError error , File file
11
+ where
12
+ file = error .getFile ( ) and
13
+ exists ( file .getRelativePath ( ) )
14
+ select file , error .getMessage ( )
15
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id rb/diagnostics/extraction-errors-msft
6
+ */
7
+
8
+ import codeql.ruby.AST
9
+ import codeql.ruby.Diagnostics
10
+
11
+ from ExtractionError error , File f
12
+ where
13
+ f = error .getLocation ( ) .getFile ( ) and
14
+ exists ( f .getRelativePath ( ) )
15
+ select f , error .getMessage ( )
16
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors msft
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id rust/diagnostics/extraction-errors-msft
6
+ */
7
+
8
+ import codeql.rust.Diagnostics
9
+ import codeql.files.FileSystem
10
+
11
+ from ExtractionError error , File f
12
+ where
13
+ f = error .getLocation ( ) .getFile ( ) and
14
+ exists ( f .getRelativePath ( ) )
15
+ select f , error .getMessage ( )
16
+
17
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Compiler errors msft
3
+ * @description List all compiler errors for files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id swift/diagnostics/extraction-errors-msft
6
+ */
7
+
8
+ import swift
9
+
10
+ from CompilerError error
11
+ select error .getFile ( ) , error .getText ( )
12
+
You can’t perform that action at this time.
0 commit comments