ci(semgrep): add translation checks for report labels (#27280)
* ci(semgrep): add translation checks for report labels * refactor: shift report tests to it's own yml path can't be applied on a test id basis * ci: ignore regional report in translation checks [skip ci]
This commit is contained in:
parent
9dc0843cbd
commit
72ece75b11
15
.github/helper/semgrep_rules/report.py
vendored
Normal file
15
.github/helper/semgrep_rules/report.py
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
from frappe import _
|
||||
|
||||
|
||||
# ruleid: frappe-missing-translate-function-in-report-python
|
||||
{"label": "Field Label"}
|
||||
|
||||
# ruleid: frappe-missing-translate-function-in-report-python
|
||||
dict(label="Field Label")
|
||||
|
||||
|
||||
# ok: frappe-missing-translate-function-in-report-python
|
||||
{"label": _("Field Label")}
|
||||
|
||||
# ok: frappe-missing-translate-function-in-report-python
|
||||
dict(label=_("Field Label"))
|
21
.github/helper/semgrep_rules/report.yml
vendored
Normal file
21
.github/helper/semgrep_rules/report.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
rules:
|
||||
- id: frappe-missing-translate-function-in-report-python
|
||||
paths:
|
||||
include:
|
||||
- "**/report"
|
||||
exclude:
|
||||
- "**/regional"
|
||||
pattern-either:
|
||||
- patterns:
|
||||
- pattern: |
|
||||
{..., "label": "...", ...}
|
||||
- pattern-not: |
|
||||
{..., "label": _("..."), ...}
|
||||
- patterns:
|
||||
- pattern: dict(..., label="...", ...)
|
||||
- pattern-not: dict(..., label=_("..."), ...)
|
||||
message: |
|
||||
All user facing text must be wrapped in translate function. Please refer to translation documentation. https://frappeframework.com/docs/user/en/guides/basics/translations
|
||||
languages: [python]
|
||||
severity: ERROR
|
||||
|
Loading…
x
Reference in New Issue
Block a user