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

Unified Diff: tools/line_doc_comments.dart

Issue 178843003: [html5lib] triple slash comment style (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove extra check Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: tools/line_doc_comments.dart
diff --git a/tools/line_doc_comments.dart b/tools/line_doc_comments.dart
index 5f3448cf75565ca8f95a29009e6ca935a2748004..705065d8dd554900e9167df19f127bd1363af3cd 100755
--- a/tools/line_doc_comments.dart
+++ b/tools/line_doc_comments.dart
@@ -33,18 +33,21 @@ main(List<String> args) {
void fixFile(String path) {
var file = new File(path);
- file.readAsLines().then(fixContents).then((fixed) {
+ file.readAsLines().then((lines) => fixContents(lines, path)).then((fixed) {
return new File(path).writeAsString(fixed);
}).then((file) {
print(file.path);
});
}
-String fixContents(List<String> lines) {
+String fixContents(List<String> lines, String path) {
var buffer = new StringBuffer();
+ var linesOut = 0;
var inBlock = false;
var indent;
+
for (var line in lines) {
+ var oldLine = line;
if (inBlock) {
// See if it's the end of the comment.
if (endBlock.hasMatch(line)) {
@@ -92,7 +95,21 @@ String fixContents(List<String> lines) {
}
}
- if (line != null) buffer.write('$line\n');
+ if (line != null) {
+ linesOut++;
+
+ // Warn about lines that crossed 80 columns as a result of the change.
+ if (line.length > 80 && oldLine.length <= 80) {
+ const _PURPLE = '\u001b[35m';
+ const _RED = '\u001b[31m';
+ const _NO_COLOR = '\u001b[0m';
+
+ print('$_PURPLE$path$_NO_COLOR:$_RED$linesOut$_NO_COLOR: '
+ 'line exceeds 80 cols:\n $line');
+ }
+
+ buffer.write('$line\n');
+ }
}
return buffer.toString();
« pkg/third_party/html5lib/lib/dom.dart ('K') | « pkg/third_party/html5lib/test/tokenizer_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698