fix: fix exclude_files while ignore_dotfiles is disabled (#678)

This commit is contained in:
Robert Kaussow 2023-09-26 20:50:42 +02:00 committed by GitHub
parent 024af07c65
commit e588c9469f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -210,9 +210,10 @@ class Settings:
excludes = self.config["rules"]["exclude_files"] excludes = self.config["rules"]["exclude_files"]
ignore_dotfiles = self.config["rules"]["ignore_dotfiles"] ignore_dotfiles = self.config["rules"]["ignore_dotfiles"]
if ignore_dotfiles and not self.args_files: if ignore_dotfiles:
excludes.append(".*") excludes.append(".*")
else:
if self.args_files:
del excludes[:] del excludes[:]
filelist = [] filelist = []

View File

@ -537,7 +537,11 @@ def parse_yaml_linenumbers(data, filename):
loader.compose_node = compose_node loader.compose_node = compose_node
loader.construct_mapping = construct_mapping loader.construct_mapping = construct_mapping
data = loader.get_single_data() or [] data = loader.get_single_data() or []
except (yaml.parser.ParserError, yaml.scanner.ScannerError) as e: except (
yaml.parser.ParserError,
yaml.scanner.ScannerError,
yaml.constructor.ConstructorError,
) as e:
raise LaterError("syntax error", e) from e raise LaterError("syntax error", e) from e
except (yaml.composer.ComposerError) as e: except (yaml.composer.ComposerError) as e:
e.problem = f"{e.context} {e.problem}" e.problem = f"{e.context} {e.problem}"

View File

@ -13,4 +13,4 @@ Changes can be made in a YAML configuration file or via CLI options, which are p
Please note that YAML attributes are overwritten while YAML lists are merged in any configuration files. Please note that YAML attributes are overwritten while YAML lists are merged in any configuration files.
To simplify single file linting, e.g. for debugging purposes, ansible-later ignores the `exclude_files` and `ignore_dotfiles` options when only one file is passed to the CLI. To simplify the linting of individual files, e.g. for debugging purposes, ansible-later ignores the `exclude_files` and `ignore_dotfiles` options when files are passed to the CLI.