OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library pub.validator.pubspec_field; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import '../entrypoint.dart'; | 7 import '../entrypoint.dart'; |
10 import '../validator.dart'; | 8 import '../validator.dart'; |
11 | 9 |
12 /// A validator that checks that the pubspec has valid "author" and "homepage" | 10 /// A validator that checks that the pubspec has valid "author" and "homepage" |
13 /// fields. | 11 /// fields. |
14 class PubspecFieldValidator extends Validator { | 12 class PubspecFieldValidator extends Validator { |
15 PubspecFieldValidator(Entrypoint entrypoint) | 13 PubspecFieldValidator(Entrypoint entrypoint) |
16 : super(entrypoint); | 14 : super(entrypoint); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return; | 95 return; |
98 } | 96 } |
99 | 97 |
100 var goodScheme = new RegExp(r'^https?:'); | 98 var goodScheme = new RegExp(r'^https?:'); |
101 if (!goodScheme.hasMatch(url)) { | 99 if (!goodScheme.hasMatch(url)) { |
102 errors.add('Your pubspec.yaml\'s "$field" field must be an "http:" or ' | 100 errors.add('Your pubspec.yaml\'s "$field" field must be an "http:" or ' |
103 '"https:" URL, but it was "$url".'); | 101 '"https:" URL, but it was "$url".'); |
104 } | 102 } |
105 } | 103 } |
106 } | 104 } |
OLD | NEW |