Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: pkg/polymer/lib/src/build/linter.dart

Issue 648883002: Add more options to configure the linter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/lib/src/build/common.dart ('k') | pkg/polymer/lib/transformer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Logic to validate that developers are correctly using Polymer constructs. 5 /// Logic to validate that developers are correctly using Polymer constructs.
6 /// This is mainly used to produce warnings for feedback in the editor. 6 /// This is mainly used to produce warnings for feedback in the editor.
7 library polymer.src.build.linter; 7 library polymer.src.build.linter;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:convert'; 10 import 'dart:convert';
11 11
12 import 'package:barback/barback.dart'; 12 import 'package:barback/barback.dart';
13 import 'package:code_transformers/assets.dart'; 13 import 'package:code_transformers/assets.dart';
14 import 'package:code_transformers/messages/build_logger.dart'; 14 import 'package:code_transformers/messages/build_logger.dart';
15 import 'package:code_transformers/messages/messages.dart' show Message; 15 import 'package:code_transformers/messages/messages.dart' show Message;
16 import 'package:html5lib/dom.dart'; 16 import 'package:html5lib/dom.dart';
17 import 'package:html5lib/dom_parsing.dart'; 17 import 'package:html5lib/dom_parsing.dart';
18 import 'package:source_span/source_span.dart'; 18 import 'package:source_span/source_span.dart';
19 19
20 import 'common.dart'; 20 import 'common.dart';
21 import 'utils.dart'; 21 import 'utils.dart';
22 import 'messages.dart'; 22 import 'messages.dart';
23 23
24 /// A linter that checks for common Polymer errors and produces warnings to 24 /// A linter that checks for common Polymer errors and produces warnings to
25 /// show on the editor or the command line. Leaves sources unchanged, but 25 /// show on the editor or the command line. Leaves sources unchanged, but
26 /// creates a new asset containing all the warnings. 26 /// creates a new asset containing all the warnings.
27 class Linter extends Transformer with PolymerTransformer { 27 class Linter extends Transformer with PolymerTransformer {
28 final TransformOptions options; 28 final TransformOptions options;
29 29
30 /// Only run on .html files. 30 Linter(this.options);
31 final String allowedExtensions = '.html';
32 31
33 Linter(this.options); 32 isPrimary(AssetId id) =>
33 id.extension == '.html' && options.lint.shouldLint(id.path);
34 34
35 Future apply(Transform transform) { 35 Future apply(Transform transform) {
36 var seen = new Set<AssetId>(); 36 var seen = new Set<AssetId>();
37 var primary = transform.primaryInput; 37 var primary = transform.primaryInput;
38 var id = primary.id; 38 var id = primary.id;
39 transform.addOutput(primary); // this phase is analysis only 39 transform.addOutput(primary); // this phase is analysis only
40 seen.add(id); 40 seen.add(id);
41 bool isEntryPoint = options.isHtmlEntryPoint(id); 41 bool isEntryPoint = options.isHtmlEntryPoint(id);
42 42
43 var logger = new BuildLogger(transform, 43 var logger = new BuildLogger(transform,
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 upDirCount = segments.length - 2; 448 upDirCount = segments.length - 2;
449 } 449 }
450 var reachOutPrefix = '../' * upDirCount; 450 var reachOutPrefix = '../' * upDirCount;
451 return USE_POLYMER_HTML.create({'reachOutPrefix': reachOutPrefix}); 451 return USE_POLYMER_HTML.create({'reachOutPrefix': reachOutPrefix});
452 } 452 }
453 453
454 const List<String> INTERNALLY_DEFINED_ELEMENTS = 454 const List<String> INTERNALLY_DEFINED_ELEMENTS =
455 const ['auto-binding-dart', 'polymer-element']; 455 const ['auto-binding-dart', 'polymer-element'];
456 const List<String> AUTO_BINDING_ELEMENTS = 456 const List<String> AUTO_BINDING_ELEMENTS =
457 const ['auto-binding-dart', 'auto-binding']; 457 const ['auto-binding-dart', 'auto-binding'];
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/common.dart ('k') | pkg/polymer/lib/transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698