Repository: astral-sh/ruff
File: crates/ruff_linter/src/rules/airflow/rules/function_signature_change_in_3.rs (Rust)

Code before:
        match change_type {
            FunctionSignatureChangeType::KeywordOnly { .. } => {
                format!("`{function_name}` signature is changed in Airflow 3.0")
            }
        }
    }

    fn fix_title(&self) -> Option<String> {
        let Airflow3IncompatibleFunctionSignature { change_type, .. } = self;
        match change_type {
            FunctionSignatureChangeType::KeywordOnly { message } => Some(message.to_string()),
        }
    }
}

/// AIR303
pub(crate) fn airflow_3_function_signature_change(checker: &Checker, expr: &Expr) {
    if !checker.semantic().seen_module(Modules::AIRFLOW) {
        return;
    }

    let Expr::Call(call_expr @ ExprCall { arguments, .. }) = expr else {
        return;
    };

    let Expr::Attribute(ExprAttribute { attr, value, .. }) = &*call_expr.func else {
        return;
    };

    let qualified_name = if let Expr::Call(call) = value.as_ref() {
        // Resolve the qualified name of the constructor
        checker.semantic().resolve_qualified_name(&call.func)
    } else {
        // Resolve through assignment
        typing::resolve_assignment(value, checker.semantic())
    };

    let Some(qualified_name) = qualified_name else {
        return;
    };

    check_keyword_only_method(checker, &qualified_name, attr, arguments);
}

fn check_keyword_only_method(
    checker: &Checker,
    qualified_name: &QualifiedName,
    attr: &Identifier,
    arguments: &Arguments,
) {
    let has_positional_args =

Review comment (suggestion):
Would something like this work, or do you need `call_expr` somewhere else later?

```suggestion
    let Expr::Call(ExprCall { func, arguments, .. }) = expr else {
        return;
    };

    let Expr::Attribute(ExprAttribute { attr, value, .. }) = func else {
```

Code after:

    fn fix_title(&self) -> Option<String> {
        let Airflow3IncompatibleFunctionSignature { change_type, .. } = self;
        match change_type {
            FunctionSignatureChangeType::KeywordOnly { message } => Some(message.to_string()),
        }
    }
}

/// AIR303
pub(crate) fn airflow_3_incompatible_function_signature(checker: &Checker, expr: &Expr) {
    if !checker.semantic().seen_module(Modules::AIRFLOW) {
        return;
    }

    let Expr::Call(ExprCall {
        func, arguments, ..
    }) = expr
    else {
        return;
    };

    let Expr::Attribute(ExprAttribute { attr, value, .. }) = func.as_ref() else {
        return;
    };

    // Resolve the qualified name: try variable assignments first, then fall back to direct
    // constructor calls.
    let qualified_name = typing::resolve_assignment(value, checker.semantic()).or_else(|| {
        value
            .as_call_expr()
            .and_then(|call| checker.semantic().resolve_qualified_name(&call.func))
    });

    let Some(qualified_name) = qualified_name else {
        return;
    };

    check_keyword_only_method(checker, &qualified_name, attr, arguments);
}

fn check_keyword_only_method(
    checker: &Checker,
    qualified_name: &QualifiedName,
    attr: &Identifier,
    arguments: &Arguments,
) {
    let has_positional_args =
        arguments.find_positional(0).is_some() || arguments.args.iter().any(Expr::is_starred_expr);

    if let ["airflow", "lineage", "hook", "HookLineageCollector"] = qualified_name.segments() {