Skip to content

Commit 69516ac

Browse files
authored
Merge pull request #18 from NHSDigital/fix/capstate
added try except for capability statement
2 parents 359a56a + f10f63f commit 69516ac

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

QualityControlChecker/QualityControlChecker.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,24 @@
167167
print("\t",example,"The 'id' element is incorrect")
168168

169169
'''CapabilityStatement Checker - checks if all Profiles are in the CapabilityStatement'''
170-
tree= ET.parse('./CapabilityStatement/CapabilityStatement-'+mainVar['project']+'.xml')
171-
root = tree.getroot()
170+
try:
171+
tree= ET.parse('./CapabilityStatement/CapabilityStatement-'+mainVar['project']+'.xml')
172+
root = tree.getroot()
173+
except:
174+
root = None
172175

173-
print('CapabilityStatement')
174-
capabilityStatement = []
175-
for tag in root.findall('.//{*}type'):
176-
capabilityStatement.append(tag.attrib["value"])
176+
if root != None:
177+
print('CapabilityStatement')
178+
capabilityStatement = []
179+
for tag in root.findall('.//{*}type'):
180+
capabilityStatement.append(tag.attrib["value"])
177181

178-
for p in currentProfiles:
179-
if p not in capabilityStatement:
180-
error=True
181-
print("\t",p,"is missing from the CapabilityStatement")
182+
for p in currentProfiles:
183+
if p not in capabilityStatement:
184+
error=True
185+
print("\t",p,"is missing from the CapabilityStatement")
182186

187+
''' If any QC issues found within the script, cause the action to fail'''
183188
if error == True:
184189
print("\nPlease fix the errors found above")
185190
sys.exit(2)

0 commit comments

Comments
 (0)