mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Rename internal helper functions (#15771)
Refer: https://github.com/astral-sh/ruff/pull/15713#discussion_r1930700717
This commit is contained in:
parent
c161e4fb12
commit
e994970538
1 changed files with 6 additions and 6 deletions
|
@ -157,7 +157,7 @@ const REMOVED_CONTEXT_KEYS: [&str; 12] = [
|
|||
/// pass
|
||||
/// ```
|
||||
fn check_function_parameters(checker: &mut Checker, function_def: &StmtFunctionDef) {
|
||||
if !is_airflow_task_function_def(function_def, checker.semantic())
|
||||
if !is_airflow_task(function_def, checker.semantic())
|
||||
&& !is_execute_method_inherits_from_airflow_operator(function_def, checker.semantic())
|
||||
{
|
||||
return;
|
||||
|
@ -351,7 +351,7 @@ fn check_class_attribute(checker: &mut Checker, attribute_expr: &ExprAttribute)
|
|||
/// context.get("conf") # 'conf' is removed in Airflow 3.0
|
||||
/// ```
|
||||
fn check_context_key_usage_in_call(checker: &mut Checker, call_expr: &ExprCall) {
|
||||
if !in_airflow_task_function_def(checker.semantic()) {
|
||||
if !in_airflow_task_function(checker.semantic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ fn check_context_key_usage_in_call(checker: &mut Checker, call_expr: &ExprCall)
|
|||
/// Check if a subscript expression accesses a removed Airflow context variable.
|
||||
/// If a removed key is found, push a corresponding diagnostic.
|
||||
fn check_context_key_usage_in_subscript(checker: &mut Checker, subscript: &ExprSubscript) {
|
||||
if !in_airflow_task_function_def(checker.semantic()) {
|
||||
if !in_airflow_task_function(checker.semantic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1064,15 +1064,15 @@ fn is_airflow_builtin_or_provider(segments: &[&str], module: &str, symbol_suffix
|
|||
|
||||
/// Returns `true` if the current statement hierarchy has a function that's decorated with
|
||||
/// `@airflow.decorators.task`.
|
||||
fn in_airflow_task_function_def(semantic: &SemanticModel) -> bool {
|
||||
fn in_airflow_task_function(semantic: &SemanticModel) -> bool {
|
||||
semantic
|
||||
.current_statements()
|
||||
.find_map(|stmt| stmt.as_function_def_stmt())
|
||||
.is_some_and(|function_def| is_airflow_task_function_def(function_def, semantic))
|
||||
.is_some_and(|function_def| is_airflow_task(function_def, semantic))
|
||||
}
|
||||
|
||||
/// Returns `true` if the given function is decorated with `@airflow.decorators.task`.
|
||||
fn is_airflow_task_function_def(function_def: &StmtFunctionDef, semantic: &SemanticModel) -> bool {
|
||||
fn is_airflow_task(function_def: &StmtFunctionDef, semantic: &SemanticModel) -> bool {
|
||||
function_def.decorator_list.iter().any(|decorator| {
|
||||
semantic
|
||||
.resolve_qualified_name(map_callable(&decorator.expression))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue