@@ -14,19 +14,21 @@ import 'package:pub_semver/pub_semver.dart';
14
14
import 'package:yaml/yaml.dart' ;
15
15
16
16
const _allPathSuffix = '/example/all.yaml' ;
17
- const _effectiveDartOptionsRootUrl =
18
- 'https://raw.githubusercontent.com/tenhobi/effective_dart/master/lib' ;
19
- const _effectiveDartOptionsUrl =
20
- '$_effectiveDartOptionsRootUrl /analysis_options.yaml' ;
21
-
22
- const _flutterOptionsUrl =
23
- 'https://raw.githubusercontent.com/flutter/flutter/master/packages/flutter/lib/analysis_options_user.yaml' ;
24
- const _flutterRepoOptionsUrl =
25
- 'https://raw.githubusercontent.com/flutter/flutter/master/analysis_options.yaml' ;
26
- const _repoPathPrefix = 'https://raw.githubusercontent.com/dart-lang/linter/' ;
27
- const _rulePathPrefix = 'https://raw.githubusercontent.com/dart-lang/linter' ;
28
- const _stagehandOptionsUrl =
29
- 'https://raw.githubusercontent.com/dart-lang/stagehand/master/templates/analysis_options.yaml' ;
17
+ final _effectiveDartOptionsRootUrl = Uri .https (
18
+ 'raw.githubusercontent.com' , '/tenhobi/effective_dart/master/lib/' );
19
+ final _effectiveDartOptionsUrl =
20
+ _effectiveDartOptionsRootUrl.resolve ('analysis_options.yaml' );
21
+
22
+ final _flutterOptionsUrl = Uri .https ('raw.githubusercontent.com' ,
23
+ '/flutter/flutter/master/packages/flutter/lib/analysis_options_user.yaml' );
24
+ final _flutterRepoOptionsUrl = Uri .https ('raw.githubusercontent.com' ,
25
+ '/flutter/flutter/master/analysis_options.yaml' );
26
+ final _repoPathPrefix =
27
+ Uri .https ('raw.githubusercontent.com' , '/dart-lang/linter/' );
28
+ final _rulePathPrefix =
29
+ Uri .https ('raw.githubusercontent.com' , '/dart-lang/linter/' );
30
+ final _stagehandOptionsUrl = Uri .https ('raw.githubusercontent.com' ,
31
+ '/dart-lang/stagehand/master/templates/analysis_options.yaml' );
30
32
31
33
/// We don't care about SDKs previous to this bottom.
32
34
final Version bottomDartSdk = Version (2 , 0 , 0 );
@@ -88,7 +90,7 @@ Future<String> dartSdkForLinter(String version) async {
88
90
}
89
91
90
92
Future <List <String >> fetchRulesForVersion (String version) async =>
91
- score_utils.fetchRules ('$ _repoPathPrefix $ version $_allPathSuffix ' );
93
+ score_utils.fetchRules (_repoPathPrefix. resolve ( '$ version $_allPathSuffix ') );
92
94
93
95
Future <String > findSinceDartSdk (String linterVersion) async =>
94
96
await dartSdkForLinter (linterVersion);
@@ -131,8 +133,8 @@ Future<String> _crawlForVersion(String lint) async {
131
133
var client = http.Client ();
132
134
for (var minor = 1 ; minor < 31 ; ++ minor) {
133
135
var version = '0.1.$minor ' ;
134
- var req =
135
- await client .get ('$ _rulePathPrefix /$ version /lib/src/rules/$lint .dart' );
136
+ var req = await client
137
+ .get (_rulePathPrefix. resolve ( '$ version /lib/src/rules/$lint .dart') );
136
138
if (req.statusCode == 200 ) {
137
139
return version;
138
140
}
@@ -143,8 +145,8 @@ Future<String> _crawlForVersion(String lint) async {
143
145
Future <String > _fetchDEPSforVersion (String version) async {
144
146
var client = http.Client ();
145
147
//https://raw.githubusercontent.com/dart-lang/sdk/2.1.0-dev.1.0/DEPS
146
- var req = await client
147
- . get ( 'https:// raw.githubusercontent.com/dart-lang/sdk/$version /DEPS' );
148
+ var req = await client. get (
149
+ Uri . https ( ' raw.githubusercontent.com' , ' /dart-lang/sdk/$version /DEPS') );
148
150
return req.body;
149
151
}
150
152
@@ -154,7 +156,7 @@ Future<List<String>> _fetchEffectiveDartRules() async {
154
156
var includedOptions =
155
157
req.body.split ('include: package:effective_dart/' )[1 ].trim ();
156
158
return score_utils
157
- .fetchRules ('$ _effectiveDartOptionsRootUrl /$ includedOptions ' );
159
+ .fetchRules (_effectiveDartOptionsRootUrl. resolve ( includedOptions) );
158
160
}
159
161
160
162
Future <String > _fetchLinterForVersion (String version) async {
0 commit comments