File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Extraction errors
3
+ * @description List all extraction errors for files in the source code directory.
4
+ * @kind diagnostic
5
+ * @id js/diagnostics/extraction-errors
6
+ */
7
+
8
+ import javascript
9
+
10
+ /** Gets the SARIF severity to associate an error. */
11
+ int getSeverity ( ) { result = 2 }
12
+
13
+ from Error error
14
+ where
15
+ exists ( error .getFile ( ) .getRelativePath ( ) ) and
16
+ error .isFatal ( )
17
+ select error , "Extraction failed in " + error .getFile ( ) + " with error " + error .getMessage ( ) ,
18
+ getSeverity ( )
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @name Successfully extracted files
3
+ * @description Lists all files in the source code directory that were extracted without encountering an error in the file.
4
+ * @kind diagnostic
5
+ * @id js/diagnostics/successfully-extracted-files
6
+ */
7
+
8
+ import javascript
9
+
10
+ from File f
11
+ where
12
+ not exists ( Error e | e .isFatal ( ) and e .getFile ( ) = f ) and
13
+ exists ( f .getRelativePath ( ) )
14
+ select f , ""
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ abstract class Error extends Locatable {
10
10
abstract string getMessage ( ) ;
11
11
12
12
override string toString ( ) { result = getMessage ( ) }
13
+
14
+ /** Holds if this error prevented the file from being extracted. */
15
+ predicate isFatal ( ) { any ( ) }
13
16
}
14
17
15
18
/** A JavaScript parse error encountered during extraction. */
@@ -21,4 +24,6 @@ class JSParseError extends @js_parse_error, Error {
21
24
22
25
/** Gets the source text of the line this error occurs on. */
23
26
string getLine ( ) { js_parse_errors ( this , _, _, result ) }
27
+
28
+ override predicate isFatal ( ) { not getTopLevel ( ) instanceof Angular2:: TemplateTopLevel }
24
29
}
Original file line number Diff line number Diff line change @@ -827,6 +827,8 @@ class RegExpParseError extends Error, @regexp_parse_error {
827
827
override string getMessage ( ) { regexp_parse_errors ( this , _, result ) }
828
828
829
829
override string toString ( ) { result = getMessage ( ) }
830
+
831
+ override predicate isFatal ( ) { none ( ) }
830
832
}
831
833
832
834
/**
You can’t perform that action at this time.
0 commit comments