runCliFix method
Future<void>
runCliFix(
- Iterable<
String> folders, - String rootFolder,
- LintConfig config, {
- String? sdkPath,
Implementation
Future<void> runCliFix(
Iterable<String> folders,
String rootFolder,
LintConfig config, {
String? sdkPath,
}) async {
final collection =
createAnalysisContextCollection(folders, rootFolder, sdkPath);
for (final context in collection.contexts) {
final (lintAnalysisConfig, analyzedFiles, _) = prepareLintAnalysis(
context,
folders,
rootFolder,
config,
collection,
);
for (final filePath in analyzedFiles) {
_logger?.infoVerbose('Fixing $filePath\n');
final unit = await context.currentSession.getResolvedUnit(filePath);
if (unit is ResolvedUnitResult) {
final (issuesNo, fixesNo) = _analyzeAndFixFile(
unit,
lintAnalysisConfig,
rootFolder,
filePath: filePath,
);
if (issuesNo != 0) {
_logger?.write(
'\nFix result: fixed $fixesNo out of $issuesNo issues\n',
);
} else {
_logger?.infoVerbose(
'No issues found',
);
}
}
}
}
return;
}