diff --git a/README.rst b/README.rst index 7701447..4d360c7 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ E.g. ``tkldev-detective lint zoneminder`` For more information on how it works and how to develop more functionality, see -`overview`_, `custom modules`_ and `tools and tricks.rst`_ +`overview`_, `custom modules`_ and `tools and tricks`_ Copyright --------- diff --git a/tkldet_modules/yaml_check.py b/tkldet_modules/yaml_check.py index ee3c539..5102cd5 100644 --- a/tkldet_modules/yaml_check.py +++ b/tkldet_modules/yaml_check.py @@ -14,14 +14,17 @@ # # You should have received a copy of the GNU General Public License along with # tkldev-detective. If not, see . -import yaml +try: + import yaml +except ImportError: + YAML = False +else: + YAML = True from typing import Generator from libtkldet.linter import FileLinter, FileItem, register_linter from libtkldet.report import Report, FileReport, ReportLevel - -@register_linter class YamlLinter(FileLinter): ENABLE_TAGS: set[str] = {"ext:yaml", "ext:yml"} DISABLE_TAGS: set[str] = set() @@ -55,3 +58,6 @@ def check(self, item: FileItem) -> Generator[Report, None, None]: source="yaml_check", level=ReportLevel.ERROR, ) + +if YAML: + register_linter(YamlLinter)