OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, 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 'log.dart'; |
| 6 |
| 7 final _unittestPattern = "package:unittest"; |
| 8 final _checkedPattern = new RegExp(r"\bchecked\b"); |
| 9 final _abstractErrorPattern = |
| 10 new RegExp(r"\bAbstractClassInstantiationError\b"); |
| 11 final _typeErrorPattern = new RegExp(r"\bTypeError\b"); |
| 12 |
| 13 void validateFile(String path, String source, [List<String> todos]) { |
| 14 check(Pattern pattern, String noteMessage, String todo) { |
| 15 if (!source.contains(pattern)) return; |
| 16 note("${bold(path)} $noteMessage."); |
| 17 if (todos != null) todos.add(todo); |
| 18 } |
| 19 |
| 20 check(_unittestPattern, "uses the unittest package", "Migrate off unittest."); |
| 21 check(_checkedPattern, 'mentions "checked"', |
| 22 'Fix code that mentions "checked" mode.'); |
| 23 check(_abstractErrorPattern, 'mentions "AbstractClassInstantiationError"', |
| 24 "Remove code that checks for AbstractClassInstantiationError."); |
| 25 check(_typeErrorPattern, 'mentions "TypeError"', |
| 26 "Ensure code that checks for a TypeError uses 2.0 semantics."); |
| 27 } |
OLD | NEW |