mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 23:31:25 -07:00
Still scan modules with no extension assuming they are python. Fixes #8
This commit is contained in:
parent
e9de4d136f
commit
8c6c2caf61
1 changed files with 4 additions and 2 deletions
|
@ -117,6 +117,8 @@ class ModuleValidator(Validator):
|
||||||
self.basename = os.path.basename(self.path)
|
self.basename = os.path.basename(self.path)
|
||||||
self.name, _ = os.path.splitext(self.basename)
|
self.name, _ = os.path.splitext(self.basename)
|
||||||
|
|
||||||
|
self._python_module_override = False
|
||||||
|
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
self.text = f.read()
|
self.text = f.read()
|
||||||
self.length = len(self.text.splitlines())
|
self.length = len(self.text.splitlines())
|
||||||
|
@ -134,7 +136,7 @@ class ModuleValidator(Validator):
|
||||||
return self.path
|
return self.path
|
||||||
|
|
||||||
def _python_module(self):
|
def _python_module(self):
|
||||||
if self.path.endswith('.py'):
|
if self.path.endswith('.py') or self._python_module_override:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -334,7 +336,7 @@ class ModuleValidator(Validator):
|
||||||
self.errors.append('Official Ansible modules must have a .py '
|
self.errors.append('Official Ansible modules must have a .py '
|
||||||
'extension for python modules or a .ps1 '
|
'extension for python modules or a .ps1 '
|
||||||
'for powershell modules')
|
'for powershell modules')
|
||||||
return
|
self._python_module_override = True
|
||||||
|
|
||||||
if self._python_module() and self.ast is None:
|
if self._python_module() and self.ast is None:
|
||||||
self.errors.append('Python SyntaxError while parsing module')
|
self.errors.append('Python SyntaxError while parsing module')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue