Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions pkg/linters/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand Down Expand Up @@ -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:**

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

13 changes: 1 addition & 12 deletions pkg/linters/docs/rules/bilingual.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
const (
BilingualRuleName = "bilingual"
RuSuffix = ".ru.md"
RuFallbackSuffix = "_ru.md"
)

func NewBilingualRule() *BilingualRule {
Expand Down Expand Up @@ -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{}{}
}

Expand All @@ -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.
Expand Down
6 changes: 0 additions & 6 deletions pkg/linters/docs/rules/cyrillic_in_english.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
)

Expand Down Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion pkg/linters/no-cyrillic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/`
Expand Down
6 changes: 3 additions & 3 deletions pkg/linters/no-cyrillic/rules/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ go test ./test/e2e/ -run 'TestE2E/<linter>/<your-case>' -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) |
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading