From 8c6c2caf615f6f8e2702fc167ccd4573255c54a6 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 24 Nov 2015 10:27:16 -0600 Subject: [PATCH] Still scan modules with no extension assuming they are python. Fixes #8 --- ansible_testing/modules.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index 8bc344c34b3..705fda3ba7c 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -117,6 +117,8 @@ class ModuleValidator(Validator): self.basename = os.path.basename(self.path) self.name, _ = os.path.splitext(self.basename) + self._python_module_override = False + with open(path) as f: self.text = f.read() self.length = len(self.text.splitlines()) @@ -134,7 +136,7 @@ class ModuleValidator(Validator): return self.path def _python_module(self): - if self.path.endswith('.py'): + if self.path.endswith('.py') or self._python_module_override: return True return False @@ -334,7 +336,7 @@ class ModuleValidator(Validator): self.errors.append('Official Ansible modules must have a .py ' 'extension for python modules or a .ps1 ' 'for powershell modules') - return + self._python_module_override = True if self._python_module() and self.ast is None: self.errors.append('Python SyntaxError while parsing module')