42 lines
1.6 KiB
Diff
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))
|
||
|
|