Unverified Commit 5d938942 authored by Lucas Britto's avatar Lucas Britto Committed by GitHub

[flutter_tools] Decouple fatal-warnings check from fatal-infos (#113748)

parent d988c11a
...@@ -167,8 +167,7 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -167,8 +167,7 @@ class AnalyzeOnce extends AnalyzeBase {
if (severityLevel == AnalysisSeverity.error) { if (severityLevel == AnalysisSeverity.error) {
return true; return true;
} }
if (severityLevel == AnalysisSeverity.warning && if (severityLevel == AnalysisSeverity.warning && argResults['fatal-warnings'] as bool) {
(argResults['fatal-warnings'] as bool || argResults['fatal-infos'] as bool)) {
return true; return true;
} }
if (severityLevel == AnalysisSeverity.info && argResults['fatal-infos'] as bool) { if (severityLevel == AnalysisSeverity.info && argResults['fatal-infos'] as bool) {
......
...@@ -339,7 +339,7 @@ int analyze() {} ...@@ -339,7 +339,7 @@ int analyze() {}
); );
}); });
testWithoutContext('analyze once only fatal-infos has warning issue finally exit code 1.', () async { testWithoutContext('analyze once only fatal-infos has warning issue finally exit code 0.', () async {
const String warningSourceCode = ''' const String warningSourceCode = '''
int analyze() {} int analyze() {}
'''; ''';
...@@ -359,6 +359,30 @@ analyzer: ...@@ -359,6 +359,30 @@ analyzer:
'missing_return', 'missing_return',
], ],
exitMessageContains: '1 issue found.', exitMessageContains: '1 issue found.',
);
});
testWithoutContext('analyze once only fatal-warnings has warning issue finally exit code 1.', () async {
const String warningSourceCode = '''
int analyze() {}
''';
final File optionsFile = fileSystem.file(fileSystem.path.join(projectPath, 'analysis_options.yaml'));
optionsFile.writeAsStringSync('''
analyzer:
errors:
missing_return: warning
''');
fileSystem.directory(projectPath).childFile('main.dart').writeAsStringSync(warningSourceCode);
await runCommand(
arguments: <String>['analyze','--no-pub', '--no-fatal-infos', '--fatal-warnings'],
statusTextContains: <String>[
'warning',
'missing_return',
],
exitMessageContains: '1 issue found.',
exitCode: 1, exitCode: 1,
); );
}); });
......
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