Skip to content

Commit 25034b2

Browse files
committed
perf(registry): early exit matches_partial
1 parent 7bfb8f1 commit 25034b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

proselint/registry/checks/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ def path_segments(self) -> list[str]:
145145

146146
def matches_partial(self, partial: str) -> bool:
147147
"""Check if `partial` is a subset key of the full check path."""
148+
if self.path == partial:
149+
return True
150+
148151
partial_segments = partial.split(".")
149152

150153
return self.path_segments[: len(partial_segments)] == partial_segments

0 commit comments

Comments
 (0)