Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: test/rule_test.dart

Issue 1978603003: Lint to detect dangling identifiers in docs (#240). (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/rule_test.dart
diff --git a/test/rule_test.dart b/test/rule_test.dart
index cd35c06282b55487908908e8c6c77a1484881b89..4483032a67c691f884f90cda2170f11cb868e0f9 100644
--- a/test/rule_test.dart
+++ b/test/rule_test.dart
@@ -309,8 +309,14 @@ defineSoloRuleTest(String ruleToTest) {
Annotation extractAnnotation(String line) {
int index = line.indexOf(new RegExp(r'(//|#)[ ]?LINT'));
- //Grab the first comment to see if there's one preceding the annotation.
- int comment = line.indexOf(new RegExp(r'(//|#)'));
+
+ // Grab the first comment to see if there's one preceding the annotation.
+ // Check for '#' first to allow for lints on dartdocs.
+ int comment = line.indexOf('#');
+ if (comment == -1) {
+ comment = line.indexOf('//');
+ }
+
if (index > -1 && comment == index) {
int column;
int length;
@@ -330,7 +336,7 @@ Annotation extractAnnotation(String line) {
String msg = null;
if (msgIndex < line.length) {
msg = line.substring(index + msgIndex).trim();
- if (msg.length == 0) {
+ if (msg.isEmpty) {
msg = null;
}
}

Powered by Google App Engine
This is Rietveld 408576698