| 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; | 5 library pub.validator; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'entrypoint.dart'; | 9 import 'entrypoint.dart'; |
| 10 import 'log.dart' as log; | 10 import 'log.dart' as log; |
| 11 import 'utils.dart'; | 11 import 'utils.dart'; |
| 12 import 'validator/compiled_dartdoc.dart'; | 12 import 'validator/compiled_dartdoc.dart'; |
| 13 import 'validator/dependency.dart'; | 13 import 'validator/dependency.dart'; |
| 14 import 'validator/dependency_override.dart'; | 14 import 'validator/dependency_override.dart'; |
| 15 import 'validator/directory.dart'; | 15 import 'validator/directory.dart'; |
| 16 import 'validator/executable.dart'; | 16 import 'validator/executable.dart'; |
| 17 import 'validator/license.dart'; | 17 import 'validator/license.dart'; |
| 18 import 'validator/name.dart'; | 18 import 'validator/name.dart'; |
| 19 import 'validator/pubspec.dart'; |
| 19 import 'validator/pubspec_field.dart'; | 20 import 'validator/pubspec_field.dart'; |
| 20 import 'validator/sdk_constraint.dart'; | 21 import 'validator/sdk_constraint.dart'; |
| 21 import 'validator/size.dart'; | 22 import 'validator/size.dart'; |
| 22 import 'validator/utf8_readme.dart'; | 23 import 'validator/utf8_readme.dart'; |
| 23 | 24 |
| 24 /// The base class for validators that check whether a package is fit for | 25 /// The base class for validators that check whether a package is fit for |
| 25 /// uploading. | 26 /// uploading. |
| 26 /// | 27 /// |
| 27 /// Each validator should override [errors], [warnings], or both to return | 28 /// Each validator should override [errors], [warnings], or both to return |
| 28 /// lists of errors or warnings to display to the user. Errors will cause the | 29 /// lists of errors or warnings to display to the user. Errors will cause the |
| (...skipping 22 matching lines...) Expand all Loading... |
| 51 /// Run all validators on the [entrypoint] package and print their results. | 52 /// Run all validators on the [entrypoint] package and print their results. |
| 52 /// | 53 /// |
| 53 /// The future completes with the error and warning messages, respectively. | 54 /// The future completes with the error and warning messages, respectively. |
| 54 /// | 55 /// |
| 55 /// [packageSize], if passed, should complete to the size of the tarred | 56 /// [packageSize], if passed, should complete to the size of the tarred |
| 56 /// package, in bytes. This is used to validate that it's not too big to | 57 /// package, in bytes. This is used to validate that it's not too big to |
| 57 /// upload to the server. | 58 /// upload to the server. |
| 58 static Future<Pair<List<String>, List<String>>> runAll( | 59 static Future<Pair<List<String>, List<String>>> runAll( |
| 59 Entrypoint entrypoint, [Future<int> packageSize]) { | 60 Entrypoint entrypoint, [Future<int> packageSize]) { |
| 60 var validators = [ | 61 var validators = [ |
| 62 new PubspecValidator(entrypoint), |
| 61 new LicenseValidator(entrypoint), | 63 new LicenseValidator(entrypoint), |
| 62 new NameValidator(entrypoint), | 64 new NameValidator(entrypoint), |
| 63 new PubspecFieldValidator(entrypoint), | 65 new PubspecFieldValidator(entrypoint), |
| 64 new DependencyValidator(entrypoint), | 66 new DependencyValidator(entrypoint), |
| 65 new DependencyOverrideValidator(entrypoint), | 67 new DependencyOverrideValidator(entrypoint), |
| 66 new DirectoryValidator(entrypoint), | 68 new DirectoryValidator(entrypoint), |
| 67 new ExecutableValidator(entrypoint), | 69 new ExecutableValidator(entrypoint), |
| 68 new CompiledDartdocValidator(entrypoint), | 70 new CompiledDartdocValidator(entrypoint), |
| 69 new Utf8ReadmeValidator(entrypoint), | 71 new Utf8ReadmeValidator(entrypoint), |
| 70 new SdkConstraintValidator(entrypoint) | 72 new SdkConstraintValidator(entrypoint) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 93 for (var warning in warnings) { | 95 for (var warning in warnings) { |
| 94 log.warning("* ${warning.split('\n').join('\n ')}"); | 96 log.warning("* ${warning.split('\n').join('\n ')}"); |
| 95 } | 97 } |
| 96 log.warning(""); | 98 log.warning(""); |
| 97 } | 99 } |
| 98 | 100 |
| 99 return new Pair<List<String>, List<String>>(errors, warnings); | 101 return new Pair<List<String>, List<String>>(errors, warnings); |
| 100 }); | 102 }); |
| 101 } | 103 } |
| 102 } | 104 } |
| OLD | NEW |