Coverage for app/venv/lib/python3.14/site-packages/weblate/checks/angularjs.py: 92%
13 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
1# Copyright © Michal Čihař <michal@weblate.org>
2# Copyright © Philipp Wolfer <ph.wolfer@gmail.com>
3#
4# SPDX-License-Identifier: GPL-3.0-or-later
6from __future__ import annotations
8import re
10from django.utils.translation import gettext_lazy
12from .format import BaseFormatCheck
14ANGULARJS_INTERPOLATION_MATCH = re.compile(
15 r"""
16 {{ # start symbol
17 \s* # ignore whitespace
18 ((.+?))
19 \s* # ignore whitespace
20 }} # end symbol
21 """,
22 re.VERBOSE,
23)
25WHITESPACE = re.compile(r"\s+")
28class AngularJSInterpolationCheck(BaseFormatCheck):
29 """Check for AngularJS interpolation string."""
31 check_id = "angularjs_format"
32 name = gettext_lazy("AngularJS interpolation string")
33 description = gettext_lazy("AngularJS interpolation strings do not match source.")
34 regexp = ANGULARJS_INTERPOLATION_MATCH
36 def cleanup_string(self, text: str) -> str:
37 return WHITESPACE.sub("", text)