Release dart_style 0.2.0-rc.1.
R=kevmoo@google.com, pquitslund@google.com
Review URL: https://chromiumcodereview.appspot.com//1193863004.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 97e64eb..e4d1e0f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,31 +10,30 @@
In particular, it forces argument and parameter lists to go one-per-line if
they don't all fit in two lines. And it allows function and collection
literals inside expressions to indent like expressions in some contexts.
+ (#78, #97, #101, #123, #139, #141, #142, #143, et. al.)
- (#78, #97, #101, #123, #139, #141, #142, #143)
-
-* Allow splitting inside with and implements clauses (#228, #259).
-* Preserve mandatory newlines in inline block comments (#178).
-* Allow multiple variable declarations on one line if they fit (#155).
-* Splitting inside type parameter and type argument lists (#184).
-* Enforce a blank line before and after classes (#168).
-* Re-indent line doc comments even if they are flush left (#192).
-* More precisely control newlines between declarations (#173).
-* Nest cascades like expressions (#200, #203, #205, #221, #236).
-* Do not nest blocks inside single-argument function and method calls.
-* Do nest blocks inside `=>` functions.
-* Set failure exit code for malformed input when reading from stdin (#359).
* Indent cascades more deeply when the receiver is a method call (#137).
* Preserve newlines in collections containing line comments (#139).
+* Allow multiple variable declarations on one line if they fit (#155).
* Prefer splitting at "." on non-identifier method targets (#161).
+* Enforce a blank line before and after classes (#168).
+* More precisely control newlines between declarations (#173).
+* Preserve mandatory newlines in inline block comments (#178).
+* Splitting inside type parameter and type argument lists (#184).
* Nest blocks deeper inside a wrapped conditional operator (#186).
* Split named arguments if the positional arguments split (#189).
+* Re-indent line doc comments even if they are flush left (#192).
+* Nest cascades like expressions (#200, #203, #205, #221, #236).
* Prefer splitting after `=>` over other options (#217).
* Nested non-empty collections force surrounding ones to split (#223).
+* Allow splitting inside with and implements clauses (#228, #259).
* Allow splitting after `=` in a constructor initializer (#242).
* If a `=>` function's parameters split, split after the `=>` too (#250).
* Allow splitting between successive index operators (#256).
* Correctly indent wrapped constructor initializers (#257).
+* Set failure exit code for malformed input when reading from stdin (#359).
+* Do not nest blocks inside single-argument function and method calls.
+* Do nest blocks inside `=>` functions.
# 0.1.8
diff --git a/bin/format.dart b/bin/format.dart
index 1f10b78..dd74199 100644
--- a/bin/format.dart
+++ b/bin/format.dart
@@ -154,8 +154,8 @@
selectionStart: selectionStart,
selectionLength: selectionLength);
var output = formatter.formatSource(source);
- options.reporter.showFile(null, "<stdin>", output,
- changed: source != output);
+ options.reporter
+ .showFile(null, "<stdin>", output, changed: source != output);
return true;
} on FormatterException catch (err) {
stderr.writeln(err.message());
diff --git a/lib/src/chunk_builder.dart b/lib/src/chunk_builder.dart
index 95899dd..51387c0 100644
--- a/lib/src/chunk_builder.dart
+++ b/lib/src/chunk_builder.dart
@@ -159,17 +159,17 @@
///
/// If [isDouble] is passed, forces the split to either be a single or double
/// newline. Otherwise, leaves it indeterminate.
- Chunk split({bool space, bool isDouble, bool flushLeft}) => _writeSplit(
- _rules.last, null,
- flushLeft: flushLeft, isDouble: isDouble, spaceWhenUnsplit: space);
+ Chunk split({bool space, bool isDouble, bool flushLeft}) =>
+ _writeSplit(_rules.last, null,
+ flushLeft: flushLeft, isDouble: isDouble, spaceWhenUnsplit: space);
/// Write a split owned by the current innermost rule.
///
/// Unlike [split()], this ignores any current expression nesting. It always
/// indents the next line at the statement level.
- Chunk blockSplit({bool space, bool isDouble}) => _writeSplit(
- _rules.last, _nesting.blockNesting,
- isDouble: isDouble, spaceWhenUnsplit: space);
+ Chunk blockSplit({bool space, bool isDouble}) =>
+ _writeSplit(_rules.last, _nesting.blockNesting,
+ isDouble: isDouble, spaceWhenUnsplit: space);
/// Outputs the series of [comments] and associated whitespace that appear
/// before [token] (which is not written by this).
diff --git a/lib/src/io.dart b/lib/src/io.dart
index b06f0f2..765ac3e 100644
--- a/lib/src/io.dart
+++ b/lib/src/io.dart
@@ -55,8 +55,8 @@
try {
var source = new SourceCode(file.readAsStringSync(), uri: file.path);
var output = formatter.formatSource(source);
- options.reporter.showFile(file, label, output,
- changed: source.text != output.text);
+ options.reporter
+ .showFile(file, label, output, changed: source.text != output.text);
return true;
} on FormatterException catch (err) {
var color = Platform.operatingSystem != "windows" &&
diff --git a/lib/src/line_prefix.dart b/lib/src/line_prefix.dart
index 992df83..f8a7075 100644
--- a/lib/src/line_prefix.dart
+++ b/lib/src/line_prefix.dart
@@ -80,9 +80,9 @@
/// Create a new LinePrefix one chunk longer than this one using [ruleValues],
/// and assuming that we do not split before that chunk.
- LinePrefix extend(Map<Rule, int> ruleValues) => new LinePrefix._(
- length + 1, ruleValues, _indent, _nesting,
- flushLeft: _flushLeft);
+ LinePrefix extend(Map<Rule, int> ruleValues) =>
+ new LinePrefix._(length + 1, ruleValues, _indent, _nesting,
+ flushLeft: _flushLeft);
/// Create a series of new LinePrefixes one chunk longer than this one using
/// [ruleValues], and assuming that the new [chunk] splits at an expression
diff --git a/lib/src/line_writer.dart b/lib/src/line_writer.dart
index 2bb5325..a2aef01 100644
--- a/lib/src/line_writer.dart
+++ b/lib/src/line_writer.dart
@@ -109,8 +109,8 @@
var chunk = _chunks[i];
if (!chunk.canDivide) continue;
- totalCost += _completeLine(newlines, indent, start, i + 1,
- flushLeft: flushLeft);
+ totalCost +=
+ _completeLine(newlines, indent, start, i + 1, flushLeft: flushLeft);
// Get ready for the next line.
newlines = chunk.isDouble ? 2 : 1;
diff --git a/lib/src/rule/rule.dart b/lib/src/rule/rule.dart
index f2d1bf4..1fdadef 100644
--- a/lib/src/rule/rule.dart
+++ b/lib/src/rule/rule.dart
@@ -132,9 +132,8 @@
SimpleRule({int cost, bool splitsOnInnerRules})
: cost = cost != null ? cost : Cost.normal,
- splitsOnInnerRules = splitsOnInnerRules != null
- ? splitsOnInnerRules
- : true;
+ splitsOnInnerRules =
+ splitsOnInnerRules != null ? splitsOnInnerRules : true;
bool isSplit(int value, Chunk chunk) => value == 1;
diff --git a/pubspec.lock b/pubspec.lock
index 0e7b01e..b81170f 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -64,7 +64,7 @@
scheduled_test:
description: scheduled_test
source: hosted
- version: "0.12.0+1"
+ version: "0.12.1"
shelf:
description: shelf
source: hosted
@@ -100,11 +100,11 @@
test:
description: test
source: hosted
- version: "0.12.3"
+ version: "0.12.3+2"
watcher:
description: watcher
source: hosted
- version: "0.9.5"
+ version: "0.9.6"
yaml:
description: yaml
source: hosted
diff --git a/pubspec.yaml b/pubspec.yaml
index cfa5b1c..50281ce 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: dart_style
-version: 0.2.0-dev
+version: 0.2.0-rc.1
author: Dart Team <misc@dartlang.org>
description: Opinionated, automatic Dart source code formatter.
homepage: https://github.com/dart-lang/dart_style
@@ -7,7 +7,7 @@
analyzer: '>=0.25.0 <0.26.0'
args: '>=0.12.1 <0.14.0'
path: '>=1.0.0 <2.0.0'
- source_span: '>=1.0.0 <2.0.0'
+ source_span: '>=1.1.1 <2.0.0'
dev_dependencies:
browser: '>=0.10.0 <0.11.0'
scheduled_test: '>=0.12.0 <0.13.0'
diff --git a/test/io_test.dart b/test/io_test.dart
index f73a003..3962de6 100644
--- a/test/io_test.dart
+++ b/test/io_test.dart
@@ -71,16 +71,18 @@
});
test("skips subdirectories whose name starts with '.'", () {
- d.dir('code', [d.dir('.skip', [d.file('a.dart', unformattedSource)])])
- .create();
+ d.dir('code', [
+ d.dir('.skip', [d.file('a.dart', unformattedSource)])
+ ]).create();
schedule(() {
var dir = new Directory(d.defaultRoot);
processDirectory(overwriteOptions, dir);
}, 'Run formatter.');
- d.dir('code', [d.dir('.skip', [d.file('a.dart', unformattedSource)])])
- .validate();
+ d.dir('code', [
+ d.dir('.skip', [d.file('a.dart', unformattedSource)])
+ ]).validate();
});
test("traverses the given directory even if its name starts with '.'", () {