summaryrefslogtreecommitdiff
path: root/validate.py
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2016-11-07 11:10:06 +0000
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2016-11-07 11:10:06 +0000
commit7ae041cf6a998210ce4773470732410e35c1df8e (patch)
tree6a702749463dcecd32b1fcbeb1f07300c39fe556 /validate.py
parent622880b87dda44b329d2bc413ec9345ecc19fd2b (diff)
downloadtest-definitions-pipe-7ae041cf6a998210ce4773470732410e35c1df8e.tar.gz
validate.py: fix pep8 issues
Change-Id: I8df280349720e93b9d8bdeac90dc2fde20de2a8a Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'validate.py')
-rwxr-xr-xvalidate.py50
1 files changed, 26 insertions, 24 deletions
diff --git a/validate.py b/validate.py
index faae744..94d394e 100755
--- a/validate.py
+++ b/validate.py
@@ -58,12 +58,13 @@ def pep8_check(filepath, ignore_options=None):
print_stderr(message)
return 0
+
def metadata_check(filepath):
if filepath.lower().endswith("yaml"):
with open(filepath, "r") as f:
result_message_list = []
y = yaml.load(f.read())
- if not 'metadata' in y.keys():
+ if 'metadata' not in y.keys():
result_message_list.append("* METADATA [FAILED]: " + filepath)
result_message_list.append("\tmetadata section missing")
publish_result(result_message_list)
@@ -78,10 +79,10 @@ def metadata_check(filepath):
'devices'])
if not mandatory_keys.issubset(set(metadata_dict.keys())):
result_message_list.append("* METADATA [FAILED]: " + filepath)
- result_message_list.append("\tmandatory keys missing: %s" % \
- mandatory_keys.difference(set(metadata_dict.keys())))
- result_message_list.append("\tactual keys present: %s" % \
- metadata_dict.keys())
+ result_message_list.append("\tmandatory keys missing: %s" %
+ mandatory_keys.difference(set(metadata_dict.keys())))
+ result_message_list.append("\tactual keys present: %s" %
+ metadata_dict.keys())
publish_result(result_message_list)
return 1
for key in mandatory_keys:
@@ -94,6 +95,7 @@ def metadata_check(filepath):
publish_result(result_message_list)
return 0
+
def validate_yaml(filename):
with open(filename, "r") as f:
try:
@@ -192,28 +194,28 @@ def main(args):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-p",
- "--pep8-ignore",
- nargs="*",
- default="E501",
- help="Space separated list of pep8 exclusions",
- dest="pep8_ignore")
+ "--pep8-ignore",
+ nargs="*",
+ default="E501",
+ help="Space separated list of pep8 exclusions",
+ dest="pep8_ignore")
parser.add_argument("-s",
- "--shellcheck-ignore",
- nargs="*",
- help="Space separated list of shellcheck exclusions",
- dest="shellcheck_ignore")
+ "--shellcheck-ignore",
+ nargs="*",
+ help="Space separated list of shellcheck exclusions",
+ dest="shellcheck_ignore")
parser.add_argument("-g",
- "--git-latest",
- action="store_true",
- default=False,
- help="If set, the script will try to evaluate files in last git \
- commit instead of the whole repository",
- dest="git_latest")
+ "--git-latest",
+ action="store_true",
+ default=False,
+ help="If set, the script will try to evaluate files in last git \
+ commit instead of the whole repository",
+ dest="git_latest")
parser.add_argument("-f",
- "--file-path",
- default="",
- help="Path to the file that should be checked",
- dest="file_path")
+ "--file-path",
+ default="",
+ help="Path to the file that should be checked",
+ dest="file_path")
args = parser.parse_args()
main(args)