From b608194e5980efc004bec109d837bc9318fce42a Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 18 May 2015 11:49:02 -0500 Subject: [PATCH] Make call to main() not at bottom an error --- ansible_testing/modules.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index 5451c46c6aa..05527b34554 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -4,7 +4,6 @@ from __future__ import print_function import os import ast -import sys import argparse from ansible.utils.module_docs import get_docstring, BLACKLIST_MODULES @@ -79,8 +78,8 @@ class ModuleValidator(object): if (isinstance(child.value.func, ast.Name) and child.value.func.id == 'main'): lineno = child.lineno - if lineno != self.length: - self.warnings.append('Call to main() not the last ' + if lineno < self.length - 1: + self.errors.append('Call to main() not the last ' 'line') if not lineno: