Skip to content

Commit 48f8710

Browse files
committed
fix(ci): analyze commits should scan complete commit range.
1 parent a61e2e9 commit 48f8710

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ before_script:
6767
- "sh -e /etc/init.d/xvfb start"
6868
- mkdir -p $LOGS_DIR
6969
- npm run tslint
70-
- "node ./scripts/ci/analyze-commits.js"
70+
- "node ./scripts/ci/forbidden-identifiers.js"
7171

7272

7373
script:

scripts/ci/analyze-commits.js renamed to scripts/ci/forbidden-identifiers.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ var blocked_statements = [
1616
];
1717

1818
var blockedRegex = new RegExp('\\+.*(' + blocked_statements.join('|') + ').*$', 'mg');
19+
var commit_range = process.env.TRAVIS_COMMIT_RANGE || 'HEAD~1';
1920

20-
var diff = child_process.execSync('git diff --unified=0 HEAD~1 ./src ./e2e').toString();
21-
var isInvalid = blockedRegex.test(diff);
21+
var diff = child_process.execSync(
22+
'git diff --unified=0 ' + commit_range + ' ./src ./e2e'
23+
).toString();
24+
25+
if (blockedRegex.test(diff)) {
2226

23-
if (isInvalid) {
2427
console.warn('Warning: You are using a statement in your commit, which is not allowed.\n' +
2528
'Blocked Statements are: ' + blocked_statements.join(', ') + '\n' +
2629
'Please remove them, and the CI will continue.');
2730
process.exit(1);
31+
2832
} else {
2933
console.log('Info: The commits have been analyzed and are valid!');
3034
}

0 commit comments

Comments
 (0)