Unverified Commit 2000583e authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Revert "don't disable TODO issues in IDEs (#23274)" (#23297)

Devon asked me to revert commit c4d1b31b.

Merging on red to fix the build.
parent c4d1b31b
...@@ -231,7 +231,7 @@ linter: ...@@ -231,7 +231,7 @@ linter:
errors.add(null); errors.add(null);
errors.addAll(await process.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).toList()); errors.addAll(await process.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).toList());
// top is stderr // top is stderr
if (errors.isNotEmpty && (errors.first.contains(' issues found (ran in ') || errors.first.contains(' issue found (ran in '))) { if (errors.isNotEmpty && (errors.first.contains(' issues found. (ran in ') || errors.first.contains(' issue found. (ran in '))) {
errors.removeAt(0); // the "23 issues found" message goes onto stderr, which is concatenated first errors.removeAt(0); // the "23 issues found" message goes onto stderr, which is concatenated first
if (errors.isNotEmpty && errors.last.isEmpty) if (errors.isNotEmpty && errors.last.isEmpty)
errors.removeLast(); // if there's an "issues found" message, we put a blank line on stdout before it errors.removeLast(); // if there's an "issues found" message, we put a blank line on stdout before it
......
...@@ -24,6 +24,8 @@ analyzer: ...@@ -24,6 +24,8 @@ 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,8 +87,7 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -87,8 +87,7 @@ class AnalyzeOnce extends AnalyzeBase {
} }
}); });
server.onErrors.listen((FileAnalysisErrors fileErrors) { server.onErrors.listen((FileAnalysisErrors fileErrors) {
// Record the issues found (but filter out to do comments). errors.addAll(fileErrors.errors);
errors.addAll(fileErrors.errors.where((AnalysisError error) => error.type != 'TODO'));
}); });
await server.start(); await server.start();
...@@ -149,9 +148,9 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -149,9 +148,9 @@ class AnalyzeOnce extends AnalyzeBase {
final int errorCount = errors.length; final int errorCount = errors.length;
printStatus(''); printStatus('');
if (undocumentedMembers > 0) { if (undocumentedMembers > 0) {
throwToolExit('$errorCount ${pluralize('issue', errorCount)} found (ran in ${seconds}s; $dartdocMessage).'); throwToolExit('$errorCount ${pluralize('issue', errorCount)} found. (ran in ${seconds}s; $dartdocMessage)');
} else { } else {
throwToolExit('$errorCount ${pluralize('issue', errorCount)} found (ran in ${seconds}s).'); throwToolExit('$errorCount ${pluralize('issue', errorCount)} found. (ran in ${seconds}s)');
} }
} }
......
...@@ -96,7 +96,7 @@ void main() { ...@@ -96,7 +96,7 @@ void main() {
'warning $analyzerSeparator The parameter \'onPressed\' is required', 'warning $analyzerSeparator The parameter \'onPressed\' is required',
'info $analyzerSeparator The method \'_incrementCounter\' isn\'t used', 'info $analyzerSeparator The method \'_incrementCounter\' isn\'t used',
], ],
exitMessageContains: '2 issues found', exitMessageContains: '2 issues found.',
toolExit: true, toolExit: true,
); );
}, timeout: allowForSlowAnalyzeTests); }, timeout: allowForSlowAnalyzeTests);
...@@ -123,7 +123,7 @@ void main() { ...@@ -123,7 +123,7 @@ void main() {
'info $analyzerSeparator The method \'_incrementCounter\' isn\'t used', 'info $analyzerSeparator The method \'_incrementCounter\' isn\'t used',
'info $analyzerSeparator Only throw instances of classes extending either Exception or Error', 'info $analyzerSeparator Only throw instances of classes extending either Exception or Error',
], ],
exitMessageContains: '3 issues found', exitMessageContains: '3 issues found.',
toolExit: true, toolExit: true,
); );
}, timeout: allowForSlowAnalyzeTests); }, timeout: allowForSlowAnalyzeTests);
...@@ -154,7 +154,7 @@ void bar() { ...@@ -154,7 +154,7 @@ void bar() {
statusTextContains: <String>[ statusTextContains: <String>[
'Analyzing', 'Analyzing',
], ],
exitMessageContains: '1 issue found', exitMessageContains: '1 issue found.',
toolExit: true, toolExit: true,
); );
} finally { } finally {
...@@ -178,24 +178,6 @@ StringBuffer bar = StringBuffer('baz'); ...@@ -178,24 +178,6 @@ 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