run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
void run() async {
try {
ProgressReporter.reportPhase('Preparing fix operation');
final config = _prepareConfiguration();
if (!_validateConfiguration(config)) return;
if (config['dryRun']) {
ProgressReporter.reportPhase('Running dry-run analysis');
} else {
final confirmed = await _confirmDestructiveOperation(config);
if (!confirmed) {
printMessage('Fix operation cancelled by user.');
return;
}
}
final pathsToFix = _determinePaths(config);
await _executeFixes(pathsToFix, config);
_reportSuccess();
} catch (e) {
ErrorHandler.handleException(
ProjectCommandError.buildFailure,
e,
'Code fix operation failed',
);
}
}