diff --git a/pkg/linters/docs/README.md b/pkg/linters/docs/README.md index c2ff6b59..8e0d0ab7 100644 --- a/pkg/linters/docs/README.md +++ b/pkg/linters/docs/README.md @@ -115,9 +115,9 @@ For every English documentation file in the `docs/` directory, a corresponding R **What it checks:** 1. Scans all `.md` files in the `docs/` directory (top-level only) -2. For each English documentation file, checks for a corresponding `.ru.md` or `_RU.md` file +2. For each English documentation file, checks for a corresponding `.ru.md` file 3. Validates that Russian counterparts exist for all documentation files -4. Ignores files that are already Russian (ending in `.ru.md` or `_RU.md`) +4. Ignores files that are already Russian (ending in `.ru.md`) **Why it matters:** @@ -159,15 +159,14 @@ my-module/ my-module/ └── docs/ ├── README.md # English version - ├── README_RU.md # Russian translation (legacy format) + ├── README.ru.md # Russian translation (legacy format) ├── CONFIGURATION.md - └── CONFIGURATION_RU.md + └── CONFIGURATION.ru.md ``` **Supported file naming conventions:** -- **Preferred:** `FILENAME.ru.md` (e.g., `README.ru.md`, `FAQ.ru.md`) -- **Legacy:** `FILENAME_RU.md` (e.g., `README_RU.md`, `FAQ_RU.md`) - case insensitive +- `FILENAME.ru.md` (e.g., `README.ru.md`, `FAQ.ru.md`) **Configuration:** @@ -196,7 +195,7 @@ English documentation files must not contain cyrillic characters. This rule scan **What it checks:** 1. Scans all `.md` and `.markdown` files in `docs/` directory (top-level only) -2. Skips files ending in `.ru.md` or `_RU.md` (Russian documentation) +2. Skips files ending in `.ru.md` (Russian documentation) 3. Detects cyrillic characters (А-Я, а-я, Ё, ё) in each line 4. Reports exact line numbers and positions where cyrillic characters appear 5. Provides visual indicators pointing to problematic characters @@ -599,17 +598,12 @@ But you have `docs/README-RU.md` or `docs/README_ru.md` (lowercase). 1. **Rename to the correct format:** ```bash - # Preferred format mv modules/my-module/docs/README-RU.md \ modules/my-module/docs/README.ru.md - - # Legacy format (also acceptable) - mv modules/my-module/docs/README-RU.md \ - modules/my-module/docs/README_RU.md ``` 2. **Supported naming conventions:** - ✅ `FILENAME.ru.md` (preferred) - - ✅ `FILENAME_RU.md` (legacy, case insensitive) + - ❌ `FILENAME_RU.md` (legacy, not supported) - ❌ `FILENAME-RU.md` (not supported) diff --git a/pkg/linters/docs/rules/bilingual.go b/pkg/linters/docs/rules/bilingual.go index 5246acca..fec04b32 100644 --- a/pkg/linters/docs/rules/bilingual.go +++ b/pkg/linters/docs/rules/bilingual.go @@ -16,7 +16,6 @@ import ( const ( BilingualRuleName = "bilingual" RuSuffix = ".ru.md" - RuFallbackSuffix = "_ru.md" ) func NewBilingualRule() *BilingualRule { @@ -61,10 +60,6 @@ func (r *BilingualRule) CheckBilingual(m pkg.Module, errorList *errors.LintRuleE continue } - if strings.HasSuffix(strings.ToLower(rel), RuFallbackSuffix) { - rel = strings.ToLower(rel) - } - fileSet[rel] = struct{}{} } @@ -73,18 +68,12 @@ func (r *BilingualRule) CheckBilingual(m pkg.Module, errorList *errors.LintRuleE continue } - if !strings.HasSuffix(rel, ".md") || strings.HasSuffix(rel, RuFallbackSuffix) || strings.HasSuffix(rel, RuSuffix) { + if !strings.HasSuffix(rel, ".md") || strings.HasSuffix(rel, RuSuffix) { continue } base := strings.TrimSuffix(rel, ".md") - // TODO: Delete it after renaming to .ru.md view - ruRelUpper := strings.ToLower(base) + RuFallbackSuffix - if _, fallbackOk := fileSet[ruRelUpper]; fallbackOk { - continue - } - ruRel := base + RuSuffix if _, ok := fileSet[ruRel]; !ok { errorList. diff --git a/pkg/linters/docs/rules/cyrillic_in_english.go b/pkg/linters/docs/rules/cyrillic_in_english.go index 1dbe0351..d5842938 100644 --- a/pkg/linters/docs/rules/cyrillic_in_english.go +++ b/pkg/linters/docs/rules/cyrillic_in_english.go @@ -24,7 +24,6 @@ var ( cyrPointerRe = regexp.MustCompile(`[А-Яа-яЁё]`) cyrFillerRe = regexp.MustCompile(`[^А-Яа-яЁё]`) russianDocRe = regexp.MustCompile(`\.ru\.md$`) - russianDocUpperRe = regexp.MustCompile(`(?i)_ru\.md$`) markdownExtensions = []string{".md", ".markdown"} ) @@ -74,11 +73,6 @@ func (r *CyrillicInEnglishRule) checkFile(m pkg.Module, fileName string, errorLi return } - // TODO: Delete it after renaming to .ru.md view - if russianDocUpperRe.MatchString(fileName) { - return - } - lines, err := getFileContent(fileName) if err != nil { errorList.WithFilePath(relPath).WithValue(err.Error()).Error("failed to read file") diff --git a/pkg/linters/no-cyrillic/README.md b/pkg/linters/no-cyrillic/README.md index 74207b2d..ec914869 100644 --- a/pkg/linters/no-cyrillic/README.md +++ b/pkg/linters/no-cyrillic/README.md @@ -36,7 +36,6 @@ The linter intelligently skips files where cyrillic is expected or acceptable: - **Russian documentation**: Files matching patterns: - `doc-ru-*.yaml` or `doc-ru-*.yml` - Russian documentation files - `*.ru.yaml`, `*.ru.yml`, `*.ru.json`, `*.ru.md`, `*.ru.html` - Russian localized files (e.g. `CHANGELOG/v0.3.21.ru.yml`) - - `*_RU.md` - Russian markdown files - `*_ru.html` - Russian HTML files - Files in `docs/site/` or `docs/documentation/` - Files in `tools/spelling/` diff --git a/pkg/linters/no-cyrillic/rules/files_test.go b/pkg/linters/no-cyrillic/rules/files_test.go index 4d420cc8..7f1fd283 100644 --- a/pkg/linters/no-cyrillic/rules/files_test.go +++ b/pkg/linters/no-cyrillic/rules/files_test.go @@ -54,8 +54,8 @@ func TestFilesRule_CheckFile_SkipPatterns(t *testing.T) { {name: "ru md suffix", relPath: "guide.ru.md", wantSkipped: true}, {name: "ru html suffix", relPath: "page.ru.html", wantSkipped: true}, - // *_RU.md and *_ru.html - {name: "RU md suffix", relPath: "README_RU.md", wantSkipped: true}, + // *.ru.md and *_ru.html + {name: "RU md suffix", relPath: "README.ru.md", wantSkipped: true}, {name: "ru html underscore", relPath: "index_ru.html", wantSkipped: true}, // docs/site and docs/documentation underscore-prefixed includes @@ -228,7 +228,7 @@ func TestFilesRule_CheckFile_SkipRussianFile(t *testing.T) { // Create test directory structure tempDir := t.TempDir() - testFile := filepath.Join(tempDir, "README_RU.md") + testFile := filepath.Join(tempDir, "README.ru.md") // Create a Russian file with cyrillic content (should be skipped) err := os.WriteFile(testFile, []byte("# Документация\nПривет мир\n"), 0600) diff --git a/test/e2e/README.md b/test/e2e/README.md index b4119939..09e0b900 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -96,7 +96,7 @@ go test ./test/e2e/ -run 'TestE2E//' -v | `module/missing-metadata` | module linter (definition-file, helmignore) + documentation linter (readme) | | `no-cyrillic/in-template` | no-cyrillic linter (Cyrillic characters in a yaml file) | | `no-cyrillic/skip-russian-files` | no-cyrillic linter skips Russian localized files (`*.ru.yml`, `*.ru.yaml`, `*.ru.json`, `doc-ru-*.yml`) while still reporting a regular Cyrillic template | -| `no-cyrillic/skip-filenames-extensions` | no-cyrillic linter skips every filename/path pattern (`doc-ru-*`, `*.ru.{yaml,yml,json,md,html}`, `*_RU.md`, `docs/site/_*`, `docs/documentation/_*`, `tools/spelling/*`, `openapi/conversions/*`, `module.yaml`, `i18n/*`, `ru.*`) and non-scanned extensions (`.txt`), reporting only one genuine Cyrillic template | +| `no-cyrillic/skip-filenames-extensions` | no-cyrillic linter skips every filename/path pattern (`doc-ru-*`, `*.ru.{yaml,yml,json,md,html}`, `docs/site/_*`, `docs/documentation/_*`, `tools/spelling/*`, `openapi/conversions/*`, `module.yaml`, `i18n/*`, `ru.*`) and non-scanned extensions (`.txt`), reporting only one genuine Cyrillic template | | `rbac/wildcards` | rbac linter (wildcards in a Role) | | `hooks/ingress` | hooks linter (Ingress without copy_custom_certificate hook) | | `openapi/bilingual` | openapi linter (missing doc-ru- translation, missing CRD module label) | diff --git a/test/e2e/testdata/no-cyrillic/skip-filenames-extensions/expected.yaml b/test/e2e/testdata/no-cyrillic/skip-filenames-extensions/expected.yaml index 1db54d2b..ecc8abdf 100644 --- a/test/e2e/testdata/no-cyrillic/skip-filenames-extensions/expected.yaml +++ b/test/e2e/testdata/no-cyrillic/skip-filenames-extensions/expected.yaml @@ -1,7 +1,7 @@ description: > Comprehensive coverage of the no-cyrillic files rule skip logic. The module contains Cyrillic in many files that must be skipped by filename/path - (doc-ru-*, *.ru.{yaml,yml,json,md,html}, *_RU.md, *_ru.html, docs/site/_*, + (doc-ru-*, *.ru.{yaml,yml,json,md,html}, *_ru.html, docs/site/_*, docs/documentation/_*, tools/spelling/*, openapi/conversions/*, module.yaml, i18n/*, and the new ru.* prefix) as well as in files whose extensions are not scanned at all (.txt). Only a single regular template with Cyrillic must be