Skip to content

Commit

Permalink
Compliance to recently introduced dart linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
alexei-sintotski committed Dec 14, 2020
1 parent ba39591 commit fb60935
Show file tree
Hide file tree
Showing 58 changed files with 494 additions and 396 deletions.
19 changes: 19 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ linter:
- avoid_double_and_int_checks
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
- avoid_implementing_value_types
Expand All @@ -28,6 +29,7 @@ linter:
- avoid_positional_boolean_parameters
- avoid_print
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
Expand Down Expand Up @@ -57,22 +59,30 @@ linter:
- curly_braces_in_flow_control_structures
- diagnostic_describe_all_properties
- directives_ordering
- do_not_use_environment
- empty_catches
- empty_constructor_bodies
- empty_statements
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- invariant_booleans
- iterable_contains_unrelated_type
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_logic_in_create_state
- no_runtimeType_toString
- non_constant_identifier_names
- null_closures
- omit_local_variable_types
Expand Down Expand Up @@ -123,6 +133,7 @@ linter:
- provide_deprecation_message
- public_member_api_docs
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
Expand All @@ -141,14 +152,22 @@ linter:
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_is_even_rather_than_modulo
- use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
Expand Down
8 changes: 4 additions & 4 deletions bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand All @@ -32,8 +32,8 @@ import 'src/commands/probe_command.dart';

void main(List<String> args) => CommandRunner<void>(
'borg',
'Dart borg is a command-line tool to support development teams working on '
'large scale Dart and Flutter mono repositories.',
'Dart borg is a command-line tool to support development teams working '
'on large scale Dart and Flutter mono repositories.',
)
..addCommand(ProbeCommand())
..addCommand(EvolveCommand())
Expand Down
10 changes: 5 additions & 5 deletions bin/src/assert_pubspec_yaml_consistency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down Expand Up @@ -57,7 +57,7 @@ String _formatDependencySpec(PackageDependencySpec dependency) =>
some: (v) => ": $v",
none: () => "",
)}',
path: (dep) => '${dep.path}',
hosted: (dep) => '${dep.version.valueOr(() => "unspecified")}',
sdk: (dep) => '${dep.version.valueOr(() => "unspecified")}',
path: (dep) => dep.path,
hosted: (dep) => dep.version.valueOr(() => 'unspecified'),
sdk: (dep) => dep.version.valueOr(() => 'unspecified'),
);
32 changes: 19 additions & 13 deletions bin/src/commands/boot_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down Expand Up @@ -63,9 +63,10 @@ class BootCommand extends Command<void> {
@override
String get description =>
'Executes "pub get" for multiple packages in repository\n\n'
'Packages to bootstrap can be specified as arguments. '
'If no arguments are supplied, the command bootstraps all scanned packages.\n'
'"flutter packages get" is used to resolve dependencies for Flutter packages.';
'Packages to bootstrap can be specified as arguments. If no arguments '
'are supplied, the command bootstraps all scanned packages.\n'
'"flutter packages get" is used to resolve dependencies for Flutter '
'packages.';

@override
String get name => 'boot';
Expand Down Expand Up @@ -99,7 +100,9 @@ class BootCommand extends Command<void> {
case BootMode.incremental:
if (_isPartialBootstrappingRequested()) {
print(
'Bootstrapping of specific packages is requested, using basic bootstrapping\n');
'Bootstrapping of specific packages is requested, '
'using basic bootstrapping\n',
);
_executeBasicBootstrapping(
packages: packages,
configuration: configuration,
Expand Down Expand Up @@ -175,9 +178,11 @@ class BootCommand extends Command<void> {
if (ctx.dartSdkVersion != dartSdkVersion &&
ctx.dartSdkVersion.isNotEmpty) {
print(
'Dart version change detected, bootstrapping of all packages required\n'
'\t${ctx.dartSdkVersion}\n'
'=> \t$dartSdkVersion\n');
'Dart version change detected, '
'bootstrapping of all packages required\n'
'\t${ctx.dartSdkVersion}\n'
'=> \t$dartSdkVersion\n',
);
return packages;
}

Expand Down Expand Up @@ -255,8 +260,8 @@ class BootCommand extends Command<void> {
final actualVersion =
flutterSdkVersion(flutterSdkPath: flutterSdkPath);
if (actualVersion != ctxVersion) {
print(
'Flutter version change detected, bootstrapping of all packages required\n\n'
print('Flutter version change detected, '
'bootstrapping of all packages required\n\n'
'$ctxVersion\n\n'
'=>\n\n'
'$actualVersion\n');
Expand Down Expand Up @@ -284,8 +289,9 @@ class BootCommand extends Command<void> {
for (final package in packages) {
final counter = '[${i++}/${packages.length}]';
print(
'$counter ${package.isFlutterPackage ? 'Flutter' : 'Dart'} package ${renderPackageName(package.path)}...');

'$counter ${package.isFlutterPackage ? 'Flutter' : 'Dart'} '
'package ${renderPackageName(package.path)}...',
);
resolveDependencies(
package: package,
configuration: configuration,
Expand Down
26 changes: 17 additions & 9 deletions bin/src/commands/evolve_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down Expand Up @@ -86,14 +86,20 @@ class EvolveCommand extends Command<void> {
}

print(
'\nResolving ${allExternalDepSpecs.length} direct external dependencies used by all found packages...');
'\nResolving ${allExternalDepSpecs.length} direct external dependencies '
'used by all found packages...',
);
final references = _resolveConsistentDependencySet(allExternalDepSpecs);
print(
'\tresolved ${references.length} direct and transitive external dependencies');
'\tresolved ${references.length} direct and transitive external '
'dependencies',
);

if (getDryRunFlag(argResults)) {
print(
'\nDRY RUN: Previewing evolution of ${packages.length} Dart packages...');
'\nDRY RUN: Previewing evolution of ${packages.length} Dart '
'packages...',
);
} else {
print('\nCommencing evolution of ${packages.length} Dart packages...');
}
Expand Down Expand Up @@ -217,15 +223,17 @@ void _printDependencyCorrections({
final orgDep = actualDependencies
.firstWhere((d) => d.package() == correction.package());
print(
'\t${correction.package()}: ${_formatDependencyDetail(orgDep)} => ${_formatDependencyDetail(correction)}');
'\t${correction.package()}: ${_formatDependencyDetail(orgDep)} => '
'${_formatDependencyDetail(correction)}',
);
}
stdout.write('\n');
}
}

String _formatDependencyDetail(PackageDependency dep) => dep.iswitch(
sdk: (d) => '${d.version}',
hosted: (d) => '${d.version}',
sdk: (d) => d.version,
hosted: (d) => d.version,
git: (d) => '${d.url}:${d.resolvedRef}',
path: (d) => '${d.path}',
path: (d) => d.path,
);
4 changes: 2 additions & 2 deletions bin/src/commands/init_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
11 changes: 6 additions & 5 deletions bin/src/commands/probe_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down Expand Up @@ -88,7 +88,8 @@ class ProbeCommand extends Command<void> {
}
if (getPubspecYamlFlag(argResults) || getPubspecLockFlag(argResults)) {
print(
'\nSUCCESS: All packages use consistent set of external dependencies');
'\nSUCCESS: All packages use consistent set of external dependencies',
);
} else {
throw const BorgException('FATAL: Nothing to do!');
}
Expand Down Expand Up @@ -127,6 +128,6 @@ class ProbeCommand extends Command<void> {
String _formatDependencyInfo(PackageDependency dependency) =>
dependency.iswitcho(
git: (dep) => '${dep.url}:${dep.resolvedRef}',
path: (dep) => '${dep.path}',
otherwise: () => '${dependency.version()}',
path: (dep) => dep.path,
otherwise: () => dependency.version(),
);
14 changes: 8 additions & 6 deletions bin/src/options/boot_mode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand All @@ -32,18 +32,20 @@ void addBootModeOption(ArgParser argParser, {@required BootMode defaultsTo}) =>
_name,
abbr: 'm',
help:
'Switches borg to the specified bootstrapping mode -- all subsequent borg runs will use the specified mode '
'Switches borg to the specified bootstrapping mode -- all subsequent '
'borg runs will use the specified mode '
'until another mode is selected in command line',
allowed: [
_basicValue,
_incrementalValue,
],
allowedHelp: {
_basicValue:
'Switches borg to bootstrap all packages found during package scan or specified in the command line',
'Switches borg to bootstrap all packages found during package scan '
'or specified in the command line',
_incrementalValue:
'Switches borg to bootstrap only packages with dependencies updated since the last successful '
'bootstrapping',
'Switches borg to bootstrap only packages with dependencies '
'updated since the last successful bootstrapping',
},
defaultsTo: _optionEnum2String[defaultsTo],
);
Expand Down
4 changes: 2 additions & 2 deletions bin/src/options/dry_run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
4 changes: 2 additions & 2 deletions bin/src/options/lock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
4 changes: 2 additions & 2 deletions bin/src/options/verbose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
4 changes: 2 additions & 2 deletions bin/src/options/yaml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
4 changes: 2 additions & 2 deletions bin/src/resolve_dependencies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
Loading

0 comments on commit fb60935

Please sign in to comment.