Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/src/platform_util/platform_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ PlatformUtil platformUtil = new StandardPlatformUtil();

abstract class PlatformUtil {
static PlatformUtil retrieve() {
if (platformUtil == null) throw new StateError(
'dart_dev\'s PlatformUtil instance must not be null.');
if (platformUtil == null)
throw new StateError(
'dart_dev\'s PlatformUtil instance must not be null.');
return platformUtil;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/task_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class TaskProcess {
_outc.future.then((_) => _stdout.close());
_errc.future.then((_) => _stderr.close());
process.exitCode.then(_procExitCode.complete);
Future.wait([_outc.future, _errc.future, process.exitCode])
.then((_) => _donec.complete());
Future.wait([_outc.future, _errc.future, process.exitCode]).then(
(_) => _donec.complete());
});
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/tasks/copy_license/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ CopyLicenseTask copyLicense(
CopyLicenseTask task = new CopyLicenseTask();

File license = new File(licensePath);
if (!license.existsSync()) throw new Exception(
'License file "$licensePath" does not exist.');
if (!license.existsSync())
throw new Exception('License file "$licensePath" does not exist.');

String licenseContents = license.readAsStringSync();
licenseContents = trimLeadingAndTrailingEmptyLines(licenseContents);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/tasks/copy_license/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class CopyLicenseCli extends TaskCli {
List<String> directories = config.copyLicense.directories;
String licensePath = config.copyLicense.licensePath;

if (!(new File(licensePath)).existsSync()) return new CliResult.fail(
'License file "$licensePath" does not exist.');
if (!(new File(licensePath)).existsSync())
return new CliResult.fail('License file "$licensePath" does not exist.');

CopyLicenseTask task =
copyLicense(directories: directories, licensePath: licensePath);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/tasks/coverage/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ class CoverageTask extends Task {
}

File _merge(List<File> collections) {
if (collections.isEmpty) throw new ArgumentError(
'Cannot merge an empty list of coverages.');
if (collections.isEmpty)
throw new ArgumentError('Cannot merge an empty list of coverages.');

Map mergedJson = JSON.decode(collections.first.readAsStringSync());
for (int i = 1; i < collections.length; i++) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/tasks/coverage/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class CoverageCli extends TaskCli {
final String command = 'coverage';

Future<CliResult> run(ArgResults parsedArgs) async {
if (!platform_util
.hasImmediateDependency('coverage')) return new CliResult.fail(
'Package "coverage" must be an immediate dependency in order to run its executables.');
if (!platform_util.hasImmediateDependency('coverage'))
return new CliResult.fail(
'Package "coverage" must be an immediate dependency in order to run its executables.');

bool unit = parsedArgs['unit'];
bool integration = parsedArgs['integration'];
Expand Down
5 changes: 3 additions & 2 deletions lib/src/tasks/docs/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ class DocsCli extends TaskCli {
final String command = 'docs';

Future<CliResult> run(ArgResults parsedArgs) async {
if (!hasImmediateDependency('dartdoc')) return new CliResult.fail(
'Package "dartdoc" must be an immediate dependency in order to run its executables.');
if (!hasImmediateDependency('dartdoc'))
return new CliResult.fail(
'Package "dartdoc" must be an immediate dependency in order to run its executables.');

bool open = TaskCli.valueOf('open', parsedArgs, true);

Expand Down
4 changes: 2 additions & 2 deletions lib/src/tasks/examples/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ bool hasExamples() {

ExamplesTask serveExamples(
{String hostname: defaultHostname, int port: defaultPort}) {
if (!hasExamples()) throw new Exception(
'This project does not have any examples.');
if (!hasExamples())
throw new Exception('This project does not have any examples.');

var dartiumExecutable = 'dartium';
var dartiumArgs = ['http://$hostname:$port'];
Expand Down
4 changes: 2 additions & 2 deletions lib/src/tasks/examples/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class ExamplesCli extends TaskCli {
port = int.parse(port);
}

if (!hasExamples()) return new CliResult.fail(
'This project does not have any examples.');
if (!hasExamples())
return new CliResult.fail('This project does not have any examples.');

ExamplesTask task = serveExamples(hostname: hostname, port: port);
reporter.logGroup(task.pubServeCommand,
Expand Down
22 changes: 12 additions & 10 deletions lib/src/tasks/format/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class FormatCli extends TaskCli {

Future<CliResult> run(ArgResults parsedArgs) async {
try {
if (!platform_util
.hasImmediateDependency('dart_style')) return new CliResult.fail(
'Package "dart_style" must be an immediate dependency in order to run its executables.');
if (!platform_util.hasImmediateDependency('dart_style'))
return new CliResult.fail(
'Package "dart_style" must be an immediate dependency in order to run its executables.');
} catch (e) {
// It's possible that this check may throw if the pubspec.yaml
// could not be found or if the yaml could not be parsed.
Expand Down Expand Up @@ -77,18 +77,20 @@ class FormatCli extends TaskCli {
}

if (task.isDryRun) {
if (task.successful) return new CliResult.success(
excludedFilesWarning + 'Your Dart code is good to go!');
if (task.affectedFiles.isEmpty) return new CliResult.fail(
excludedFilesWarning + 'The Dart formatter needs to be run.');
if (task.successful)
return new CliResult.success(
excludedFilesWarning + 'Your Dart code is good to go!');
if (task.affectedFiles.isEmpty)
return new CliResult.fail(
excludedFilesWarning + 'The Dart formatter needs to be run.');
return new CliResult.fail(excludedFilesWarning +
'The Dart formatter needs to be run. The following files require changes:\n ' +
task.affectedFiles.join('\n '));
} else {
if (!task.successful) return new CliResult.fail('Dart formatter failed.');
if (task.affectedFiles.isEmpty) return new CliResult.success(
excludedFilesWarning +
'Success! All files are already formatted correctly.');
if (task.affectedFiles.isEmpty)
return new CliResult.success(excludedFilesWarning +
'Success! All files are already formatted correctly.');
return new CliResult.success(excludedFilesWarning +
'Success! The following files were formatted:\n ' +
task.affectedFiles.join('\n '));
Expand Down
6 changes: 3 additions & 3 deletions lib/src/tasks/test/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class TestCli extends TaskCli {
}

Future<CliResult> run(ArgResults parsedArgs) async {
if (!platform_util
.hasImmediateDependency('test')) return new CliResult.fail(
'Package "test" must be an immediate dependency in order to run its executables.');
if (!platform_util.hasImmediateDependency('test'))
return new CliResult.fail(
'Package "test" must be an immediate dependency in order to run its executables.');

List<String> additionalArgs = [];

Expand Down
9 changes: 5 additions & 4 deletions test/integration/test_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Future<bool> runTests(String projectPath,

List args = ['run', 'dart_dev', 'test'];
if (unit != null) args.add(unit ? '--unit' : '--no-unit');
if (integration != null) args
.add(integration ? '--integration' : '--no-integration');
if (integration != null)
args.add(integration ? '--integration' : '--no-integration');
int i;

if (files != null) {
Expand Down Expand Up @@ -70,8 +70,9 @@ void main() {

test('should run individual unit test', () async {
expect(
await runTests(projectWithPassingTests, files:
['test/fixtures/test/passing/test/passing_unit_test.dart']),
await runTests(projectWithPassingTests, files: [
'test/fixtures/test/passing/test/passing_unit_test.dart'
]),
isTrue);
});

Expand Down