def check_command(commandline):
 arguments = {'chown': 'owner', 'chmod': 'mode', 'chgrp': 'group', 'ln': 'state=link', 'mkdir': 'state=directory', 'rmdir': 'state=absent', 'rm': 'state=absent', 'touch': 'state=touch'}
 commands = {'git': 'git', 'hg': 'hg', 'curl': 'get_url or uri', 'wget': 'get_url or uri', 'svn': 'subversion', 'service': 'service', 'mount': 'mount', 'rpm': 'yum, dnf or zypper', 'yum': 'yum', 'apt-get': 'apt', 'tar': 'unarchive', 'unzip': 'unarchive', 'sed': 'template or lineinfile', 'rsync': 'synchronize', 'dnf': 'dnf', 'zypper': 'zypper'}
 become = ['sudo', 'su', 'pbrun', 'pfexec', 'runas']
 warnings = list()
 command = os.path.basename(commandline.split()[0])
 if (command in arguments):
  warnings.append('Consider using file module with {0} rather than running {1}'.format(arguments[command], command))
 if (command in commands):
  warnings.append('Consider using {0} module rather than running {1}'.format(commands[command], command))
 if (command in become):
  warnings.append("Consider using 'become', 'become_method', and 'become_user' rather than running {0}".format(command))
 return warnings

def check_command ( commandline ) : arguments = { 'chown' : 'owner' , 'chmod' : 'mode' , 'chgrp' : 'group' , 'ln' : 'state=link' , 'mkdir' : 'state=directory' , 'rmdir' : 'state=absent' , 'rm' : 'state=absent' , 'touch' : 'state=touch' } commands = { 'git' : 'git' , 'hg' : 'hg' , 'curl' : 'get_url or uri' , 'wget' : 'get_url or uri' , 'svn' : 'subversion' , 'service' : 'service' , 'mount' : 'mount' , 'rpm' : 'yum, dnf or zypper' , 'yum' : 'yum' , 'apt-get' : 'apt' , 'tar' : 'unarchive' , 'unzip' : 'unarchive' , 'sed' : 'template or lineinfile' , 'rsync' : 'synchronize' , 'dnf' : 'dnf' , 'zypper' : 'zypper' } become = [ 'sudo' , 'su' , 'pbrun' , 'pfexec' , 'runas' ] warnings = list ( ) command = os . path . basename ( commandline . split ( ) [ 0 ] ) if ( command in arguments ) : warnings . append ( 'Consider using file module with {0} rather than running {1}' . format ( arguments [ command ] , command ) ) if ( command in commands ) : warnings . append ( 'Consider using {0} module rather than running {1}' . format ( commands [ command ] , command ) ) if ( command in become ) : warnings . append ( "Consider using 'become', 'become_method', and 'become_user' rather than running {0}" . format ( command ) ) return warnings
verify a command runs with an exit code of 0 .