Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cinek810/a81f09a369d4a3b7486f7a1716a03473 to your computer and use it in GitHub Desktop.
Save cinek810/a81f09a369d4a3b7486f7a1716a03473 to your computer and use it in GitHub Desktop.
ansible-review standard checking if task name doesn't contain spaces (funinit.wordpress.com)
def check_task_name(candidate,setting):
result = Result(candidate.path)
with open(candidate.path, 'r') as f:
for (lineno, line) in enumerate(f):
inArray=line.split(" ")
try:
if inArray[1]=="name:" and len(inArray) > 3:
result.errors.append(Error(lineno+1,line))
except IndexError:
pass
return result
task_name_should_not_have_spaces = Standard(dict(
name = "Task name should not containt spaces",
check = check_task_name,
types = [ 'task' ],
version = "0.1"
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment