customLint function
Runs plugins with custom_lint.dart on the given directory
In watch mode:
- This will run until the user types q to quit
- The plugin will hot-reload when the user changes it's code, and will cause a re-lint
- The exit code is the one from the last lint before quitting
- The user can force a reload by typing r
Otherwise:
- There is no hot-reload or watching so linting only happens once
- The process exits with the most recent result of the linter
Watch mode cannot be enabled if in release mode.
Implementation
Future<void> customLint({
bool watchMode = true,
required Directory workingDirectory,
bool fatalInfos = true,
bool fatalWarnings = true,
OutputFormatEnum format = OutputFormatEnum.plain,
bool fix = false,
}) async {
// Reset the code
exitCode = 0;
final channel = ServerIsolateChannel();
try {
await _runServer(
channel,
watchMode: watchMode,
workingDirectory: workingDirectory,
fatalInfos: fatalInfos,
fatalWarnings: fatalWarnings,
format: format,
fix: fix,
);
} catch (_) {
exitCode = 1;
} finally {
await channel.close();
}
}