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 {
1010 abstract string getMessage ( ) ;
1111
1212 override string toString ( ) { result = getMessage ( ) }
13+
14+ /** Holds if this error prevented the file from being extracted. */
15+ predicate isFatal ( ) { any ( ) }
1316}
1417
1518/** A JavaScript parse error encountered during extraction. */
@@ -21,4 +24,6 @@ class JSParseError extends @js_parse_error, Error {
2124
2225 /** Gets the source text of the line this error occurs on. */
2326 string getLine ( ) { js_parse_errors ( this , _, _, result ) }
27+
28+ override predicate isFatal ( ) { not getTopLevel ( ) instanceof Angular2:: TemplateTopLevel }
2429}
Original file line number Diff line number Diff line change @@ -827,6 +827,8 @@ class RegExpParseError extends Error, @regexp_parse_error {
827827 override string getMessage ( ) { regexp_parse_errors ( this , _, result ) }
828828
829829 override string toString ( ) { result = getMessage ( ) }
830+
831+ override predicate isFatal ( ) { none ( ) }
830832}
831833
832834/**
You can’t perform that action at this time.
0 commit comments