Skip to content

Commit

Permalink
Gate runtime-import-in-type-checking-block (TCH004) behind enable…
Browse files Browse the repository at this point in the history
…d flag (#5789)

Closes #5787.
  • Loading branch information
charliermarsh authored and konstin committed Jul 19, 2023
1 parent f55a19b commit bed7883
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions crates/ruff/src/checkers/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5005,18 +5005,26 @@ impl<'a> Checker<'a> {
.collect()
};

flake8_type_checking::rules::runtime_import_in_type_checking_block(
self,
scope,
&mut diagnostics,
);
if self.enabled(Rule::RuntimeImportInTypeCheckingBlock) {
flake8_type_checking::rules::runtime_import_in_type_checking_block(
self,
scope,
&mut diagnostics,
);
}

flake8_type_checking::rules::typing_only_runtime_import(
self,
scope,
&runtime_imports,
&mut diagnostics,
);
if self.any_enabled(&[
Rule::TypingOnlyFirstPartyImport,
Rule::TypingOnlyThirdPartyImport,
Rule::TypingOnlyStandardLibraryImport,
]) {
flake8_type_checking::rules::typing_only_runtime_import(
self,
scope,
&runtime_imports,
&mut diagnostics,
);
}
}

if self.enabled(Rule::UnusedImport) {
Expand Down

0 comments on commit bed7883

Please sign in to comment.