From 8ff644680d75cbd3ca498404ba2cbb986164c2f5 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 19 May 2015 11:28:32 -0500 Subject: [PATCH] Check for missing GPLv3 license header in module. Fixes #4 --- ansible_testing/modules.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index 2e72d1dbc3b..cfd5a40afb9 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -115,6 +115,11 @@ class ModuleValidator(Validator): if 'sys.exit(' in self.text: self.errors.append('sys.exit() call found') + def _check_for_gpl3_header(self): + if ('GNU General Public License' not in self.text and + 'version 3' not in self.text): + self.errors.append('GPLv3 license header not found') + def _find_json_import(self): for child in self.ast.body: if isinstance(child, ast.Import): @@ -235,6 +240,7 @@ class ModuleValidator(Validator): if not self._just_docs(): self._check_interpreter() self._check_for_sys_exit() + self._check_for_gpl3_header() self._find_json_import() module_utils = self._find_module_utils() main = self._find_main_call()