Skip to content

Conversation

RottenRat
Copy link
Contributor

@RottenRat RottenRat commented Sep 9, 2025

New documentation linter (pkg/linters/docs):

The readme rule checks for the presence of README.md in the module.
The bilingual rule requires documentation in two languages: README.md and README_RU.md (empty files are also caught as an error).
Cyrillic-in-English rule - searches for Cyrillic characters in English .md files (without the _RU suffix).

Configuration:

Added documentation sections to global.Linters and LintersSettings with support for impact, exclude-rules (lists of modules/files/directories), and bilingual.disable. Merge impacts have been implemented. The rules and a YAML example are described in pkg/linters/docs/README.md.

Metrics and minor fixes:

metrics.SetLinterWarningsMetrics now accepts *global.Global.

Test data:

Example modules have been added: bad-cyrillic, bad-readme, good-module, as well as cases in testdata/docs-test and test-config.yaml to test the new rules.

Now dmt can automatically check that the module has a README, that the documentation is bilingual, and that there is no Cyrillic in English files. All of this is configured via linters-settings.documentation and included in the metrics.

Tests:

Add Minimocs

##Manual tests
good-module: OK

bad-readme:

🐒 [readme (#documentation)]
     Message:      README.md file is missing in module
     Module:       bad-readme
     FilePath:     README.md

bad-cyrillic:

🐒 [bilingual (#documentation)]
     Message:      README_RU.md file is missing - documentation should be available in both languages
     Module:       bad-cyrillic
     FilePath:     README_RU.md

🐒 [cyrillic-in-english (#documentation)]
     Message:      English documentation contains cyrillic characters
     Module:       bad-cyrillic
     Value:        Line 3: This module has кириллические символы in English documentation.
                   ----------------^^^^^^^^^^^^^-^^^^^^^
                   Line 5: ## Описание
                   ---^^^^^^^^
                   Line 7: This section contains русский текст mixed with English.

all modules:

time=... level=INFO msg="Run linters for `good-module` module"
time=... level=INFO msg="Run linters for `bad-cyrillic` module"
time=... level=INFO msg="Run linters for `bad-readme` module"

🐒 [bilingual (#documentation)]
     Message:      README_RU.md file is missing - documentation should be available in both languages
     Module:       bad-cyrillic
     FilePath:     README_RU.md

🐒 [cyrillic-in-english (#documentation)]
     Message:      English documentation contains cyrillic characters
     Module:       bad-cyrillic
     Value:        Line 3: This module has кириллические символы in English documentation.
                   ----------------^^^^^^^^^^^^^-^^^^^^^
                   Line 5: ## Описание
                   ---^^^^^^^^

Sinelnikov Michail added 2 commits September 8, 2025 16:19
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
@RottenRat RottenRat self-assigned this Sep 9, 2025
@RottenRat RottenRat marked this pull request as ready for review September 9, 2025 09:46
@RottenRat RottenRat requested a review from ldmonster September 9, 2025 09:46
Sinelnikov Michail added 7 commits September 10, 2025 14:32
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
@ldmonster ldmonster changed the title [dmt] add docs markdown linter [dmt] add docs linter Sep 19, 2025
RottenRat and others added 4 commits September 19, 2025 15:51
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
Sinelnikov Michail added 3 commits September 19, 2025 17:44
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
fix
Signed-off-by: Sinelnikov Michail <[email protected]>
@RottenRat RottenRat merged commit f88b9f0 into main Sep 19, 2025
3 checks passed
@ldmonster ldmonster deleted the documentation-linter branch October 3, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants