Skip to content

Commit 5936624

Browse files
committed
chore(lint): re-enable clang-format on tools/
1 parent 8372367 commit 5936624

File tree

6 files changed

+30
-42
lines changed

6 files changed

+30
-42
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ env:
4040
matrix:
4141
# Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete.
4242
- CI_MODE=js
43-
# disabled because it currently doesn't do anything
44-
#- CI_MODE=lint
4543
- CI_MODE=e2e
4644
- CI_MODE=saucelabs_required
4745
- CI_MODE=browserstack_required

circle.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,7 @@ machine:
55
dependencies:
66
pre:
77
- npm install -g npm
8-
override:
9-
- npm install:
10-
environment:
11-
# Token for tsd to increase github rate limit
12-
# See https://github.com/DefinitelyTyped/tsd#tsdrc
13-
# This is not hidden using https://circleci.com/docs/fork-pr-builds#details
14-
# because those are not visible for pull requests, and those should also be reliable.
15-
# This SSO token belongs to github account angular-github-ratelimit-token which has no access
16-
# (password is in Valentine)
17-
TSD_GITHUB_TOKEN: ef474500309daea53d5991b3079159a29520a40b
188

199
test:
2010
override:
21-
- npm run build
11+
- gulp lint

gulpfile.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,30 @@
33
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
44
// This is to ensure that we catch env issues before we error while requiring other dependencies.
55
require('./tools/check-environment')(
6-
{requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'});
6+
{requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'});
77

88

9-
let gulp = require('gulp');
9+
const gulp = require('gulp');
10+
const path = require('path');
1011

12+
const srcsToFmt = ['tools/**/*.ts'];
1113

12-
gulp.task('tools:build', (done) => {
13-
tsc('tools/', done)
14+
gulp.task('lint', () => {
15+
const format = require('gulp-clang-format');
16+
const clangFormat = require('clang-format');
17+
return gulp.src(srcsToFmt).pipe(
18+
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
1419
});
1520

21+
gulp.task('format', () => {
22+
const format = require('gulp-clang-format');
23+
const clangFormat = require('clang-format');
24+
return gulp.src(srcsToFmt, { base: '.' }).pipe(
25+
format.format('file', clangFormat)).pipe(gulp.dest('.'));
26+
});
27+
28+
gulp.task('tools:build', (done) => { tsc('tools/', done); });
29+
1630

1731
gulp.task('serve', () => {
1832
let connect = require('gulp-connect');
@@ -23,19 +37,17 @@ gulp.task('serve', () => {
2337
port: 8000,
2438
livereload: false,
2539
open: false,
26-
middleware: (connect, opt) => {
27-
return [cors()];
28-
}
40+
middleware: (connect, opt) => [cors()]
2941
});
3042
});
3143

3244

3345
function tsc(projectPath, done) {
3446
let child_process = require('child_process');
3547

36-
child_process.spawn(
37-
`${__dirname}/node_modules/.bin/tsc`,
38-
['-p', `${__dirname}/projectPath`],
39-
{stdio: 'inherit'}
40-
).on('close', (errorCode) => done(errorCode));
48+
child_process
49+
.spawn(
50+
`${__dirname}/node_modules/.bin/tsc`, ['-p', path.join(__dirname, projectPath)],
51+
{stdio: 'inherit'})
52+
.on('close', (errorCode) => done(errorCode));
4153
}

scripts/ci-lite/lint.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

scripts/ci-lite/test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ cd `dirname $0`
99
source ./env.sh
1010
cd ../..
1111

12-
./scripts/ci-lite/lint.sh
1312
./scripts/ci-lite/test_js.sh
1413
./scripts/ci-lite/test_e2e.sh
1514
./scripts/ci-lite/test_saucelabs.sh

tools/check-environment.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ function printWarning(issues) {
7979
console.warn('');
8080
console.warn(Array(110).join('!'));
8181
console.warn('!!! Your environment is not in a good shape. Following issues were found:');
82-
issues.forEach(function(issue) {console.warn('!!! - ' + issue)});
82+
issues.forEach(function(issue) {console.warn('!!! - ' + issue);});
8383
console.warn(Array(110).join('!'));
8484
console.warn('');
85+
86+
if (process.env.CI) {
87+
process.exit(1);
88+
}
8589
}
8690

8791

0 commit comments

Comments
 (0)