Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit efd709f

Browse files
authored
Fix doc comment references among other new lints (#253)
Bump min SDK to 2.18
1 parent ca45fc4 commit efd709f

26 files changed

+204
-179
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
matrix:
4747
# Add macos-latest and/or windows-latest if relevant for this package.
4848
os: [ubuntu-latest]
49-
sdk: [2.12.0, dev]
49+
sdk: [2.18.0, dev]
5050
steps:
5151
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
5252
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.17.1-dev
2+
3+
* Require Dart 2.18
4+
15
## 1.17.0
26

37
* Add `Iterable.elementAtOrNull` and `List.elementAtOrNull` extension methods.

analysis_options.yaml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
include: package:lints/recommended.yaml
22

3+
analyzer:
4+
language:
5+
strict-casts: true
6+
37
linter:
48
rules:
9+
- always_declare_return_types
510
- avoid_dynamic_calls
6-
7-
# Errors
11+
- avoid_unused_constructor_parameters
12+
- cancel_subscriptions
13+
- directives_ordering
14+
- lines_longer_than_80_chars
15+
- literal_only_boolean_expressions
16+
- missing_whitespace_between_adjacent_strings
17+
- no_adjacent_strings_in_list
18+
- no_runtimeType_toString
19+
- omit_local_variable_types
20+
- package_api_docs
21+
- prefer_relative_imports
22+
- prefer_single_quotes
823
- test_types_in_equals
924
- throw_in_finally
10-
11-
# Style
12-
- avoid_private_typedef_functions
13-
- directives_ordering
14-
- only_throw_errors
25+
- type_annotate_public_apis
26+
- unawaited_futures
27+
- unnecessary_await_in_return
28+
- unnecessary_lambdas
29+
- use_super_parameters

lib/src/algorithms.dart

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ int binarySearchBy<E, K>(List<E> sortedList, K Function(E element) keyOf,
6565
/// If [compare] is omitted, this defaults to calling [Comparable.compareTo] on
6666
/// the objects. In this case, the objects must be [Comparable].
6767
///
68-
/// Returns [sortedList.length] if all the items in [sortedList] compare less
69-
/// than [value].
68+
/// Returns the length of [sortedList] if all the items in [sortedList] compare
69+
/// less than [value].
7070
int lowerBound<E>(List<E> sortedList, E value, {int Function(E, E)? compare}) {
7171
compare ??= defaultCompare;
7272
return lowerBoundBy<E, E>(sortedList, identity, compare, value);
@@ -76,11 +76,13 @@ int lowerBound<E>(List<E> sortedList, E value, {int Function(E, E)? compare}) {
7676
///
7777
/// Uses binary search to find the location of [value].
7878
/// This takes on the order of `log(n)` comparisons.
79-
/// Elements are compared using the [compare] function of the [keyOf] property of
80-
/// the elements.
81-
/// If the list isn't sorted according to this order, the result is unpredictable.
79+
/// Elements are compared using the [compare] function of the [keyOf] property
80+
/// of the elements.
81+
/// If the list isn't sorted according to this order, the result is
82+
/// unpredictable.
8283
///
83-
/// Returns [sortedList.length] if all the items in [sortedList] are before [value].
84+
/// Returns the length of [sortedList] if all the items in [sortedList] are
85+
/// before [value].
8486
///
8587
/// If [start] and [end] are supplied, only that range is searched,
8688
/// and only that range need to be sorted.
@@ -231,12 +233,12 @@ void mergeSort<E>(List<E> elements,
231233
var secondLength = end - middle;
232234
// secondLength is always the same as firstLength, or one greater.
233235
var scratchSpace = List<E>.filled(secondLength, elements[start]);
234-
E Function(E) id = identity;
235-
_mergeSort(elements, id, compare, middle, end, scratchSpace, 0);
236+
_mergeSort(elements, identity<E>, compare, middle, end, scratchSpace, 0);
236237
var firstTarget = end - firstLength;
237-
_mergeSort(elements, id, compare, start, middle, elements, firstTarget);
238-
_merge(id, compare, elements, firstTarget, end, scratchSpace, 0, secondLength,
239-
elements, start);
238+
_mergeSort(
239+
elements, identity<E>, compare, start, middle, elements, firstTarget);
240+
_merge(identity<E>, compare, elements, firstTarget, end, scratchSpace, 0,
241+
secondLength, elements, start);
240242
}
241243

242244
/// Sort [elements] using a merge-sort algorithm.
@@ -408,7 +410,7 @@ void quickSort<E>(List<E> elements, int Function(E a, E b) compare,
408410
_quickSort<E, E>(elements, identity, compare, Random(), start, end);
409411
}
410412

411-
/// Sort [elements] using a quick-sort algorithm.
413+
/// Sort [list] using a quick-sort algorithm.
412414
///
413415
/// The elements are compared using [compare] on the value provided by [keyOf]
414416
/// on the element.

lib/src/boollist.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ abstract class BoolList with ListMixin<bool> {
7474

7575
/// Generates a [BoolList] of values.
7676
///
77-
/// Creates a [BoolList] with [length] positions and fills it with values created by
78-
/// calling [generator] for each index in the range `0` .. `length - 1` in increasing order.
77+
/// Creates a [BoolList] with [length] positions and fills it with values
78+
/// created by calling [generator] for each index in the range
79+
/// `0` .. `length - 1` in increasing order.
7980
///
8081
/// The created list is fixed-length unless [growable] is true.
8182
factory BoolList.generate(

lib/src/canonicalized_map.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class CanonicalizedMap<C, K, V> implements Map<K, V> {
129129
void removeWhere(bool Function(K key, V value) test) =>
130130
_base.removeWhere((_, pair) => test(pair.key, pair.value));
131131

132-
@Deprecated("Use cast instead")
132+
@Deprecated('Use cast instead')
133133
Map<K2, V2> retype<K2, V2>() => cast<K2, V2>();
134134

135135
@override

lib/src/combined_wrappers/combined_iterable.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CombinedIterableView<T> extends IterableBase<T> {
1717
/// The iterables that this combines.
1818
final Iterable<Iterable<T>> _iterables;
1919

20-
/// Creates a combined view of [iterables].
20+
/// Creates a combined view of [_iterables].
2121
const CombinedIterableView(this._iterables);
2222

2323
@override

lib/src/combined_wrappers/combined_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CombinedListView<T> extends ListBase<T>
2424
/// The lists that this combines.
2525
final List<List<T>> _lists;
2626

27-
/// Creates a combined view of [lists].
27+
/// Creates a combined view of [_lists].
2828
CombinedListView(this._lists);
2929

3030
@override

lib/src/combined_wrappers/combined_map.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class CombinedMapView<K, V> extends UnmodifiableMapBase<K, V> {
4040
return null;
4141
}
4242

43-
/// The keys of [this].
43+
/// The keys of `this`.
4444
///
4545
/// The returned iterable has efficient `contains` operations, assuming the
46-
/// iterables returned by the wrapped maps have efficient `contains` operations
47-
/// for their `keys` iterables.
46+
/// iterables returned by the wrapped maps have efficient `contains`
47+
/// operations for their `keys` iterables.
4848
///
4949
/// The `length` must do deduplication and thus is not optimized.
5050
///

lib/src/empty_unmodifiable_set.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
import 'dart:collection';
66

7-
import 'package:collection/collection.dart';
7+
import 'unmodifiable_wrappers.dart';
8+
import 'wrappers.dart';
89

910
/// An unmodifiable, empty set which can be constant.
1011
class EmptyUnmodifiableSet<E> extends IterableBase<E>
@@ -26,7 +27,7 @@ class EmptyUnmodifiableSet<E> extends IterableBase<E>
2627
Iterable<E> followedBy(Iterable<E> other) => DelegatingIterable(other);
2728
@override
2829
E? lookup(Object? element) => null;
29-
@Deprecated("Use cast instead")
30+
@Deprecated('Use cast instead')
3031
@override
3132
EmptyUnmodifiableSet<T> retype<T>() => EmptyUnmodifiableSet<T>();
3233
@override

0 commit comments

Comments
 (0)