From bcdfdc0cc33155598edfd4752db85c6358b17864 Mon Sep 17 00:00:00 2001
From: Brian Coca <brian.coca+git@gmail.com>
Date: Thu, 19 Jan 2017 19:01:58 -0500
Subject: [PATCH] minor cleanups

removed redundant print/exits
removed unused import and var
---
 hacking/module_formatter.py | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/hacking/module_formatter.py b/hacking/module_formatter.py
index 1ae4d2a2fb5..33204ff1b7f 100755
--- a/hacking/module_formatter.py
+++ b/hacking/module_formatter.py
@@ -38,7 +38,6 @@ from six import iteritems
 from ansible.errors import AnsibleError
 from ansible.module_utils._text import to_bytes
 from ansible.utils import module_docs
-from ansible.utils.vars import merge_hash
 
 #####################################################################################
 # constants and paths
@@ -254,16 +253,13 @@ def process_module(module, options, env, template, outputname, module_map, alias
 
     # crash if module is missing documentation and not explicitly hidden from docs index
     if doc is None:
-        sys.stderr.write("*** ERROR: MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module))
-        sys.exit(1)
+        sys.exit("*** ERROR: MODULE MISSING DOCUMENTATION: %s, %s ***\n" % (fname, module))
 
     if metadata is None:
-        sys.stderr.write("*** ERROR: MODULE MISSING METADATA: %s, %s ***\n" % (fname, module))
-        sys.exit(1)
+        sys.exit("*** ERROR: MODULE MISSING METADATA: %s, %s ***\n" % (fname, module))
 
     if deprecated and 'deprecated' not in doc:
-        sys.stderr.write("*** ERROR: DEPRECATED MODULE MISSING 'deprecated' DOCUMENTATION: %s, %s ***\n" % (fname, module))
-        sys.exit(1)
+        sys.exit("*** ERROR: DEPRECATED MODULE MISSING 'deprecated' DOCUMENTATION: %s, %s ***\n" % (fname, module))
 
     if module in aliases:
         doc['aliases'] = aliases[module]
@@ -271,8 +267,7 @@ def process_module(module, options, env, template, outputname, module_map, alias
     all_keys = []
 
     if not 'version_added' in doc:
-        sys.stderr.write("*** ERROR: missing version_added in: %s ***\n" % module)
-        sys.exit(1)
+        sys.exit("*** ERROR: missing version_added in: %s ***\n" % module)
 
     added = 0
     if doc['version_added'] == 'historical':
@@ -429,14 +424,11 @@ def validate_options(options):
     ''' validate option parser options '''
 
     if not options.module_dir:
-        print("--module-dir is required", file=sys.stderr)
-        sys.exit(1)
+        sys.exit("--module-dir is required", file=sys.stderr)
     if not os.path.exists(options.module_dir):
-        print("--module-dir does not exist: %s" % options.module_dir, file=sys.stderr)
-        sys.exit(1)
+        sys.exit("--module-dir does not exist: %s" % options.module_dir, file=sys.stderr)
     if not options.template_dir:
-        print("--template-dir must be specified")
-        sys.exit(1)
+        sys.exit("--template-dir must be specified")
 
 #####################################################################################
 
@@ -471,7 +463,6 @@ def main():
     # Import all the docs into memory
     #
     module_map = mod_info.copy()
-    skipped_modules = set()
 
     for modname in module_map:
         result = process_module(modname, options, env, template, outputname, module_map, aliases)