I18N Rules (BI18N001–BI18N003)¶
Rules that detect internationalization issues in Gherkin feature files, such as hardcoded locale-specific text or non-ASCII characters.
Default severity: WARNING
BI18N001: hardcoded-date-format¶
Detects steps that contain hardcoded date or time formats (e.g.,
12/31/2024, 2024-12-31, 31-12-2024). Date formats are
locale-specific and may cause test failures in different regions or
time zones.
The rule matches common date patterns:
MM/DD/YYYYandM/D/YYYYYYYY-MM-DDandYYYY/MM/DDDD-MM-YYYYandDD/MM/YYYYHH:MM:SStime formats
Tags: i18n, date, locale
Since: 2.4.0
Example¶
Before → After
Before:
After:
How it works¶
- Iterates over all scenarios and their steps.
- Searches each step text for common date and time format patterns using a regex.
- Reports a diagnostic suggesting a placeholder or parameterized value.
Configuration¶
This rule has no configurable parameters.
BI18N002: hardcoded-currency¶
Detects steps that contain hardcoded currency symbols like $, €,
£, ¥, or currency codes like USD, EUR, GBP. Currency
symbols are locale-specific and may not be appropriate for all
regions.
Tags: i18n, currency, locale
Since: 2.4.0
Example¶
Before → After
Before:
After:
How it works¶
- Iterates over all scenarios and their steps.
- Searches each step text for currency symbols (
$,€,£,¥) and currency codes (USD,EUR,GBP,JPY, etc.) using a regex. - Reports a diagnostic suggesting a placeholder or parameterized value.
Configuration¶
This rule has no configurable parameters.
BI18N003: non-ascii-step-text¶
Detects steps that contain non-ASCII characters (e.g., accented letters, CJK characters, emoji). While UTF-8 is widely supported, non-ASCII characters can cause encoding issues in some test runners, CI environments, or when sharing files across platforms.
Tags: i18n, encoding, ascii
Since: 2.4.0
Default severity: INFO
Example¶
Before → After
Before:
After:
How it works¶
- Iterates over all scenarios and their steps.
- Searches each step text for characters outside the ASCII range (codepoints > 127) using a regex.
- Reports an INFO diagnostic suggesting to replace non-ASCII characters with ASCII equivalents or ensure UTF-8 encoding.
Configuration¶
This rule has no configurable parameters.