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
40 changes: 29 additions & 11 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,51 @@ analyzer:
unused_import: error
unused_local_variable: error
dead_code: error
override_on_non_overriding_method: error
linter:
rules:
- annotate_overrides
# Errors
- avoid_empty_else
- avoid_init_to_null
- avoid_return_types_on_setters
- await_only_futures
- camel_case_types
- comment_references
- control_flow_in_finally
- empty_statements
- hash_and_equals
- iterable_contains_unrelated_type
- no_duplicate_case_values
- test_types_in_equals
- throw_in_finally
- unawaited_futures
- unnecessary_statements
- unrelated_type_equality_checks
- valid_regexps

# Style
- annotate_overrides
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_unused_constructor_parameters
- camel_case_types
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
- hash_and_equals
- implementation_imports
- library_names
- library_prefixes
- non_constant_identifier_names
- only_throw_errors
- prefer_conditional_assignment
- prefer_final_fields
- prefer_is_empty
- prefer_is_not_empty
- prefer_single_quotes
- prefer_typing_uninitialized_variables
- recursive_getters
- slash_for_doc_comments
- test_types_in_equals
- test_types_in_equals
- throw_in_finally
- type_init_formals
- unrelated_type_equality_checks
- valid_regexps
- unnecessary_brace_in_string_interps
- unnecessary_getter_setters
- unnecessary_lambda
- unnecessary_null_aware_assignments
1 change: 1 addition & 0 deletions lib/src/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class _Builder extends Builder {
stack);
}

// ignore: unawaited_futures
buildStep.writeAsString(outputId, genPartContent);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/constants/revive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import '../utils.dart';
///
/// Optionally specify the [library] type that contains the reference.
///
/// Returns [null] if not revivable.
/// Returns `null` if not revivable.
Revivable reviveInstance(DartObject object, [LibraryElement library]) {
library ??= object.type.element.library;
var url = Uri.parse(urlOfElement(object.type.element));
Expand Down
2 changes: 1 addition & 1 deletion lib/src/constants/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void assertHasField(ClassElement root, String name) {
element = element.supertype?.element;
}
final allFields = root.fields.toSet();
root.allSupertypes.forEach((t) => allFields.addAll(t.element.fields));
allFields.addAll(root.allSupertypes.expand((t) => t.element.fields));
throw new FormatException(
'Class ${root.name} does not have field "$name".',
'Fields: \n - ${allFields.map((e) => e.name).join('\n - ')}',
Expand Down
2 changes: 1 addition & 1 deletion lib/src/generated_output.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'generator.dart';
class GeneratedOutput {
final String output;
final Generator generator;
final error;
final dynamic error;
final StackTrace stackTrace;

bool get isError => error != null;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/type_checker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class _UriTypeChecker extends TypeChecker {
bool isExactly(Element element) => hasSameUrl(urlOfElement(element));

@override
String toString() => '${uri}';
String toString() => '$uri';
}

class _AnyChecker extends TypeChecker {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Uri packageToAssetUrl(Uri url) => url.scheme == 'package'
/// are not describable using `package:...`, such as files in the `bin`, `tool`,
/// `web`, or even root directory of a package - `asset:some_lib/web/main.dart`.
Uri assetToPackageUrl(Uri url) => url.scheme == 'asset' &&
url.pathSegments.length >= 1 &&
url.pathSegments.isNotEmpty &&
url.pathSegments[1] == 'lib'
? url.replace(
scheme: 'package',
Expand Down
4 changes: 1 addition & 3 deletions test/src/io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ Future<List<String>> getDartFiles(String directoryPath,
/// directories defined in the list.
Stream<String> getFiles(String directoryPath,
{List<String> searchList, bool followLinks: false}) async* {
if (searchList == null) {
searchList = <String>[];
}
searchList ??= [];

var map = await _expandSearchList(directoryPath, searchList);
var searchDirs = <String>[];
Expand Down