mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
allow todos in user code to show in IDEs (#23303)
This commit is contained in:
parent
de9f18d288
commit
48fe65c236
|
@ -24,8 +24,6 @@ analyzer:
|
|||
errors:
|
||||
# treat missing required parameters as a warning (not a hint)
|
||||
missing_required_param: warning
|
||||
# allow having TODOs in the code
|
||||
todo: ignore
|
||||
|
||||
linter:
|
||||
rules:
|
||||
|
|
|
@ -87,7 +87,8 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||
}
|
||||
});
|
||||
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();
|
||||
|
|
|
@ -178,6 +178,24 @@ StringBuffer bar = StringBuffer('baz');
|
|||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue