Skip to content

Commit

Permalink
refactor print warnings
Browse files Browse the repository at this point in the history
Added as a definiton
  • Loading branch information
ryma2fhir authored Apr 22, 2024
1 parent e0f8d56 commit 325acd7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions QualityControlChecker/QualityControlChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,13 @@ def CheckCapabilityStatementProfiles(error,repoName):
error=True
return error


def printWarnings(warnings, file):
if warnings:
error=True
print("\t",file)
for x in warnings:
print(x)
return error



Expand All @@ -264,12 +270,14 @@ def CheckCapabilityStatementProfiles(error,repoName):
if file.endswith("xml"):
root = openXMLFile(path,file)
if root == None:
printWarnings(warnings, file)
continue
warnings = checkContactDetailsXML(root, path, warnings)
elements,warnings = getXMLCoreElements(path, file, warnings)
elif file.endswith("json"):
jsonFile = openJSONFile(path,file)
if jsonFile == None:
printWarnings(warnings, file)
continue
warnings = checkContactDetailsJSON(jsonFile, warnings)
elements,warnings = getJSONCoreElements(jsonFile, warnings)
Expand All @@ -279,11 +287,7 @@ def CheckCapabilityStatementProfiles(error,repoName):

warnings = checkAssets(file, warnings)
warnings = checkElementNamingConvention(mainVar, elements, warnings, file, path)
if warnings:
error=True
print("\t",file)
for x in warnings:
print(x)
printWarnings(warnings, file)

''' Check Examples. Prints outcome if issues found and sets error to True.'''
try:
Expand All @@ -294,11 +298,7 @@ def CheckCapabilityStatementProfiles(error,repoName):
for example in examplesPath:
exampleWarnings = []
checkExamples(exampleWarnings)
if exampleWarnings:
error=True
print("\t",example)
for x in exampleWarnings:
print(x)
printWarnings(exampleWarnings, examplesPath)

''' Checks Capability for missing profiles for UK Core or NHSE IG only '''
if repoName == 'FHIR-R4-UKCORE-STAGING-MAIN' or repoName == 'NHSEngland-FHIR-ImplementationGuide':
Expand Down

0 comments on commit 325acd7

Please sign in to comment.