SHA256
1
0
forked from pool/ansible-lint
ansible-lint/fix-discover_lintables.patch
Boris Manojlovic ba070d5882 Accepting request 950365 from home:sebix:branches:systemsmanagement
- add fix-discover_lintables.patch to fix a test fail.
- refactor specfile, remove multipython, this is an application only.
- Update to version 5.3.2:
 - Too many changes to list here, see https://github.com/ansible-community/ansible-lint/releases

OBS-URL: https://build.opensuse.org/request/show/950365
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ansible-lint?expand=0&rev=6
2022-02-01 20:07:40 +00:00

42 lines
1.6 KiB
Diff

From fadda4ad7851fdf64dd94b5a9305fa8364d0fed7 Mon Sep 17 00:00:00 2001
From: Sebastian Wagner <sebix@sebix.at>
Date: Fri, 28 Jan 2022 19:23:44 +0100
Subject: [PATCH] fix discover_lintables: strip ./ from WcMatch return value
calling WcMatch('.', ...) causes the resulting file names to be prefixed
with `./`.
If the tests are run in a git-repository, this is not an issue, as git
is preferred of WcMatch in the code.
Therefore remove the `./` prefix from the WcMatch return value to get
the identical expected output.
fixes ansible-community/ansible-lint#1836
---
src/ansiblelint/file_utils.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/ansiblelint/file_utils.py b/src/ansiblelint/file_utils.py
index dad094b8d..b3cb1940c 100644
--- a/src/ansiblelint/file_utils.py
+++ b/src/ansiblelint/file_utils.py
@@ -261,11 +261,13 @@ def discover_lintables(options: Namespace) -> Dict[str, Any]:
if out is None:
exclude_pattern = "|".join(str(x) for x in options.exclude_paths)
_logger.info("Looking up for files, excluding %s ...", exclude_pattern)
- out = set(
- WcMatch(
- '.', exclude_pattern=exclude_pattern, flags=RECURSIVE, limit=256
- ).match()
- )
+ # remove './' prefix from output of WcMatch
+ out = set(map(lambda fname: fname[2:],
+ WcMatch(
+ '.', exclude_pattern=exclude_pattern, flags=RECURSIVE, limit=256
+ ).match()
+ )
+ )
return OrderedDict.fromkeys(sorted(out))