forked from pool/ansible-lint
Accepting request 950681 from home:sebix:branches:systemsmanagement
update the patch OBS-URL: https://build.opensuse.org/request/show/950681 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ansible-lint?expand=0&rev=7
This commit is contained in:
parent
ba070d5882
commit
52086f75ce
@ -1,4 +1,4 @@
|
|||||||
From fadda4ad7851fdf64dd94b5a9305fa8364d0fed7 Mon Sep 17 00:00:00 2001
|
From f881ebfdb0ada1b00b06f9e6ff6b95f35996eff6 Mon Sep 17 00:00:00 2001
|
||||||
From: Sebastian Wagner <sebix@sebix.at>
|
From: Sebastian Wagner <sebix@sebix.at>
|
||||||
Date: Fri, 28 Jan 2022 19:23:44 +0100
|
Date: Fri, 28 Jan 2022 19:23:44 +0100
|
||||||
Subject: [PATCH] fix discover_lintables: strip ./ from WcMatch return value
|
Subject: [PATCH] fix discover_lintables: strip ./ from WcMatch return value
|
||||||
@ -13,29 +13,36 @@ the identical expected output.
|
|||||||
|
|
||||||
fixes ansible-community/ansible-lint#1836
|
fixes ansible-community/ansible-lint#1836
|
||||||
---
|
---
|
||||||
src/ansiblelint/file_utils.py | 12 +++++++-----
|
src/ansiblelint/file_utils.py | 13 ++++++++++---
|
||||||
1 file changed, 7 insertions(+), 5 deletions(-)
|
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/src/ansiblelint/file_utils.py b/src/ansiblelint/file_utils.py
|
diff --git a/src/ansiblelint/file_utils.py b/src/ansiblelint/file_utils.py
|
||||||
index dad094b8d..b3cb1940c 100644
|
index dad094b8d..f0c3d1857 100644
|
||||||
--- a/src/ansiblelint/file_utils.py
|
--- a/src/ansiblelint/file_utils.py
|
||||||
+++ b/src/ansiblelint/file_utils.py
|
+++ b/src/ansiblelint/file_utils.py
|
||||||
@@ -261,11 +261,13 @@ def discover_lintables(options: Namespace) -> Dict[str, Any]:
|
@@ -261,15 +261,22 @@ def discover_lintables(options: Namespace) -> Dict[str, Any]:
|
||||||
if out is None:
|
if out is None:
|
||||||
exclude_pattern = "|".join(str(x) for x in options.exclude_paths)
|
exclude_pattern = "|".join(str(x) for x in options.exclude_paths)
|
||||||
_logger.info("Looking up for files, excluding %s ...", exclude_pattern)
|
_logger.info("Looking up for files, excluding %s ...", exclude_pattern)
|
||||||
- out = set(
|
- out = set(
|
||||||
- WcMatch(
|
- WcMatch(
|
||||||
- '.', exclude_pattern=exclude_pattern, flags=RECURSIVE, limit=256
|
|
||||||
- ).match()
|
|
||||||
- )
|
|
||||||
+ # remove './' prefix from output of WcMatch
|
+ # remove './' prefix from output of WcMatch
|
||||||
+ out = set(map(lambda fname: fname[2:],
|
+ out = {
|
||||||
+ WcMatch(
|
+ strip_dotslash_prefix(fname)
|
||||||
+ '.', exclude_pattern=exclude_pattern, flags=RECURSIVE, limit=256
|
+ for fname in WcMatch(
|
||||||
+ ).match()
|
'.', exclude_pattern=exclude_pattern, flags=RECURSIVE, limit=256
|
||||||
+ )
|
).match()
|
||||||
+ )
|
- )
|
||||||
|
+ }
|
||||||
|
|
||||||
return OrderedDict.fromkeys(sorted(out))
|
return OrderedDict.fromkeys(sorted(out))
|
||||||
|
|
||||||
|
|
||||||
|
+def strip_dotslash_prefix(fname: str) -> str:
|
||||||
|
+ """Remove ./ leading from filenames."""
|
||||||
|
+ return fname[2:] if fname.startswith('./') else fname
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def guess_project_dir(config_file: Optional[str]) -> str:
|
||||||
|
"""Return detected project dir or current working directory."""
|
||||||
|
path = None
|
||||||
|
Loading…
Reference in New Issue
Block a user