chore(lint): re-enable clang-format on tools/

This commit is contained in:
Alex Eagle 2016-05-25 19:54:34 -07:00
parent 83723671af
commit 5936624d11
6 changed files with 30 additions and 42 deletions

View File

@ -40,8 +40,6 @@ env:
matrix: matrix:
# Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete. # Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete.
- CI_MODE=js - CI_MODE=js
# disabled because it currently doesn't do anything
#- CI_MODE=lint
- CI_MODE=e2e - CI_MODE=e2e
- CI_MODE=saucelabs_required - CI_MODE=saucelabs_required
- CI_MODE=browserstack_required - CI_MODE=browserstack_required

View File

@ -5,17 +5,7 @@ machine:
dependencies: dependencies:
pre: pre:
- npm install -g npm - npm install -g npm
override:
- npm install:
environment:
# Token for tsd to increase github rate limit
# See https://github.com/DefinitelyTyped/tsd#tsdrc
# This is not hidden using https://circleci.com/docs/fork-pr-builds#details
# because those are not visible for pull requests, and those should also be reliable.
# This SSO token belongs to github account angular-github-ratelimit-token which has no access
# (password is in Valentine)
TSD_GITHUB_TOKEN: ef474500309daea53d5991b3079159a29520a40b
test: test:
override: override:
- npm run build - gulp lint

View File

@ -3,16 +3,30 @@
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE // THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
// This is to ensure that we catch env issues before we error while requiring other dependencies. // This is to ensure that we catch env issues before we error while requiring other dependencies.
require('./tools/check-environment')( require('./tools/check-environment')(
{requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'}); {requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'});
let gulp = require('gulp'); const gulp = require('gulp');
const path = require('path');
const srcsToFmt = ['tools/**/*.ts'];
gulp.task('tools:build', (done) => { gulp.task('lint', () => {
tsc('tools/', done) const format = require('gulp-clang-format');
const clangFormat = require('clang-format');
return gulp.src(srcsToFmt).pipe(
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
}); });
gulp.task('format', () => {
const format = require('gulp-clang-format');
const clangFormat = require('clang-format');
return gulp.src(srcsToFmt, { base: '.' }).pipe(
format.format('file', clangFormat)).pipe(gulp.dest('.'));
});
gulp.task('tools:build', (done) => { tsc('tools/', done); });
gulp.task('serve', () => { gulp.task('serve', () => {
let connect = require('gulp-connect'); let connect = require('gulp-connect');
@ -23,9 +37,7 @@ gulp.task('serve', () => {
port: 8000, port: 8000,
livereload: false, livereload: false,
open: false, open: false,
middleware: (connect, opt) => { middleware: (connect, opt) => [cors()]
return [cors()];
}
}); });
}); });
@ -33,9 +45,9 @@ gulp.task('serve', () => {
function tsc(projectPath, done) { function tsc(projectPath, done) {
let child_process = require('child_process'); let child_process = require('child_process');
child_process.spawn( child_process
`${__dirname}/node_modules/.bin/tsc`, .spawn(
['-p', `${__dirname}/projectPath`], `${__dirname}/node_modules/.bin/tsc`, ['-p', path.join(__dirname, projectPath)],
{stdio: 'inherit'} {stdio: 'inherit'})
).on('close', (errorCode) => done(errorCode)); .on('close', (errorCode) => done(errorCode));
} }

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
set -ex -o pipefail
if [[ ${TRAVIS} && ${CI_MODE} != "lint" ]]; then
exit 0;
fi
echo 'travis_fold:start:lint'
gulp lint
gulp check-format
echo 'travis_fold:end:lint'

View File

@ -9,7 +9,6 @@ cd `dirname $0`
source ./env.sh source ./env.sh
cd ../.. cd ../..
./scripts/ci-lite/lint.sh
./scripts/ci-lite/test_js.sh ./scripts/ci-lite/test_js.sh
./scripts/ci-lite/test_e2e.sh ./scripts/ci-lite/test_e2e.sh
./scripts/ci-lite/test_saucelabs.sh ./scripts/ci-lite/test_saucelabs.sh

View File

@ -79,9 +79,13 @@ function printWarning(issues) {
console.warn(''); console.warn('');
console.warn(Array(110).join('!')); console.warn(Array(110).join('!'));
console.warn('!!! Your environment is not in a good shape. Following issues were found:'); console.warn('!!! Your environment is not in a good shape. Following issues were found:');
issues.forEach(function(issue) {console.warn('!!! - ' + issue)}); issues.forEach(function(issue) {console.warn('!!! - ' + issue);});
console.warn(Array(110).join('!')); console.warn(Array(110).join('!'));
console.warn(''); console.warn('');
if (process.env.CI) {
process.exit(1);
}
} }