Created
December 15, 2018 22:05
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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