• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dart-lang / linter / 3690449303

pending completion
3690449303

push

github

GitHub
Fix `unnecessary_parenthesis` with postfix bang operator. (#3904)

2 of 2 new or added lines in 1 file covered. (100.0%)

8263 of 8640 relevant lines covered (95.64%)

1.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/src/util/score_utils.dart
1
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4

5
import 'package:analyzer/src/lint/config.dart'; // ignore: implementation_imports
6
import 'package:http/http.dart' as http;
7

8
Future<List<String>> _readCoreLints() async => _fetchLints(
9
    'https://raw.githubusercontent.com/dart-lang/lints/main/lib/core.yaml');
10

11
/// todo(pq): de-duplicate these fetches / URIs
12
Future<List<String>> _readFlutterLints() async => _fetchLints(
13
    'https://raw.githubusercontent.com/flutter/packages/main/packages/flutter_lints/lib/flutter.yaml');
14

15
Future<List<String>> _readRecommendedLints() async => _fetchLints(
16
    'https://raw.githubusercontent.com/dart-lang/lints/main/lib/recommended.yaml');
17

18
/// todo(pq): update `scorecard.dart` to reuse these fetch functions.
19
Future<List<String>> _fetchLints(String url) async {
20
  var client = http.Client();
21
  var req = await client.get(Uri.parse(url));
22
  return _readLints(req.body);
23
}
24

25
List<String> _readLints(String contents) {
26
  var lintConfigs = processAnalysisOptionsFile(contents);
27
  if (lintConfigs == null) {
28
    return [];
29
  }
30
  return lintConfigs.ruleConfigs.map((c) => c.name ?? '<unknown>').toList();
31
}
32

33
List<String>? _coreRules;
34
List<String>? _recommendedRules;
35
List<String>? _flutterRules;
36

37
Future<List<String>> get coreRules async =>
38
    _coreRules ??= await _readCoreLints();
39

40
Future<List<String>> get recommendedRules async =>
41
    _recommendedRules ??= await _readRecommendedLints();
42

43
Future<List<String>> get flutterRules async =>
44
    _flutterRules ??= await _readFlutterLints();
45

46
Future<List<String>> fetchRules(Uri optionsUrl) async {
47
  var config = await _fetchConfig(optionsUrl);
48
  if (config == null) {
49
    print('no config found for: $optionsUrl (SKIPPED)');
50
    return <String>[];
51
  }
52
  var rules = <String>[];
53
  for (var ruleConfig in config.ruleConfigs) {
54
    var name = ruleConfig.name;
55
    if (name != null) {
56
      rules.add(name);
57
    }
58
  }
59
  return rules;
60
}
61

62
Future<LintConfig?> _fetchConfig(Uri url) async {
63
  print('loading $url...');
64
  var req = await http.get(url);
65
  return processAnalysisOptionsFile(req.body);
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc