From e86f59507af520aef175a30c07b23172803a5014 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Mon, 31 Mar 2025 20:57:08 +0200 Subject: [PATCH] Use multi-return variant of should_include --- pyproject.toml | 1 + src/serena/symbol.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c13776ef..5dd97316 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -255,6 +255,7 @@ ignore = [ "W291", "W293", "B009", + "SIM103", # forbids multiple returns ] unfixable = [ "F841", diff --git a/src/serena/symbol.py b/src/serena/symbol.py index 70a9fa46..ce07647e 100644 --- a/src/serena/symbol.py +++ b/src/serena/symbol.py @@ -98,11 +98,13 @@ class Symbol(ToStringMixin): result = [] def should_include(s: "Symbol") -> bool: - name_match = (substring_matching and name in s.name) or name == s.name - kind_include_match = include_kinds is None or s.symbol_kind in include_kinds - kind_exclude_match = exclude_kinds is None or s.symbol_kind not in exclude_kinds - - return name_match and kind_include_match and kind_exclude_match + if not ((substring_matching and name in s.name) or name == s.name): + return False + if include_kinds is not None and s.symbol_kind not in include_kinds: + return False + if exclude_kinds is not None and s.symbol_kind in exclude_kinds: + return False + return True def traverse(s: "Symbol") -> None: if should_include(s):