Coverage for lintro / enums / doc_url_template.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Documentation URL templates for linting tools. 

2 

3Central registry of URL patterns used by tool plugins to generate 

4documentation links for rule codes. Templates use ``{code}`` as a 

5placeholder for the normalized rule identifier. 

6 

7Tools with non-trivial code normalization (e.g., Ruff resolving a code 

8to a rule-name slug, Hadolint routing DL/SC prefixes) perform that 

9work in their ``doc_url()`` method before formatting the template. 

10""" 

11 

12from __future__ import annotations 

13 

14from enum import StrEnum 

15 

16 

17class DocUrlTemplate(StrEnum): 

18 """URL templates for tool rule documentation. 

19 

20 Each value is a URL pattern. Templates containing ``{code}`` are 

21 formatted with the (possibly normalized) rule code at call time. 

22 Templates without ``{code}`` point to a single documentation page 

23 shared by all rules of that tool. 

24 """ 

25 

26 ACTIONLINT = "https://github.com/rhysd/actionlint/blob/main/docs/checks.md" 

27 ASTRO_CHECK = "https://docs.astro.build/en/guides/typescript/" 

28 BANDIT = "https://bandit.readthedocs.io/en/latest/plugins/index.html" 

29 CARGO_AUDIT = "https://rustsec.org/advisories/{code}" 

30 CARGO_DENY = "https://embarkstudios.github.io/cargo-deny/" 

31 CLIPPY = "https://rust-lang.github.io/rust-clippy/master/index.html#{code}" 

32 HADOLINT = "https://github.com/hadolint/hadolint/wiki/{code}" 

33 MARKDOWNLINT = "https://github.com/DavidAnson/markdownlint/blob/main/doc/{code}.md" 

34 MYPY = "https://mypy.readthedocs.io/en/stable/error_code_list.html" 

35 OSV = "https://osv.dev/vulnerability/{code}" 

36 OXLINT = "https://oxc.rs/docs/guide/usage/linter/rules/{code}" 

37 PYDOCLINT = "https://jsh9.github.io/pydoclint/how_to_config.html" 

38 RUFF = "https://docs.astral.sh/ruff/rules/{code}/" 

39 SEMGREP = "https://semgrep.dev/r/{code}" 

40 SHELLCHECK = "https://www.shellcheck.net/wiki/{code}" 

41 SQLFLUFF = "https://docs.sqlfluff.com/en/stable/rules.html#{code}" 

42 TAPLO = "https://taplo.tamasfe.dev/" 

43 TSC = "https://typescript.tv/errors/#ts{code}" 

44 YAMLLINT = "https://yamllint.readthedocs.io/en/stable/rules.html#{code}"