summaryrefslogtreecommitdiff
path: root/test/sanity
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2017-04-12 23:02:56 -0700
committerMatt Clay <matt@mystile.com>2017-04-13 13:15:36 -0700
commit69562c5d20b740a8d4197af2d27f50593b0dc432 (patch)
tree325ff4ed72765633b2cf9845fe7e2c9aba603294 /test/sanity
parent4452429b45f997935d52a86665a2808cc2313e3a (diff)
downloadansible-69562c5d20b740a8d4197af2d27f50593b0dc432.tar.gz
Fix module validator blacklist handling.
Process the blacklist before creating a validator instance. (cherry picked from commit 442768c45eea239cd90552b710c8a2eef4e3531a)
Diffstat (limited to 'test/sanity')
-rwxr-xr-xtest/sanity/validate-modules/validate-modules32
1 files changed, 21 insertions, 11 deletions
diff --git a/test/sanity/validate-modules/validate-modules b/test/sanity/validate-modules/validate-modules
index bd2561aae1..d03bff1bd9 100755
--- a/test/sanity/validate-modules/validate-modules
+++ b/test/sanity/validate-modules/validate-modules
@@ -834,19 +834,25 @@ class ModuleValidator(Validator):
(option, should_be, version_added))
))
- def validate(self):
- super(ModuleValidator, self).validate()
+ @staticmethod
+ def is_blacklisted(path):
+ base_name = os.path.basename(path)
+ file_name, _ = os.path.splitext(base_name)
- if self.object_name.startswith('_') and os.path.islink(self.object_path):
- return
+ if file_name.startswith('_') and os.path.islink(path):
+ return True
- # Blacklists -- these files are not checked
- if not frozenset((self.basename,
- self.name)).isdisjoint(self.BLACKLIST):
- return
- for pat in self.BLACKLIST_PATTERNS:
- if fnmatch(self.basename, pat):
- return
+ if not frozenset((base_name, file_name)).isdisjoint(ModuleValidator.BLACKLIST):
+ return True
+
+ for pat in ModuleValidator.BLACKLIST_PATTERNS:
+ if fnmatch(base_name, pat):
+ return True
+
+ return False
+
+ def validate(self):
+ super(ModuleValidator, self).validate()
# if self._powershell_module():
# self.warnings.append('Cannot check powershell modules at this '
@@ -974,6 +980,8 @@ def main():
path = module
if args.exclude and args.exclude.search(path):
sys.exit(0)
+ if ModuleValidator.is_blacklisted(path):
+ sys.exit(0)
with ModuleValidator(path, analyze_arg_spec=args.arg_spec,
base_branch=args.base_branch, git_cache=git_cache) as mv:
mv.validate()
@@ -997,6 +1005,8 @@ def main():
path = os.path.join(root, filename)
if args.exclude and args.exclude.search(path):
continue
+ if ModuleValidator.is_blacklisted(path):
+ continue
with ModuleValidator(path, analyze_arg_spec=args.arg_spec,
base_branch=args.base_branch, git_cache=git_cache) as mv:
mv.validate()