From af3300641271f4b46ae6200076c6f3d2175dedce Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Mon, 11 Dec 2023 10:36:51 +0100 Subject: [PATCH] fix tests and exclude `_` --- refurb/checks/readability/fluid_interface.py | 4 ++-- test/data/err_184.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/refurb/checks/readability/fluid_interface.py b/refurb/checks/readability/fluid_interface.py index f0896e5..835fdaa 100644 --- a/refurb/checks/readability/fluid_interface.py +++ b/refurb/checks/readability/fluid_interface.py @@ -91,7 +91,7 @@ def check_call(node, name: str | None = None) -> bool: # Nested case CallExpr(callee=MemberExpr(expr=call_node, name=y)): - return check_call(call_node) + return check_call(call_node, name=name) return False @@ -141,7 +141,7 @@ def check_stmts(stmts: list[Statement], errors: list[Error]) -> None: name_expr.fullname = last visitors.append(NameReferenceVisitor(name_expr, stmt)) - last = name + last = name if name != "_" else "" case ReturnStmt(expr=rvalue): if last and check_call(rvalue, name=last): errors.append( diff --git a/test/data/err_184.py b/test/data/err_184.py index f9dc580..58f37b3 100644 --- a/test/data/err_184.py +++ b/test/data/err_184.py @@ -97,6 +97,11 @@ def assign_alternating(df, df2): # these will not +def ignored(x): + _ = x.op1() + _ = _.op2() + return _ + def _(x): y = x.m() return y.operation(*[v for v in y])