File tree Expand file tree Collapse file tree 6 files changed +41
-26
lines changed
test/query-tests/Diagnostics Expand file tree Collapse file tree 6 files changed +41
-26
lines changed Original file line number Diff line number Diff line change
1
+ codescanning
2
+ * Problems with extraction that in most cases won't completely break the analysis are now reported as warnings rather than errors.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Python extraction warnings
3
+ * @description List all extraction warnings for Python files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id py/diagnostics/extraction-warnings
6
+ */
7
+
8
+ import python
9
+
10
+ /**
11
+ * Gets the SARIF severity for warnings.
12
+ *
13
+ * See https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338
14
+ */
15
+ int getWarningSeverity ( ) { result = 1 }
16
+
17
+ // The spec
18
+ // https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338
19
+ // defines error and warning as:
20
+ //
21
+ // "error": A serious problem was found. The condition encountered by the tool resulted
22
+ // in the analysis being halted or caused the results to be incorrect or incomplete.
23
+ //
24
+ // "warning": A problem that is not considered serious was found. The condition
25
+ // encountered by the tool is such that it is uncertain whether a problem occurred, or
26
+ // is such that the analysis might be incomplete but the results that were generated are
27
+ // probably valid.
28
+ //
29
+ // So SyntaxErrors are reported at the warning level, since analysis might be incomplete
30
+ // but the results that were generated are probably valid.
31
+ from SyntaxError error , File file
32
+ where
33
+ file = error .getFile ( ) and
34
+ exists ( file .getRelativePath ( ) )
35
+ select error , "Extraction failed in " + file + " with error " + error .getMessage ( ) ,
36
+ getWarningSeverity ( )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- | bad_encoding.py:2:11:2:11 | Encoding Error | Extraction failed in bad_encoding.py with error 'utf-8' codec can't decode byte 0x9d in position 87: invalid start byte | 2 |
2
- | syntax_error.py:1:31:1:31 | Syntax Error | Extraction failed in syntax_error.py with error Syntax Error | 2 |
1
+ | bad_encoding.py:2:11:2:11 | Encoding Error | Extraction failed in bad_encoding.py with error 'utf-8' codec can't decode byte 0x9d in position 87: invalid start byte | 1 |
2
+ | syntax_error.py:1:31:1:31 | Syntax Error | Extraction failed in syntax_error.py with error Syntax Error | 1 |
Original file line number Diff line number Diff line change
1
+ Diagnostics/ExtractionWarnings.ql
You can’t perform that action at this time.
0 commit comments