registerAsyncJobLints function

void registerAsyncJobLints(
  1. PluginRegistry registry, {
  2. bool ownQueueReportedElsewhere = false,
})

Registers the rules of async_job_lints and their quick fixes in registry.

With ownQueueReportedElsewhere, bare_await stays quiet on a wait for a job of the controller's own queue, because a rule of the calling plugin reports that wait. Without it bare_await reports the wait as any other.

Implementation

void registerAsyncJobLints(
  PluginRegistry registry, {
  bool ownQueueReportedElsewhere = false,
}) {
  registry
    ..registerWarningRule(CtxInCleanup())
    ..registerWarningRule(ReleaseOnTheCall())
    ..registerFixForRule(ReleaseOnTheCall.code, PassReleaseToCall.new)
    ..registerWarningRule(SyncFakeAsync())
    ..registerLintRule(CatchWithoutCheck())
    ..registerFixForRule(CatchWithoutCheck.code, AddCheck.new)
    ..registerLintRule(
      BareAwait(ownQueueReportedElsewhere: ownQueueReportedElsewhere),
    );
}