[flutter_tools] Decouple fatal-warnings check from fatal-infos (#113748)
This commit is contained in:
parent
d988c11a87
commit
5d93894264
@ -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() {}
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
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:
|
|||||||
'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,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user