File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ before_script:
63
63
- " sh -e /etc/init.d/xvfb start"
64
64
- mkdir -p $LOGS_DIR
65
65
- npm run tslint
66
+ - " node ./scripts/ci/analyze-commits.js"
66
67
67
68
68
69
script :
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ /*
3
+ * This script analyzes the current commits of the CI.
4
+ * It will search for blocked statements, which have been added in the commits and fail if present.
5
+ */
6
+
7
+ var child_process = require ( 'child_process' ) ;
8
+ var blocked_statements = [
9
+ 'ddescribe' ,
10
+ 'fdescribe' ,
11
+ 'iit' ,
12
+ 'fit' ,
13
+ 'xdescribe' ,
14
+ 'xit' ,
15
+ 'debugger;'
16
+ ] ;
17
+
18
+ var blockedRegex = new RegExp ( '\\+.*(' + blocked_statements . join ( '|' ) + ').*$' , 'mg' ) ;
19
+
20
+ var diff = child_process . execSync ( 'git diff --unified=0 HEAD~1 ./src ./e2e' ) . toString ( ) ;
21
+ var isInvalid = blockedRegex . test ( diff ) ;
22
+
23
+ if ( isInvalid ) {
24
+ console . warn ( 'Warning: You are using a statement in your commit, which is not allowed.\n' +
25
+ 'Blocked Statements are: ' + blocked_statements . join ( ', ' ) + '\n' +
26
+ 'Please remove them, and the CI will continue.' ) ;
27
+ process . exit ( 1 ) ;
28
+ } else {
29
+ console . log ( 'Info: The commits have been analyzed and are valid!' ) ;
30
+ }
You can’t perform that action at this time.
0 commit comments