mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 13:38:27 +00:00
* fix: remove translations from GL report options
Options need not be translated, their display label gets translated
client side.
* fix: make group by options translatable
* ci: semgrep rule for translated options in report
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
(cherry picked from commit fa819f2fb0)
35 lines
1.2 KiB
YAML
35 lines
1.2 KiB
YAML
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
|
|
|
|
- id: frappe-translated-values-in-business-logic
|
|
paths:
|
|
include:
|
|
- "**/report"
|
|
patterns:
|
|
- pattern-inside: |
|
|
{..., filters: [...], ...}
|
|
- pattern: |
|
|
{..., options: [..., __("..."), ...], ...}
|
|
message: |
|
|
Using translated values in options field will require you to translate the values while comparing in business logic. Instead of passing translated labels provide objects that contain both label and value. e.g. { label: __("Option value"), value: "Option value"}
|
|
languages: [javascript]
|
|
severity: ERROR
|