Unverified Commit 48fe65c2 authored by Devon Carew's avatar Devon Carew Committed by GitHub

allow todos in user code to show in IDEs (#23303)

parent de9f18d2
...@@ -24,8 +24,6 @@ analyzer: ...@@ -24,8 +24,6 @@ analyzer:
errors: errors:
# treat missing required parameters as a warning (not a hint) # treat missing required parameters as a warning (not a hint)
missing_required_param: warning missing_required_param: warning
# allow having TODOs in the code
todo: ignore
linter: linter:
rules: rules:
......
...@@ -87,7 +87,8 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -87,7 +87,8 @@ class AnalyzeOnce extends AnalyzeBase {
} }
}); });
server.onErrors.listen((FileAnalysisErrors fileErrors) { server.onErrors.listen((FileAnalysisErrors fileErrors) {
errors.addAll(fileErrors.errors); // Record the issues found (but filter out to do comments).
errors.addAll(fileErrors.errors.where((AnalysisError error) => error.type != 'TODO'));
}); });
await server.start(); await server.start();
......
...@@ -178,6 +178,24 @@ StringBuffer bar = StringBuffer('baz'); ...@@ -178,6 +178,24 @@ StringBuffer bar = StringBuffer('baz');
tryToDelete(tempDir); tryToDelete(tempDir);
} }
}); });
testUsingContext('returns no issues for todo comments', () async {
const String contents = '''
// TODO(foobar):
StringBuffer bar = StringBuffer('baz');
''';
final Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_analyze_once_test_4.');
tempDir.childFile('main.dart').writeAsStringSync(contents);
try {
await runCommand(
command: AnalyzeCommand(workingDirectory: fs.directory(tempDir)),
arguments: <String>['analyze'],
statusTextContains: <String>['No issues found!'],
);
} finally {
tryToDelete(tempDir);
}
});
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment