Skip to content

Commit

Permalink
Enable and fix non_constant_identifier_names lint (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Jun 29, 2022
1 parent b7f70cc commit 3b73292
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Expand Up @@ -44,6 +44,7 @@ linter:
- implementation_imports
- library_names
- library_prefixes
- no_leading_underscores_for_local_identifiers
- non_constant_identifier_names
# - one_member_abstracts
# - only_throw_errors
Expand Down
6 changes: 3 additions & 3 deletions lib/src/hitmap.dart
Expand Up @@ -99,7 +99,7 @@ class HitMap {
final ignoredLines = ignoredLinesList.iterator;
var hasCurrent = ignoredLines.moveNext();

bool _shouldIgnoreLine(Iterator<List<int>> ignoredRanges, int line) {
bool shouldIgnoreLine(Iterator<List<int>> ignoredRanges, int line) {
if (!hasCurrent || ignoredRanges.current.isEmpty) {
return false;
}
Expand Down Expand Up @@ -138,7 +138,7 @@ class HitMap {
final k = hits[i];
if (k is int) {
// Single line.
if (_shouldIgnoreLine(ignoredLines, k)) continue;
if (shouldIgnoreLine(ignoredLines, k)) continue;

addToMap(hitMap, k, hits[i + 1] as int);
} else if (k is String) {
Expand All @@ -147,7 +147,7 @@ class HitMap {
final start = int.parse(k.substring(0, splitPos));
final end = int.parse(k.substring(splitPos + 1));
for (var j = start; j <= end; j++) {
if (_shouldIgnoreLine(ignoredLines, j)) continue;
if (shouldIgnoreLine(ignoredLines, j)) continue;

addToMap(hitMap, j, hits[i + 1] as int);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/resolver.dart
Expand Up @@ -77,13 +77,13 @@ class Resolver {
return resolveSymbolicLinks(filePath);
}
if (uri.scheme == 'package') {
final _packages = this._packages;
if (_packages == null) {
final packages = _packages;
if (packages == null) {
return null;
}

final packageName = uri.pathSegments[0];
final packageUri = _packages[packageName];
final packageUri = packages[packageName];
if (packageUri == null) {
failed.add('$uri');
return null;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/util.dart
Expand Up @@ -13,7 +13,7 @@ Future<dynamic> retry(Future Function() f, Duration interval,
{Duration? timeout}) async {
var keepGoing = true;

Future<dynamic> _withTimeout(Future Function() f, {Duration? duration}) {
Future<dynamic> withTimeout(Future Function() f, {Duration? duration}) {
if (duration == null) {
return f();
}
Expand All @@ -27,7 +27,7 @@ Future<dynamic> retry(Future Function() f, Duration interval,
});
}

return _withTimeout(() async {
return withTimeout(() async {
while (keepGoing) {
try {
return await f();
Expand Down
4 changes: 2 additions & 2 deletions test/lcov_test.dart
Expand Up @@ -154,7 +154,7 @@ void main() {
// be very careful if you change the test file
expect(res, contains(' 0| return a - b;'));

expect(res, contains('| return _withTimeout(() async {'),
expect(res, contains('| return withTimeout(() async {'),
reason: 'be careful if you change lib/src/util.dart');

final hitLineRegexp = RegExp(r'\s+(\d+)\| return a \+ b;');
Expand All @@ -177,7 +177,7 @@ void main() {
// be very careful if you change the test file
expect(res, contains(' 0| return a - b;'));

expect(res, contains('| return _withTimeout(() async {'),
expect(res, contains('| return withTimeout(() async {'),
reason: 'be careful if you change lib/src/util.dart');

final hitLineRegexp = RegExp(r'\s+(\d+)\| return a \+ b;');
Expand Down

0 comments on commit 3b73292

Please sign in to comment.