From c25b3807748a4b72e88af914cc6f877c7913ec09 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 8 Jun 2022 17:47:32 +0100 Subject: [PATCH] Mark load-failure violation as unskippable (#2201) --- src/ansiblelint/_internal/rules.py | 17 ++++++++++++++++- test/eco/colsystem.result | 1 - 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ansiblelint/_internal/rules.py b/src/ansiblelint/_internal/rules.py index 4be7af4c39..96888d3980 100644 --- a/src/ansiblelint/_internal/rules.py +++ b/src/ansiblelint/_internal/rules.py @@ -10,6 +10,20 @@ from ansiblelint.file_utils import Lintable _logger = logging.getLogger(__name__) +LOAD_FAILURE_MD = """\ +## load-failure + +Linter failed to process a YAML file, probably because it is either: + +* contains unsupported encoding (only UTF-8 is supported) +* not an Ansible file +* it contains some unsupported custom YAML objects (`!!` prefix) +* it was not able to decrypt an inline `!vault` block. + +This violation **is not** skippable, so it cannot be added to the `warn_list` +or the `skip_list`. If a vault decryption issue cannot be avoided, the +offending file can be added to `exclude_paths` configuration. +""" # Derived rules are likely to want to access class members, so: @@ -130,5 +144,6 @@ class LoadingFailureRule(BaseRule): id = "load-failure" description = "Linter failed to process a YAML file, possible not an Ansible file." severity = "VERY_HIGH" - tags = ["core"] + tags = ["core", "unskippable"] version_added = "v4.3.0" + help = LOAD_FAILURE_MD diff --git a/test/eco/colsystem.result b/test/eco/colsystem.result index a9bc1719e7..7e42e30cb5 100644 --- a/test/eco/colsystem.result +++ b/test/eco/colsystem.result @@ -8,7 +8,6 @@ You can skip specific rules or tags by adding them to your configuration file: # .config/ansible-lint.yml warn_list: # or 'skip_list' to silence them completely - experimental # all rules tagged as experimental - - load-failure # Failed to load or parse file. - no-handler # Tasks that run when changed should likely be handlers. - unnamed-task # All tasks should be named. - yaml # Violations reported by yamllint.