From 48130670ca8dc3f2ef4def0a08d3fb35913f6cd8 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 25 Jun 2013 10:43:27 -0600 Subject: [PATCH] Create separate target for linting generated files This allows us to ignore specific error codes (e.g. LINE_TOO_LONG) for externs, exports, types, etc. (any auto-generated files). --- build.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index 57c4ed2b67..8077cb40a8 100755 --- a/build.py +++ b/build.py @@ -346,19 +346,32 @@ def serve_precommit(t): 'buildcfg/ol-all.json', 'buildcfg/test.json') -virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp', - 'build/check-whitespace-timestamp') +virtual('lint', 'build/lint-timestamp', 'build/lint-generated-timestamp', + 'build/check-requires-timestamp', 'build/check-whitespace-timestamp') -@target('build/lint-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC, - SPEC, precious=True) +@target('build/lint-timestamp', SRC, EXAMPLES_SRC, SPEC, precious=True) def build_lint_src_timestamp(t): + t.run('%(GJSLINT)s', + '--jslint_error=all', + '--strict', + t.newer(t.dependencies)) + t.touch() + + +@target('build/lint-generated-timestamp', INTERNAL_SRC, EXTERNAL_SRC, + precious=True) +def build_lint_generated_timestamp(t): limited_doc_files = [ path for path in ifind('externs', 'build/src/external/externs') if path.endswith('.js')] t.run('%(GJSLINT)s', '--jslint_error=all', + # ignore error for max line length (for these auto-generated sources) + '--disable=110', + # for a complete list of error codes to allow, see + # http://closure-linter.googlecode.com/svn/trunk/closure_linter/errors.py '--limited_doc_files=%s' % (','.join(limited_doc_files),), '--strict', t.newer(t.dependencies))