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

Commit 26ac156

Browse files
committed
Pass a Uri to package:http APIs
Prepare for dart-lang/http#375
1 parent 0629001 commit 26ac156

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# 0.1.127-dev
2+
13
# 0.1.126
24

35
* fixed false negatives for `prefer_collection_literals` when a LinkedHashSet or

lib/src/util/score_utils.dart

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
import 'package:analyzer/src/lint/config.dart'; // ignore: implementation_imports
66
import 'package:http/http.dart' as http;
77

8-
const _pedanticOptionsRootUrl =
9-
'https://raw.githubusercontent.com/dart-lang/pedantic/master/lib';
10-
const _pedanticOptionsUrl = '$_pedanticOptionsRootUrl/analysis_options.yaml';
8+
final _pedanticOptionsRootUrl =
9+
Uri.https('raw.githubusercontent.com', '/dart-lang/pedantic/master/lib/');
10+
final _pedanticOptionsUrl =
11+
_pedanticOptionsRootUrl.resolve('analysis_options.yaml');
1112

1213
List<String> _pedanticRules;
1314

1415
Future<List<String>> get pedanticRules async =>
1516
_pedanticRules ??= await _fetchPedanticRules();
1617

17-
Future<List<String>> fetchRules(String optionsUrl) async {
18+
Future<List<String>> fetchRules(Uri optionsUrl) async {
1819
final config = await _fetchConfig(optionsUrl);
1920
if (config == null) {
2021
print('no config found for: $optionsUrl (SKIPPED)');
@@ -27,18 +28,16 @@ Future<List<String>> fetchRules(String optionsUrl) async {
2728
return rules;
2829
}
2930

30-
Future<LintConfig> _fetchConfig(String url) async {
31+
Future<LintConfig> _fetchConfig(Uri url) async {
3132
print('loading $url...');
32-
final client = http.Client();
33-
final req = await client.get(url);
33+
final req = await http.get(url);
3434
return processAnalysisOptionsFile(req.body);
3535
}
3636

3737
Future<List<String>> _fetchPedanticRules() async {
38-
final client = http.Client();
3938
print('loading $_pedanticOptionsUrl...');
40-
final req = await client.get(_pedanticOptionsUrl);
39+
final req = await http.get(_pedanticOptionsUrl);
4140
final includedOptions =
4241
req.body.split('include: package:pedantic/')[1].trim();
43-
return fetchRules('$_pedanticOptionsRootUrl/$includedOptions');
42+
return fetchRules(_pedanticOptionsRootUrl.resolve(includedOptions));
4443
}

lib/src/version.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// Package version. Synchronized w/ pubspec.yaml.
6-
const String version = '0.1.126';
6+
const String version = '0.1.127-dev';

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: linter
2-
version: 0.1.126
2+
version: 0.1.127-dev
33

44
description: >-
55
The implementation of the lint rules supported by the analyzer framework.

0 commit comments

Comments
 (0)