Coverage for patterns/__init__.py: 30%

1"""Pattern detection for all languages."""

2

3 from __future__ import annotations

4

5 from patterns.python import check_patterns as check_patterns_python

6

7

8 def check_patterns(language: str, root, patterns: list[str] | None = None):

9 """Run pattern checks for a language.

10

11 Args:

12 language: Language name ("python", "typescript", "go")

13 root: AST root node

14 patterns: List of specific pattern functions to run, or None for all

15

16 Returns:

17 List of PatternViolation objects

18 """

19 if language == "python":

20 return check_patterns_python(root, patterns)

21 elif language == "typescript":

22 return []

23 elif language == "go":

24 return []

25 else:

26 return []