mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-07 21:25:08 +00:00
Config error only when flake8-import-conventions
alias conflicts with isort.required-imports
bound name (#15918)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
Previously an error was emitted any time the configuration required both an import of a module and an alias for that module. However, required imports could themselves contain an alias, which may or may not agree with the required alias. To wit: requiring `import pandas as pd` does not conflict with the `flake8-import-conventions.alias` config `{"pandas":"pd"}`. This PR refines the check before throwing an error. Closes #15911
This commit is contained in:
parent
4c15d7a559
commit
700e969c56
4 changed files with 56 additions and 4 deletions
|
@ -43,7 +43,7 @@ impl NameImports {
|
|||
|
||||
impl NameImport {
|
||||
/// Returns the name under which the member is bound (e.g., given `from foo import bar as baz`, returns `baz`).
|
||||
fn bound_name(&self) -> &str {
|
||||
pub fn bound_name(&self) -> &str {
|
||||
match self {
|
||||
NameImport::Import(import) => {
|
||||
import.name.as_name.as_deref().unwrap_or(&import.name.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue