diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 9a6ac6c..2fa5b90 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -6,26 +6,16 @@ name: Dart on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + push jobs: analyze: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - uses: dart-lang/setup-dart@v1 - name: Install dependencies run: dart pub get - - # Uncomment this step to verify the use of 'dart format' on each commit. - # - name: Verify formatting - # run: dart format --output=none --set-exit-if-changed . - - # Consider passing '--fatal-infos' for slightly stricter analysis. - name: Analyze project source run: dart analyze working-directory: ./lib @@ -33,7 +23,6 @@ jobs: test: needs: analyze runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - uses: dart-lang/setup-dart@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index a5dfca3..e02bad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [1.0.1+1] - 07/04/2022 + +* Updated linting rules + ## [1.0.1] - 04/10/2021 * Fixed [issue #33](https://github.com/TesteurManiak/icalendar_parser/issues/33): Exception on ORGANIZER field parsing diff --git a/analysis_options.yaml b/analysis_options.yaml index b792fee..06f43f2 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,13 @@ -include: lint_analysis_options.yaml +include: package:lint/analysis_options_package.yaml linter: rules: - unnecessary_raw_strings: false \ No newline at end of file + # Util classes are awesome! + # avoid_classes_with_only_static_members: false + + # Make constructors the first thing in every class + # sort_constructors_first: true + + # Choose wisely, but you don't have to + # prefer_double_quotes: true + # prefer_single_quotes: true \ No newline at end of file diff --git a/example/pubspec.lock b/example/pubspec.lock index e8ed90d..a46e2ff 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -21,14 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -87,7 +87,7 @@ packages: path: ".." relative: true source: path - version: "0.8.0+1" + version: "1.0.1" intl: dependency: transitive description: @@ -101,14 +101,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" path: dependency: transitive description: @@ -218,7 +225,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.8" typed_data: dependency: transitive description: @@ -232,7 +239,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" win32: dependency: transitive description: @@ -248,5 +255,5 @@ packages: source: hosted version: "0.1.0" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.14.0 <3.0.0" flutter: ">=1.12.13+hotfix.5" diff --git a/lib/src/model/icalendar.dart b/lib/src/model/icalendar.dart index fe6afa8..942a6b3 100644 --- a/lib/src/model/icalendar.dart +++ b/lib/src/model/icalendar.dart @@ -1,8 +1,6 @@ import 'dart:convert'; import 'package:icalendar_parser/icalendar_parser.dart'; -import 'package:icalendar_parser/src/exceptions/icalendar_exception.dart'; -import 'package:icalendar_parser/src/model/ics_datetime.dart'; import 'package:icalendar_parser/src/utils/parsing_methods.dart'; /// Core object @@ -67,8 +65,12 @@ class ICalendar { /// Map containing the methods used to parse each kind of fields in the file. static final Map _objects = { - 'BEGIN': (String value, Map params, List events, - Map lastEvent) { + 'BEGIN': ( + String value, + Map params, + List events, + Map lastEvent, + ) { if (value == 'VCALENDAR') return null; lastEvent = {'type': value}; @@ -76,8 +78,13 @@ class ICalendar { return lastEvent; }, - 'END': (String value, Map params, List events, - Map? lastEvent, List?> data) { + 'END': ( + String value, + Map params, + List events, + Map? lastEvent, + List?> data, + ) { if (value == 'VCALENDAR') return lastEvent; data.add(lastEvent); @@ -104,8 +111,12 @@ class ICalendar { 'DESCRIPTION': generateSimpleParamFunction('description'), 'LOCATION': generateSimpleParamFunction('location'), 'URL': generateSimpleParamFunction('url'), - 'ORGANIZER': (String value, Map params, List events, - Map lastEvent) { + 'ORGANIZER': ( + String value, + Map params, + List events, + Map lastEvent, + ) { final mail = value.replaceAll('MAILTO:', '').trim(); if (params.containsKey('CN')) { @@ -119,23 +130,36 @@ class ICalendar { return lastEvent; }, - 'GEO': (String value, Map params, List events, - Map lastEvent) { + 'GEO': ( + String value, + Map params, + List events, + Map lastEvent, + ) { final pos = value.split(';'); if (pos.length != 2) return lastEvent; - lastEvent['geo'] = {}; - lastEvent['geo']['latitude'] = num.parse(pos[0]); - lastEvent['geo']['longitude'] = num.parse(pos[1]); + final geo = {}; + geo['latitude'] = num.parse(pos[0]); + geo['longitude'] = num.parse(pos[1]); + lastEvent['geo'] = geo; return lastEvent; }, - 'CATEGORIES': (String value, Map params, List events, - Map lastEvent) { + 'CATEGORIES': ( + String value, + Map params, + List events, + Map lastEvent, + ) { lastEvent['categories'] = value.split(','); return lastEvent; }, - 'ATTENDEE': (String value, Map params, List _, - Map lastEvent) { + 'ATTENDEE': ( + String value, + Map params, + _, + Map lastEvent, + ) { lastEvent['attendee'] ??= []; final mail = value.replaceAll('MAILTO:', '').trim(); @@ -153,16 +177,14 @@ class ICalendar { return lastEvent; }, 'ACTION': generateSimpleParamFunction('action'), - 'STATUS': (String value, Map _, List __, - Map lastEvent) { + 'STATUS': (String value, _, __, Map lastEvent) { lastEvent['status'] = value.trim().toIcsStatus(); return lastEvent; }, 'SEQUENCE': generateSimpleParamFunction('sequence'), 'REPEAT': generateSimpleParamFunction('repeat'), 'CLASS': generateSimpleParamFunction('class'), - 'TRANSP': (String value, Map _, List __, - Map lastEvent) { + 'TRANSP': (String value, _, __, Map lastEvent) { lastEvent['transp'] = value.trim().toIcsTransp(); return lastEvent; }, @@ -185,8 +207,12 @@ class ICalendar { /// `ICalendarFormatException`. static void registerField({ required String field, - Function(String value, Map params, List event, - Map lastEvent)? + Function( + String value, + Map params, + List event, + Map lastEvent, + )? function, }) { if (_objects.containsKey(field)) { @@ -215,8 +241,10 @@ class ICalendar { /// `List> data`. /// /// If [allowEmptyLine] is false the method will throw [EmptyLineException]. - static List fromListToJson(List lines, - {bool allowEmptyLine = true}) { + static List fromListToJson( + List lines, { + bool allowEmptyLine = true, + }) { final data = >[]; final _headData = {}; final events = []; @@ -226,13 +254,15 @@ class ICalendar { // Ensure first line is BEGIN:VCALENDAR if (lines.first.trim() != 'BEGIN:VCALENDAR') { throw ICalendarBeginException( - 'The first line must be BEGIN:VCALENDAR but was ${lines.first}.'); + 'The first line must be BEGIN:VCALENDAR but was ${lines.first}.', + ); } // Ensure last line is END:VCALENDAR if (lines.last.trim() != 'END:VCALENDAR') { throw ICalendarEndException( - 'The last line must be END:VCALENDAR but was ${lines.last}.'); + 'The last line must be END:VCALENDAR but was ${lines.last}.', + ); } for (var i = 0; i < lines.length; i++) { @@ -242,7 +272,7 @@ class ICalendar { throw const EmptyLineException(); } - final exp = RegExp(r'^ '); + final exp = RegExp('^ '); while (i + 1 < lines.length && exp.hasMatch(lines[i + 1])) { i += 1; line.write(lines[i].trim()); @@ -254,7 +284,9 @@ class ICalendar { dataLine[0].toUpperCase() != dataLine[0] && !dataLine[0].contains(';'))) { if (line.isNotEmpty && currentName != null) { - lastEvent![currentName] += line.toString(); + final buffer = StringBuffer(lastEvent![currentName] as String); + buffer.write(line.toString()); + lastEvent[currentName] = buffer.toString(); } continue; } @@ -271,25 +303,38 @@ class ICalendar { dataLine.removeRange(0, 1); final value = dataLine.join(':').replaceAll(RegExp(r'\\,'), ','); - if (_objects.containsKey(name)) { + final nameFunc = _objects[name]; + if (_objects.containsKey(name) && nameFunc != null) { currentName = name.toLowerCase(); if (name == 'END') { + final func = nameFunc as Map? Function( + String, + Map, + List, + Map?, + List>, + ); currentName = null; - lastEvent = _objects[name]!(value, params, events, lastEvent, data) - as Map?; + lastEvent = func(value, params, events, lastEvent, data); } else { - lastEvent = - _objects[name]!(value, params, events, lastEvent ?? _headData) - as Map?; + final func = nameFunc as Map? Function( + String, + Map, + List, + Map, + ); + lastEvent = func(value, params, events, lastEvent ?? _headData); } } } if (!_headData.containsKey('version')) { throw const ICalendarNoVersionException( - 'The body is missing the property VERSION'); + 'The body is missing the property VERSION', + ); } else if (!_headData.containsKey('prodid')) { throw const ICalendarNoProdidException( - 'The body is missing the property PRODID'); + 'The body is missing the property PRODID', + ); } return [_headData, data]; } diff --git a/lib/src/utils/parsing_methods.dart b/lib/src/utils/parsing_methods.dart index 95d7eb9..ae70a9d 100644 --- a/lib/src/utils/parsing_methods.dart +++ b/lib/src/utils/parsing_methods.dart @@ -2,8 +2,12 @@ import 'package:icalendar_parser/src/model/ics_datetime.dart'; Function(String, Map, List, Map) generateDateFunction(String name) { - return (String value, Map params, List events, - Map lastEvent) { + return ( + String value, + Map params, + List events, + Map lastEvent, + ) { lastEvent[name] = IcsDateTime(dt: value, tzid: params['TZID']); return lastEvent; }; @@ -13,8 +17,12 @@ Function(String, Map, List, Map) /// containing the [value] as [String]. Function(String, Map, List, Map) generateSimpleParamFunction(String name) { - return (String value, Map params, List events, - Map lastEvent) { + return ( + String value, + Map params, + List events, + Map lastEvent, + ) { lastEvent[name] = value.replaceAll(RegExp(r'/\\n/g'), '\n'); return lastEvent; }; diff --git a/lint_analysis_options.yaml b/lint_analysis_options.yaml deleted file mode 100644 index 2b7a7cb..0000000 --- a/lint_analysis_options.yaml +++ /dev/null @@ -1,920 +0,0 @@ -## -# Lint rules to be used for apps without developer facing API. i.e. command line tools and Flutter applications -## -analyzer: - strong-mode: - # Will become the default once non-nullable types land - # https://github.com/dart-lang/sdk/issues/31410#issuecomment-510683629 - implicit-casts: false - errors: - # treat missing required parameters as a warning (not a hint) - missing_required_param: warning - # treat missing returns as a warning (not a hint) - missing_return: warning - # allow having TODOs in the code - todo: ignore - -# Rules are in the same order (alphabetically) as documented at http://dart-lang.github.io/linter/lints -# and https://github.com/dart-lang/linter/blob/master/example/all.yaml -linter: - rules: - # Prevents accidental return type changes which results in a breaking API change. - # Enforcing return type makes API changes visible in a diff - # pedantic: enabled - # http://dart-lang.github.io/linter/lints/always_declare_return_types.html - - always_declare_return_types - - # Single line `if`s are fine as recommended in Effective Dart "DO format your code using dartfmt" - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/always_put_control_body_on_new_line.html - # - always_put_control_body_on_new_line - - # Flutter widgets always put a Key as first optional parameter which breaks this rule. - # Also violates other orderings like matching the class fields or alphabetically. - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/always_declare_return_types.html - # - always_put_required_named_parameters_first - - # All non nullable named parameters should be and annotated with @required. - # This allows API consumers to get warnings via lint rather than a crash a runtime. - # Might become obsolete with Non-Nullable types - # pedantic: enabled - # http://dart-lang.github.io/linter/lints/always_require_non_null_named_parameters.html - - always_require_non_null_named_parameters - - # Since dart 2.0 dart is a sound language, specifying types is not required anymore. - # `var foo = 10;` is enough information for the compiler to make foo a int. - # Violates Effective Dart "AVOID type annotating initialized local variables". - # Makes code unnecessarily complex https://github.com/dart-lang/linter/issues/1620 - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/always_specify_types.html - # - always_specify_types - - # Protect against unintentionally overriding superclass members - # pedantic: enabled - # http://dart-lang.github.io/linter/lints/annotate_overrides.html - - annotate_overrides - - # All methods should define a return type. dynamic is no exception. - # Violates Effective Dart "PREFER annotating with dynamic instead of letting inference fail" - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/avoid_annotating_with_dynamic.html - # - avoid_annotating_with_dynamic - - # A leftover from dart1, should be deprecated - # pedantic: disabled - # - https://github.com/dart-lang/linter/issues/1401 - # http://dart-lang.github.io/linter/lints/avoid_as.html - # - avoid_as - - # Highlights boolean expressions which can be simplified - # http://dart-lang.github.io/linter/lints/avoid_bool_literals_in_conditional_expressions.html - - avoid_bool_literals_in_conditional_expressions - - # There are no strong arguments to enable this rule because it is very strict. Catching anything is useful - # and common even if not always the most correct thing to do. - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/avoid_catches_without_on_clauses.html - # - avoid_catches_without_on_clauses - - # Errors aren't for catching but to prevent prior to runtime - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/avoid_catching_errors.html - - avoid_catching_errors - - # Can usually be replaced with an extension - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/avoid_classes_with_only_static_members.html - - avoid_classes_with_only_static_members - - # Never accidentally use dynamic invocations - # Dart SDK: unreleased • (Linter vnull) - # https://dart-lang.github.io/linter/lints/avoid_dynamic_calls.html - # avoid_dynamic_calls - - # Only useful when targeting JS - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/avoid_double_and_int_checks.html - # - avoid_double_and_int_checks - - # Prevents accidental empty else cases. See samples in documentation - # pedantic: enabled - # http://dart-lang.github.io/linter/lints/avoid_empty_else.html - - avoid_empty_else - - # It is expected that mutable objects which override hash & equals shouldn't be used as keys for hashmaps. - # This one use case doesn't make all hash & equals implementations for mutable classes bad. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/avoid_equals_and_hash_code_on_mutable_classes.html - # - avoid_equals_and_hash_code_on_mutable_classes - - # Use different quotes instead of escaping - # Dart SDK: >= 2.8.0-dev.11.0 • (Linter v0.1.111) - # https://dart-lang.github.io/linter/lints/avoid_escaping_inner_quotes.html - - avoid_escaping_inner_quotes - - # Prevents unnecessary allocation of a field - # pedantic: disabled - # http://dart-lang.github.io/linter/lints/avoid_field_initializers_in_const_classes.html - - avoid_field_initializers_in_const_classes - - # Prevents allocating a lambda and allows return/break/continue control flow statements inside the loop - # http://dart-lang.github.io/linter/lints/avoid_function_literals_in_foreach_calls.html - - avoid_function_literals_in_foreach_calls - - # Don't break value types by implementing them - # http://dart-lang.github.io/linter/lints/avoid_implementing_value_types.html - - avoid_implementing_value_types - - # Removes redundant `= null;` - # https://dart-lang.github.io/linter/lints/avoid_init_to_null.html - - avoid_init_to_null - - # Only useful when targeting JS - # Warns about too large integers when compiling to JS - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/avoid_js_rounded_ints.html - # - avoid_js_rounded_ints - - # Null checks aren't required in ==() operators - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/avoid_null_checks_in_equality_operators.html - - avoid_null_checks_in_equality_operators - - # Good APIs don't use ambiguous boolean parameters. Instead use named parameters - # https://dart-lang.github.io/linter/lints/avoid_positional_boolean_parameters.html - - avoid_positional_boolean_parameters - - # Don't call print in production code - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/avoid_print.html - - avoid_print - - # Always prefer function references over typedefs. - # Jumping twice in code to see the signature of a lambda sucks. This is different from the flutter analysis_options - # https://dart-lang.github.io/linter/lints/avoid_private_typedef_functions.html - - avoid_private_typedef_functions - - # Don't explicitly set defaults - # Dart SDK: >= 2.8.0-dev.1.0 • (Linter v0.1.107) - # https://dart-lang.github.io/linter/lints/avoid_redundant_argument_values.html - - avoid_redundant_argument_values - - # package or relative? Let's end the discussion and use package everywhere. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/avoid_relative_lib_imports.html - - avoid_relative_lib_imports - - # Not recommended to break dartdoc but besides that there is no reason to continue with bad naming - # https://dart-lang.github.io/linter/lints/avoid_renaming_method_parameters.html - # - avoid_renaming_method_parameters - - # Setters always return void, therefore defining void is redundant - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/avoid_return_types_on_setters.html - - avoid_return_types_on_setters - - # Especially with Non-Nullable types on the horizon, `int?` is fine. - # There are plenty of valid reasons to return null. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/avoid_returning_null.html - # - avoid_returning_null - - # Don't use `Future?`, therefore never return null instead of a Future. - # Will become obsolete one Non-Nullable types land - # https://dart-lang.github.io/linter/lints/avoid_returning_null_for_future.html - - avoid_returning_null_for_future - - # Use empty returns, don't show off with you knowledge about dart internals. - # https://dart-lang.github.io/linter/lints/avoid_returning_null_for_void.html - - avoid_returning_null_for_void - - # Hinting you forgot about the cascade operator. But too often you did this on purpose. - # There are plenty of valid reasons to return this. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/avoid_returning_this.html - # - avoid_returning_this - - # Prevents logical inconsistencies. It's good practice to define getters for all existing setters. - # https://dart-lang.github.io/linter/lints/avoid_setters_without_getters.html - - avoid_setters_without_getters - - # Don't reuse a type parameter when on with the same name already exists in the same scope - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/avoid_shadowing_type_parameters.html - - avoid_shadowing_type_parameters - - # A single cascade operator can be replaced with a normal method call - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/avoid_single_cascade_in_expression_statements.html - - avoid_single_cascade_in_expression_statements - - # Might cause frame drops because of synchronous file access on mobile, especially on older phones with slow storage. - # There are no known measurements sync access does *not* drop frames. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/avoid_slow_async_io.html - # - avoid_slow_async_io - - # Don't use .toString() in production code which might be minified - # Dart SDK: >= 2.10.0-144.0.dev • (Linter v0.1.119) - # https://dart-lang.github.io/linter/lints/avoid_type_to_string.html - - avoid_type_to_string - - # Don't use a parameter names which can be confused with a types (i.e. int, bool, num, ...) - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/avoid_types_as_parameter_names.html - - avoid_types_as_parameter_names - - # Adding the type is not required, but sometimes improves readability. Therefore removing it doesn't always help - # https://dart-lang.github.io/linter/lints/avoid_types_on_closure_parameters.html - # - avoid_types_on_closure_parameters - - # Containers without parameters have no effect and can be removed - # https://dart-lang.github.io/linter/lints/avoid_unnecessary_containers.html - - avoid_unnecessary_containers - - # Unused parameters should be removed - # https://dart-lang.github.io/linter/lints/avoid_unused_constructor_parameters.html - - avoid_unused_constructor_parameters - - # TODO double check - # For async functions use `Future` as return value, not `void` - # This allows usage of the await keyword and prevents operations from running in parallel. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/avoid_void_async.html - - avoid_void_async - - # Flutter mobile only: Web packages aren't available in mobile flutter apps - # https://dart-lang.github.io/linter/lints/avoid_web_libraries_in_flutter.html - - avoid_web_libraries_in_flutter - - # Use the await keyword only for futures. There is nothing to await in synchronous code - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/await_only_futures.html - - await_only_futures - - # Follow the style guide and use UpperCamelCase for extensions - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/camel_case_extensions.html - - camel_case_extensions - - # Follow the style guide and use UpperCamelCase for class names and typedefs - # https://dart-lang.github.io/linter/lints/camel_case_types.html - - camel_case_types - - # Prevents leaks and code executing after their lifecycle. - # Discussion https://github.com/passsy/dart-lint/issues/4 - # - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/cancel_subscriptions.html - - cancel_subscriptions - - # The cascade syntax is weird and you shouldn't be forced to use it. - # False positives: - # https://github.com/dart-lang/linter/issues/1589 - # - # https://dart-lang.github.io/linter/lints/cascade_invocations.html - # - cascade_invocations - - # Don't cast T? to T. Use ! instead - # Dart SDK: >= 2.11.0-182.0.dev • (Linter v0.1.120) - # https://dart-lang.github.io/linter/lints/cast_nullable_to_non_nullable.html - - cast_nullable_to_non_nullable - - # False positives, not reliable enough - # - https://github.com/dart-lang/linter/issues/1381 - # - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/close_sinks.html - # - close_sinks - - # False positives: - # - https://github.com/dart-lang/linter/issues/1142 - # - # https://dart-lang.github.io/linter/lints/comment_references.html - # - comment_references - - # Follow standard dart naming style. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/constant_identifier_names.html - - constant_identifier_names - - # Prevents hard to debug code - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/control_flow_in_finally.html - - control_flow_in_finally - - # Single line `if`s are fine, but when a new line splits the bool expression and body curly braces - # are recommended. It prevents the danging else problem and easily allows the addition of more lines inside - # the if body - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/curly_braces_in_flow_control_structures.html - - curly_braces_in_flow_control_structures - - # Still experimental and pretty much work when enforced - # https://dart-lang.github.io/linter/lints/diagnostic_describe_all_properties.html - # - diagnostic_describe_all_properties - - # Follows dart style. Fully supported by IDEs and no manual effort for a consistent style - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/directives_ordering.html - - directives_ordering - - # String.fromEnvironment looks up env variables at compile time. The variable is baked in by the compiler - # and can't be changed by environment variables. - # - # For dart apps: - # Better look up a environment variable at runtime with Platform.environment - # or use code generation to define variables at compile time. - # - # For Flutter apps: - # String.fromEnvironment is the recommended way to include variables defined with `flutter build --dart-define` - # - # pedantic: disabled - # Dart SDK: >= 2.10.0-0.0.dev • (Linter v0.1.117) - # https://dart-lang.github.io/linter/lints/do_not_use_environment.html - # - do_not_use_environment - - # Add a comment why no further error handling is required - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/empty_catches.html - - empty_catches - - # Removed empty constructor bodies - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/empty_constructor_bodies.html - - empty_constructor_bodies - - # Don't allow empty if bodies. Works together with curly_braces_in_flow_control_structures - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/empty_statements.html - - empty_statements - - # Enums aren't powerful enough, now enum like classes get the same linting support - # pedantic: disabled - # Dart SDK: >= 2.9.0-12.0.dev • (Linter v0.1.116) - # https://dart-lang.github.io/linter/lints/exhaustive_cases.html - - exhaustive_cases - - # Follow dart file naming schema - # https://dart-lang.github.io/linter/lints/file_names.html - - file_names - - # Very flutter specific, not applicable for all projects - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/flutter_style_todos.html - # - flutter_style_todos # not all todos require a ticket - - # hashCode and equals need to be consistent. One can't live without another. - # https://dart-lang.github.io/linter/lints/hash_and_equals.html - - hash_and_equals - - # DON'T import implementation files from another package. - # If you need access to some internal code, create an issue - # https://dart-lang.github.io/linter/lints/implementation_imports.html - - implementation_imports - - # Although there are some false positives, this lint generally catches unnecessary checks - # - https://github.com/dart-lang/linter/issues/811 - # - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/invariant_booleans.html - - invariant_booleans - - # Type check for Iterable.contains(other) where other is! T - # otherwise contains will always report false. Those errors are usually very hard to catch. - # https://dart-lang.github.io/linter/lints/iterable_contains_unrelated_type.html - - iterable_contains_unrelated_type - - # Hint to join return and assignment. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/join_return_with_assignment.html - - join_return_with_assignment - - # Add leading \n which which makes multiline strings easier to read - # Dart SDK: >= 2.8.0-dev.16.0 • (Linter v0.1.113) - # https://dart-lang.github.io/linter/lints/leading_newlines_in_multiline_strings.html - - leading_newlines_in_multiline_strings - - # Makes sure a library name is a valid dart identifier. - # This comes in handy for test files combining multiple tests where the file name can be used as identifier - # - # ``` - # import src/some_test.dart as some_test; - # - # main() { - # some_test.main(); - # } - # ``` - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/library_names.html - - library_names - - # Follow dart style - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/library_prefixes.html - - library_prefixes - - # Nobody wants to manually wrap lines when changing a few words. This rule is too hard to be a "general" rule - # https://dart-lang.github.io/linter/lints/lines_longer_than_80_chars.html - # - lines_longer_than_80_chars - - # Type check for List.remove(item) where item is! T - # The list can't contain item. Those errors are not directly obvious especially when refactoring. - # https://dart-lang.github.io/linter/lints/list_remove_unrelated_type.html - - list_remove_unrelated_type - - # Good for libraries to prevent unnecessary code paths. - # False positives may occur for applications when boolean properties are generated by external programs - # producing auto-generated source code - # - # Known issue: while(true) loops https://github.com/dart-lang/linter/issues/453 - # - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/literal_only_boolean_expressions.html - # - literal_only_boolean_expressions - - # Don't forget the whitespaces at the end - # Dart SDK: >= 2.8.0-dev.10.0 • (Linter v0.1.110) - # https://dart-lang.github.io/linter/lints/missing_whitespace_between_adjacent_strings.html - - missing_whitespace_between_adjacent_strings - - # Concat Strings obviously with `+` inside a list. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/no_adjacent_strings_in_list.html - - no_adjacent_strings_in_list - - # Second case is basically dead code which will never be reached. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/no_duplicate_case_values.html - - no_duplicate_case_values - - # Flutter only: `createState` shouldn't pass information into the state - # https://dart-lang.github.io/linter/lints/no_logic_in_create_state.html - - no_logic_in_create_state - - # calling `runtimeType` may be a performance problem - # Dart SDK: >= 2.8.0-dev.10.0 • (Linter v0.1.110) - # https://dart-lang.github.io/linter/lints/no_runtimeType_toString.html - - no_runtimeType_toString - - # Follow dart style naming conventions - # https://dart-lang.github.io/linter/lints/non_constant_identifier_names.html - - non_constant_identifier_names - - # Generic T might have a value of String or String?. Both are valid. - # This lint triggers when ! is used on T? casting (String?)? to String and not (String?)? to String? - # Dart SDK: >= 2.11.0-182.0.dev • (Linter v0.1.120) - # https://dart-lang.github.io/linter/lints/null_check_on_nullable_type_parameter.html - - null_check_on_nullable_type_parameter - - # Might become irrelevant when non-nullable types land in dart. Until then use this lint check which checks for - # non null arguments for specific dart sdk methods. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/null_closures.html - - null_closures - - # Types for local variables may improve readability. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/omit_local_variable_types.html - # - omit_local_variable_types - - # Defining interfaces (abstract classes), with only one method, makes sense architecture wise - # Discussion: https://github.com/passsy/dart-lint/issues/2 - # - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/one_member_abstracts.html - # - one_member_abstracts - - # Since Errors aren't intended to be caught (see avoid_catching_errors), throwing anything - # doesn't cause trouble. - # https://dart-lang.github.io/linter/lints/only_throw_errors.html - # - only_throw_errors - - # Highlights unintentionally overridden fields. - # https://dart-lang.github.io/linter/lints/overridden_fields.html - - overridden_fields - - # Only relevant for packages, not applications or general dart code - # https://dart-lang.github.io/linter/lints/package_api_docs.html - # - package_api_docs - - # Follow dart style package naming convention - # https://dart-lang.github.io/linter/lints/package_names.html - - package_names - - # Seems very rare, especially for applications. - # https://dart-lang.github.io/linter/lints/package_prefixed_library_names.html - - package_prefixed_library_names - - # Most likely a mistake, if not: bad practice - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/parameter_assignments.html - - parameter_assignments - - # Is contradictory to `no_adjacent_strings_in_list` - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_adjacent_string_concatenation.html - # - prefer_adjacent_string_concatenation - - # Makes it easier to migrate to const constructors and to have final fields - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_asserts_in_initializer_lists.html - - prefer_asserts_in_initializer_lists - - # Assertions blocks don't require a message because they throw simple to understand errors - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_asserts_with_message.html - # - prefer_asserts_with_message - - # Collection literals are shorter. They exists, use them. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_collection_literals.html - - prefer_collection_literals - - # Use the ??= operator when possible - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_conditional_assignment.html - - prefer_conditional_assignment - - # Always use const when possible, make runtime faster - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_const_constructors.html - - prefer_const_constructors - - # Add a const constructor when possible - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_const_constructors_in_immutables.html - - prefer_const_constructors_in_immutables - - # final is good, const is better - # https://dart-lang.github.io/linter/lints/prefer_const_declarations.html - - prefer_const_declarations - - # Always use const when possible, make runtime faster - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_const_literals_to_create_immutables.html - - prefer_const_literals_to_create_immutables - - # Dart has named constructors. Static methods in other languages (java) are a workaround which don't have - # named constructors. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_constructors_over_static_methods.html - - prefer_constructors_over_static_methods - - # Contains may be faster and is easier to read - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_contains.html - - prefer_contains - - # Use whatever makes you happy. lint doesn't define a style - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_double_quotes.html - # - prefer_double_quotes - - # Prevent confusion with call-side when using named parameters - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_equal_for_default_values.html - - prefer_equal_for_default_values - - # Single line methods + implementation makes it hard to write comments for that line. - # Dense code isn't necessarily better code. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_expression_function_bodies.html - # - prefer_expression_function_bodies - - # Avoid accidental reassignments and allows the compiler to do optimizations. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_final_fields.html - - prefer_final_fields - - # Helps avoid accidental reassignments and allows the compiler to do optimizations. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_final_in_for_each.html - - prefer_final_in_for_each - - # Helps avoid accidental reassignments and allows the compiler to do optimizations. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_final_locals.html - - prefer_final_locals - - # Saves lot of code - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_for_elements_to_map_fromIterable.html - - prefer_for_elements_to_map_fromIterable - - # Dense code isn't necessarily better code - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_foreach.html - # - prefer_foreach - - # As Dart allows local function declarations, it is a good practice to use them in the place of function literals. - # https://dart-lang.github.io/linter/lints/prefer_function_declarations_over_variables.html - - prefer_function_declarations_over_variables - - # For consistency - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_generic_function_type_aliases.html - - prefer_generic_function_type_aliases - - # Allows potential usage of const - # https://dart-lang.github.io/linter/lints/prefer_if_elements_to_conditional_expressions.html - - prefer_if_elements_to_conditional_expressions - - # Dart has a special operator for this, use it - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_if_null_operators.html - - prefer_if_null_operators - - # Terser code - # https://dart-lang.github.io/linter/lints/prefer_initializing_formals.html - - prefer_initializing_formals - - # Easier move towards const, and way easier to read - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_inlined_adds.html - - prefer_inlined_adds - - # There is no argument which makes int literals better than double literals for doubles. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_int_literals.html - # - prefer_int_literals - - # Interpolate, use less "", '' and + - # https://dart-lang.github.io/linter/lints/prefer_interpolation_to_compose_strings.html - - prefer_interpolation_to_compose_strings - - # Iterables do not necessary know their length - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_is_empty.html - - prefer_is_empty - - # Easier to read - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_is_not_empty.html - - prefer_is_not_empty - - # Use the `foo is! Foo` instead of `!(foo is Foo)` - # https://dart-lang.github.io/linter/lints/prefer_is_not_operator.html - - prefer_is_not_operator - - # Easier to read - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_iterable_whereType.html - - prefer_iterable_whereType - - # Users of a 3rd party mixins can't change 3rd party code to use the mixin syntax. - # This makes the rule useless - # https://dart-lang.github.io/linter/lints/prefer_mixin.html - # - prefer_mixin - - # Makes expressions with null checks easier to read. - # https://github.com/flutter/flutter/pull/32711#issuecomment-492930932 - - prefer_null_aware_operators - - # Conflicting with `avoid_relative_lib_imports` which is enforced - # https://dart-lang.github.io/linter/lints/prefer_relative_imports.html - # - prefer_relative_imports - - # Use whatever makes you happy. noexcuse doesn't define a style - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_single_quotes.html - # - prefer_single_quotes - - # Allows potential usage of const - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/prefer_spread_collections.html - - prefer_spread_collections - - # Define types - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/prefer_typing_uninitialized_variables.html - - prefer_typing_uninitialized_variables - - # Null is not a type, use void - # https://dart-lang.github.io/linter/lints/prefer_void_to_null.html - - prefer_void_to_null - - # Document the replacement API - # https://dart-lang.github.io/linter/lints/provide_deprecation_message.html - - provide_deprecation_message - - # Definitely not a rule for standard dart code. Maybe relevant for packages - # https://dart-lang.github.io/linter/lints/public_member_api_docs.html - # - public_member_api_docs - - # Hints accidental recursions - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/recursive_getters.html - - recursive_getters - - # Flutter only, prefer SizedBox over Container which offers a const constructors - # Dart SDK: >= 2.9.0-4.0.dev • (Linter v0.1.115) - # https://dart-lang.github.io/linter/lints/sized_box_for_whitespace.html - - sized_box_for_whitespace - - # Follow dart style use triple slashes - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/slash_for_doc_comments.html - - slash_for_doc_comments - - # Flutter only, always put child last - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/sort_child_properties_last.html - - sort_child_properties_last - - # Working, results in consistent code. But too opinionated - # Discussion: https://github.com/passsy/dart-lint/issues/1 - # - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/sort_constructors_first.html - # - sort_constructors_first - - # Any sorting is better than no sorting - # https://dart-lang.github.io/linter/lints/sort_pub_dependencies.html - - sort_pub_dependencies - - # Default constructor comes first. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/sort_unnamed_constructors_first.html - - sort_unnamed_constructors_first - - # First test, then cast - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/test_types_in_equals.html - - test_types_in_equals - - # Hard to debug and bad style - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/throw_in_finally.html - - throw_in_finally - - # Help the compiler at compile time with non-null asserts rather than crashing at runtime - # Dart SDK: >= 2.11.0-182.0.dev • (Linter v0.1.120) - # https://dart-lang.github.io/linter/lints/tighten_type_of_initializing_formals.html - - tighten_type_of_initializing_formals - - # Type annotations make the compiler intelligent, use them - # https://dart-lang.github.io/linter/lints/type_annotate_public_apis.html - - type_annotate_public_apis - - # Don't add types for already typed constructor parameters. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/type_init_formals.html - - type_init_formals - - # Too many false positives. - # Using the pedantic package for the unawaited function doesn't make code better readable - # - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unawaited_futures.html - # - unawaited_futures - - # Remove async/await clutter when not required - # https://dart-lang.github.io/linter/lints/unnecessary_await_in_return.html - - unnecessary_await_in_return - - # Remove unnecessary braces - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unnecessary_brace_in_string_interps.html - - unnecessary_brace_in_string_interps - - # Yes, const everywhere. But not in an already const scope - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unnecessary_const.html - - unnecessary_const - - # Disabled because `final` prevents accidental reassignment - # https://dart-lang.github.io/linter/lints/unnecessary_final.html - # - unnecessary_final - - # Getter/setters can be added later on in a non API breaking manner - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unnecessary_getters_setters.html - - unnecessary_getters_setters - - # Flutter setState is a good example where a lambda should always be used. - # https://github.com/dart-lang/linter/issues/498 - # - # Some generic code sometimes requires lambdas, otherwise the generic type isn't forwarded correctly. - # - # https://dart-lang.github.io/linter/lints/unnecessary_lambdas.html - # - unnecessary_lambdas - - # Remove the optional `new` keyword - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unnecessary_new.html - - unnecessary_new - - # Don't assign `null` when value is already `null`. - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/unnecessary_null_aware_assignments.html - - unnecessary_null_aware_assignments - - # Remove ! when already non-nullable - # Dart SDK: >= 2.10.0-144.0.dev • (Linter v0.1.119) - # https://dart-lang.github.io/linter/lints/unnecessary_null_checks.html - - unnecessary_null_checks - - # Don't assign `null` when value is already `null`. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unnecessary_null_in_if_null_operators.html - - unnecessary_null_in_if_null_operators - - # If a variable doesn't change and is initialized, no need to define it as nullable (NNDB) - # Dart SDK: >= 2.10.0-10.0.dev • (Linter v0.1.118) - # https://dart-lang.github.io/linter/lints/unnecessary_nullable_for_final_variable_declarations.html - - unnecessary_nullable_for_final_variable_declarations - - # Remove overrides which simply call super - # https://dart-lang.github.io/linter/lints/unnecessary_overrides.html - - unnecessary_overrides - - # Remove clutter where possible - # https://dart-lang.github.io/linter/lints/unnecessary_parenthesis.html - - unnecessary_parenthesis - - # Use raw string only when needed - # Dart SDK: >= 2.8.0-dev.11.0 • (Linter v0.1.111) - # https://dart-lang.github.io/linter/lints/unnecessary_raw_strings.html - - unnecessary_raw_strings - - # Avoid magic overloads of + operators - # https://dart-lang.github.io/linter/lints/unnecessary_statements.html - - unnecessary_statements - - # Remove unnecessary escape characters - # Dart SDK: >= 2.8.0-dev.11.0 • (Linter v0.1.111) - # https://dart-lang.github.io/linter/lints/unnecessary_string_escapes.html - - unnecessary_string_escapes - - # Completely unnecessary code, simplify to save a few CPU cycles - # Dart SDK: >= 2.8.0-dev.10.0 • (Linter v0.1.110) - # https://dart-lang.github.io/linter/lints/unnecessary_string_interpolations.html - - unnecessary_string_interpolations - - # The variable is clear, remove clutter - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unnecessary_this.html - - unnecessary_this - - # Highlights potential bugs where unrelated types are compared with another. (always *not* equal). - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unrelated_type_equality_checks.html - - unrelated_type_equality_checks - - # Web only - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/unsafe_html.html - - unsafe_html - - # Always use hex syntax Color(0x00000001), never Color(1) - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/use_full_hex_values_for_flutter_colors.html - - use_full_hex_values_for_flutter_colors - - # Always use generic function type syntax, don't mix styles - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/use_function_type_syntax_for_parameters.html - - use_function_type_syntax_for_parameters - - # Adding a key without using it isn't helpful in applications, only for the Flutter SDK - # Dart SDK: >= 2.8.0-dev.1.0 • (Linter v0.1.108) - # https://dart-lang.github.io/linter/lints/use_key_in_widget_constructors.html - # - use_key_in_widget_constructors - - # Some might argue late is a code smell, this lint is very opinionated. It triggers only for private fields and - # therefore might actually cleanup some code. - # There is no performance impact either way https://github.com/dart-lang/linter/pull/2189#discussion_r457945301 - # Dart SDK: >= 2.10.0-10.0.dev • (Linter v0.1.118) - # https://dart-lang.github.io/linter/lints/use_late_for_private_fields_and_variables.html - - use_late_for_private_fields_and_variables - - # Use rethrow to preserve the original stacktrace. - # https://dart.dev/guides/language/effective-dart/usage#do-use-rethrow-to-rethrow-a-caught-exception - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/use_rethrow_when_possible.html - - use_rethrow_when_possible - - # Use the setter syntax - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/use_setters_to_change_properties.html - - use_setters_to_change_properties - - # In most cases, using a string buffer is preferred for composing strings due to its improved performance. - # https://dart-lang.github.io/linter/lints/use_string_buffers.html - - use_string_buffers - - # Naming is hard, strict rules don't help - # pedantic: disabled - # https://dart-lang.github.io/linter/lints/use_to_and_as_if_applicable.html - # - use_to_and_as_if_applicable - - # Catches invalid regular expressions. - # pedantic: enabled - # https://dart-lang.github.io/linter/lints/valid_regexps.html - - valid_regexps - - # Don't assign anything to void - # https://dart-lang.github.io/linter/lints/void_checks.html - - void_checks \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index c86ad62..c67d3ff 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "19.0.0" + version: "38.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "3.4.1" args: dependency: transitive description: @@ -43,20 +43,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" - cli_util: - dependency: transitive - description: - name: cli_util - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.0" collection: dependency: "direct main" description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" convert: dependency: transitive description: @@ -70,7 +63,7 @@ packages: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.2.0" crypto: dependency: transitive description: @@ -85,6 +78,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.1.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" glob: dependency: transitive description: @@ -120,6 +120,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.3" + lint: + dependency: "direct dev" + description: + name: lint + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.2" logging: dependency: transitive description: @@ -133,14 +140,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mime: dependency: transitive description: @@ -273,21 +280,21 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.16.8" + version: "1.20.2" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.9" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.3.19" + version: "0.4.11" typed_data: dependency: transitive description: @@ -301,7 +308,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "6.1.0+1" + version: "8.2.2" watcher: dependency: transitive description: @@ -331,4 +338,4 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.15.0-7.0.dev <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3febc8a..cf0d4d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: icalendar_parser description: Package to parse iCalendar (.ics) files written in pure Dart. -version: 1.0.1 +version: 1.0.1+1 homepage: https://github.com/TesteurManiak repository: https://github.com/TesteurManiak/icalendar_parser @@ -8,7 +8,8 @@ environment: sdk: '>=2.12.0 <3.0.0' dev_dependencies: - coverage: ^1.0.3 - test: ^1.16.8 + coverage: ^1.2.0 + lint: ^1.8.2 + test: ^1.20.2 dependencies: - collection: ^1.15.0 + collection: ^1.16.0 diff --git a/test/extensions_test.dart b/test/extensions_test.dart index 711d139..606b75c 100644 --- a/test/extensions_test.dart +++ b/test/extensions_test.dart @@ -20,8 +20,10 @@ void main() { }); test('unknown', () { - expect(() => ''.toIcsStatus(), - throwsA(const TypeMatcher())); + expect( + () => ''.toIcsStatus(), + throwsA(const TypeMatcher()), + ); }); }); @@ -37,8 +39,10 @@ void main() { }); test('unknown', () { - expect(() => ''.toIcsTransp(), - throwsA(const TypeMatcher())); + expect( + () => ''.toIcsTransp(), + throwsA(const TypeMatcher()), + ); }); }); }); diff --git a/test/format_test.dart b/test/format_test.dart index 737e5a6..a848cf3 100644 --- a/test/format_test.dart +++ b/test/format_test.dart @@ -1,5 +1,4 @@ import 'package:icalendar_parser/icalendar_parser.dart'; -import 'package:icalendar_parser/src/exceptions/icalendar_exception.dart'; import 'package:test/test.dart'; import 'test_utils.dart'; @@ -7,8 +6,10 @@ import 'test_utils.dart'; void main() { test('Missing PRODID', () { final noProdidLines = readFileLines('no_prodid.ics'); - expect(() => ICalendar.fromLines(noProdidLines), - throwsA(isA())); + expect( + () => ICalendar.fromLines(noProdidLines), + throwsA(isA()), + ); }); group('Valid calendar', () { @@ -30,8 +31,10 @@ void main() { test('ending w/ newline: unauthorized empty line', () { final lines = List.from(_valid)..add(''); - expect(() => ICalendar.fromLines(lines, allowEmptyLine: false), - throwsA(isA())); + expect( + () => ICalendar.fromLines(lines, allowEmptyLine: false), + throwsA(isA()), + ); }); test('w/ multiline description', () { @@ -39,7 +42,7 @@ void main() { expect( iCalendarLines.data.first['description'] as String, equals( - r'Lorem ipsum dolor sit amet, consectetur adipiscing elit.Sed suscipit malesuada sodales.Ut viverra metus neque, ut ullamcorper felis fermentum vel.Sed sodales mauris nec.', + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.Sed suscipit malesuada sodales.Ut viverra metus neque, ut ullamcorper felis fermentum vel.Sed sodales mauris nec.', ), ); }); @@ -162,12 +165,14 @@ void main() { test('with attendee', () { final _withAttendee = readFileLines('with_attendee.ics'); final iCalendar = ICalendar.fromLines(_withAttendee); - final List attendee = iCalendar.data + final attendees = iCalendar.data .firstWhere((e) => e.containsKey('attendee'))['attendee'] as List; - expect(attendee.length, 1); - expect(attendee[0]['mail'], 'joecool@host2.com'); - expect(attendee[0]['name'], 'Henry Cabot'); - expect(attendee[0]['role'], 'REQ-PARTICIPANT'); + expect(attendees.length, 1); + + final attendee = attendees[0] as Map; + expect(attendee['mail'], 'joecool@host2.com'); + expect(attendee['name'], 'Henry Cabot'); + expect(attendee['role'], 'REQ-PARTICIPANT'); }); test('with transp', () { diff --git a/test/parsing_test.dart b/test/parsing_test.dart index bbf9711..c9260f1 100644 --- a/test/parsing_test.dart +++ b/test/parsing_test.dart @@ -1,6 +1,5 @@ import 'package:collection/collection.dart' show IterableExtension; import 'package:icalendar_parser/icalendar_parser.dart'; -import 'package:icalendar_parser/src/model/ics_datetime.dart'; import 'package:test/test.dart'; import 'test_utils.dart'; @@ -8,18 +7,24 @@ import 'test_utils.dart'; void main() { group('Missing elements', () { test('no begin', () { - expect(() => ICalendar.fromLines(readFileLines('no_begin.ics')), - throwsA(isA())); + expect( + () => ICalendar.fromLines(readFileLines('no_begin.ics')), + throwsA(isA()), + ); }); test('no end', () { - expect(() => ICalendar.fromLines(readFileLines('no_end.ics')), - throwsA(isA())); + expect( + () => ICalendar.fromLines(readFileLines('no_end.ics')), + throwsA(isA()), + ); }); test('no version', () { - expect(() => ICalendar.fromLines(readFileLines('no_version.ics')), - throwsA(isA())); + expect( + () => ICalendar.fromLines(readFileLines('no_version.ics')), + throwsA(isA()), + ); }); }); @@ -63,8 +68,10 @@ void main() { test('already registered field', () { expect(ICalendar.objects.containsKey('TEST'), true); - expect(() => ICalendar.registerField(field: 'TEST'), - throwsA(isA())); + expect( + () => ICalendar.registerField(field: 'TEST'), + throwsA(isA()), + ); }); test('unregister field', () { @@ -75,8 +82,10 @@ void main() { test('unregister non existing field', () { expect(ICalendar.objects.containsKey('TEST'), false); - expect(() => ICalendar.unregisterField('TEST'), - throwsA(isA())); + expect( + () => ICalendar.unregisterField('TEST'), + throwsA(isA()), + ); }); test( @@ -97,9 +106,11 @@ void main() { final eventText = readFileLines('american_history.ics'); final iCalParsed = ICalendar.fromLines(eventText); expect( - iCalParsed.data[2]['url'], - equals( - 'https://americanhistorycalendar.com/eventscalendar/2,1853-emancipation-proclamation')); + iCalParsed.data[2]['url'], + equals( + 'https://americanhistorycalendar.com/eventscalendar/2,1853-emancipation-proclamation', + ), + ); }); });