Skip to content

Commit

Permalink
Update minimum SDK, latest pkg:lints, update CI actions (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo authored Oct 25, 2022
1 parent 2d84b16 commit 10435a4
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 54 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: ${{ matrix.sdk }}
- id: install
Expand All @@ -47,10 +47,10 @@ jobs:
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [2.12.0, dev]
sdk: [2.18.0, dev]
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: ${{ matrix.sdk }}
- id: install
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 1.2.0

* Require Dart 2.18.0

* Add better support for reading code points in the Unicode supplementary plane:

* Added `StringScanner.readCodePoint()`, which consumes an entire Unicode code
Expand Down
50 changes: 15 additions & 35 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,75 +1,55 @@
# https://dart.dev/guides/language/analysis-options
include: package:lints/recommended.yaml

analyzer:
strong-mode:
implicit-casts: false
language:
strict-casts: true
strict-inference: true
strict-raw-types: true

linter:
rules:
- always_declare_return_types
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_classes_with_only_static_members
- avoid_function_literals_in_foreach_calls
- avoid_dynamic_calls
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_renaming_method_parameters
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_returning_this
- avoid_single_cascade_in_expression_statements
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- comment_references
- constant_identifier_names
- control_flow_in_finally
- directives_ordering
- empty_statements
- file_names
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- join_return_with_assignment
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- non_constant_identifier_names
- omit_local_variable_types
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_asserts_in_initializer_lists
- prefer_const_constructors
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- prefer_function_declarations_over_variables
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_interpolation_to_compose_strings
- prefer_is_not_operator
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- prefer_single_quotes
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
- type_annotate_public_apis
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_null_aware_assignments
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_statements
- unnecessary_string_interpolations
- use_if_null_to_convert_nulls_to_bools
- use_raw_strings
- use_string_buffers
- void_checks
- use_super_parameters
3 changes: 1 addition & 2 deletions lib/src/eager_span_scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ class EagerSpanScanner extends SpanScanner {
}
}

EagerSpanScanner(String string, {sourceUrl, int? position})
: super(string, sourceUrl: sourceUrl, position: position);
EagerSpanScanner(super.string, {super.sourceUrl, super.position});

@override
bool scanChar(int character) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class StringScannerException extends SourceSpanFormatException {
/// This may be `null`, indicating that the source URL is unknown.
Uri? get sourceUrl => span?.sourceUrl;

StringScannerException(String message, SourceSpan span, String source)
: super(message, span, source);
StringScannerException(
super.message, SourceSpan super.span, String super.source);
}
3 changes: 1 addition & 2 deletions lib/src/line_scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ class LineScanner extends StringScanner {
}
}

LineScanner(String string, {sourceUrl, int? position})
: super(string, sourceUrl: sourceUrl, position: position);
LineScanner(super.string, {super.sourceUrl, super.position});

@override
bool scanChar(int character) {
Expand Down
7 changes: 3 additions & 4 deletions lib/src/span_scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ class SpanScanner extends StringScanner implements LineScanner {
/// [sourceUrl] is used as [SourceLocation.sourceUrl] for the returned
/// [FileSpan]s as well as for error reporting. It can be a [String], a
/// [Uri], or `null`.
SpanScanner(String string, {sourceUrl, int? position})
: _sourceFile = SourceFile.fromString(string, url: sourceUrl),
super(string, sourceUrl: sourceUrl, position: position);
SpanScanner(super.string, {super.sourceUrl, super.position})
: _sourceFile = SourceFile.fromString(string, url: sourceUrl);

/// Creates a new [SpanScanner] that eagerly computes line and column numbers.
///
/// In general [new SpanScanner] will be more efficient, since it avoids extra
/// In general [SpanScanner.new] will be more efficient, since it avoids extra
/// computation on every scan. However, eager scanning can be useful for
/// situations where the normal course of parsing frequently involves
/// accessing the current line and column numbers.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/string_scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class StringScanner {
/// [position] defaults to 0, the beginning of the string. [sourceUrl] is the
/// URL of the source of the string being scanned, if available. It can be
/// a [String], a [Uri], or `null`.
StringScanner(this.string, {sourceUrl, int? position})
StringScanner(this.string, {Object? sourceUrl, int? position})
: sourceUrl = sourceUrl == null
? null
: sourceUrl is String
Expand Down Expand Up @@ -205,7 +205,7 @@ class StringScanner {
name = '/$source/';
} else {
name =
pattern.toString().replaceAll('\\', '\\\\').replaceAll('"', '\\"');
pattern.toString().replaceAll(r'\', r'\\').replaceAll('"', r'\"');
name = '"$name"';
}
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description: A class for parsing strings using a sequence of patterns.
repository: https://github.com/dart-lang/string_scanner

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.18.0 <3.0.0"

dependencies:
source_span: ^1.8.0

dev_dependencies:
lints: ^1.0.0
lints: ^2.0.0
test: ^1.16.0

0 comments on commit 10435a4

Please sign in to comment.