Skip to content

Commit 399fd67

Browse files
committed
ci: solve sonar issue
1 parent ef1a429 commit 399fd67

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

leetcode_py/cli/utils/problem_finder.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,15 @@ def _add_problem_to_tag_map(
7171
problem_tags_map[problem_name].append(tag_name)
7272

7373

74-
def _process_tag_reference(
75-
tags_data: dict, item: dict, tag_name: str, problem_tags_map: dict[str, list[str]]
76-
) -> None:
77-
# Recursively resolve tag references
74+
def _process_tag_reference(item: dict, tag_name: str, problem_tags_map: dict[str, list[str]]) -> None:
7875
referenced_problems = find_problems_by_tag(item["tag"])
7976
for problem_name in referenced_problems:
8077
_add_problem_to_tag_map(problem_tags_map, problem_name, tag_name)
8178

8279

83-
def _process_tag_item(
84-
tags_data: dict, item: str | dict, tag_name: str, problem_tags_map: dict[str, list[str]]
85-
) -> None:
80+
def _process_tag_item(item: str | dict, tag_name: str, problem_tags_map: dict[str, list[str]]) -> None:
8681
if isinstance(item, dict) and "tag" in item:
87-
_process_tag_reference(tags_data, item, tag_name, problem_tags_map)
82+
_process_tag_reference(item, tag_name, problem_tags_map)
8883
elif isinstance(item, str):
8984
_add_problem_to_tag_map(problem_tags_map, item, tag_name)
9085

@@ -100,7 +95,7 @@ def _build_problem_tags_cache() -> dict[str, list[str]]:
10095
for tag_name, problems in tags_data.items():
10196
if isinstance(problems, list):
10297
for item in problems:
103-
_process_tag_item(tags_data, item, tag_name, problem_tags_map)
98+
_process_tag_item(item, tag_name, problem_tags_map)
10499

105100
return problem_tags_map
106101
except (ValueError, OSError, KeyError):

tests/test_problem_finder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def test_build_problem_tags_cache_with_real_tags():
1212
assert "two_sum" in result
1313
assert "grind-75" in result["two_sum"]
1414
assert "grind" in result["two_sum"]
15+
assert "test" in result["two_sum"]
1516

1617

1718
def test_get_tags_for_problem():
@@ -23,3 +24,4 @@ def test_get_tags_for_problem():
2324
tags = get_tags_for_problem("two_sum")
2425
assert "grind-75" in tags
2526
assert "grind" in tags
27+
assert "test" in tags

0 commit comments

Comments
 (0)