diff --git a/deviser/code_files/ValidationFiles.py b/deviser/code_files/ValidationFiles.py index dca7b946..11fb66a4 100644 --- a/deviser/code_files/ValidationFiles.py +++ b/deviser/code_files/ValidationFiles.py @@ -110,10 +110,11 @@ def create_rule_structure(self): global_variables.language) rules.determine_rules() self.class_rules += rules.rules - if global_variables.is_package: - number = self.offset + 20200 - else: - number = 20200 + number = self.offset + 20200 if global_variables.is_sbml else 20100 +# if global_variables.is_package: +# number = self.offset + 20200 +# else: +# number = 20200 for i in range(0, len(self.plugins)): rules = ValidationRulesForPlugin.ValidationRulesForPlugin( self.plugins[i], self.fullname, number, @@ -131,6 +132,15 @@ def create_rule_structure(self): self.pkg_ref) rules.determine_rules() self.class_rules += rules.rules + if not global_variables.is_sbml: + for att in self.sbml_classes[i]['attribs']: + if att['type'] == 'lo_element': + rules.rules = [] + number += 100 + rules.number = number + rules.add_lo_rules() + self.class_rules += rules.rules + number += 100 self.populate_error_list() @@ -438,10 +448,12 @@ def is_package(i, text_string, length): is_package = True return [is_package, len_word] - @staticmethod - def replace_name(i, text_string, length): + def replace_name(self, i, text_string, length): in_name = True return_name_rep = '' + # we dont want to lower the s of SBase + # or name if it starts with the prefix for the language + isSBase = False while in_name and i < length: letter = text_string[i] if i != length-1: @@ -449,12 +461,7 @@ def replace_name(i, text_string, length): else: next_letter = ' ' if letter == '\\': - isSBase = False - # we dont want to lower the s of SBase - if next_letter == 'S' or next_letter == 's': - test_str = text_string[i+1:i+7] - if test_str.lower() == 'sbase ': - isSBase = True + isSBase = self.is_sbase(text_string, i, next_letter) if isSBase: return_name_rep += '\'S' else: @@ -472,6 +479,15 @@ def replace_name(i, text_string, length): continue return [i-1, return_name_rep] + def is_sbase(self, text, index, next_letter): + if len(text) < index + 7: + return False + if next_letter == 'S' or next_letter == 's': + test_str = text[index + 1:index + 7] + if test_str.lower() == 'sbase ': + return True + return False + @staticmethod def replace_uri(i, text_string, length): in_uri = True diff --git a/deviser/code_files/templates/Error.h b/deviser/code_files/templates/Error.h index 0acdb23a..24fe012b 100644 --- a/deviser/code_files/templates/Error.h +++ b/deviser/code_files/templates/Error.h @@ -21,17 +21,6 @@ typedef enum , SBMLNotUTF8 = 10001 /*!< File does not use UTF-8 encoding. */ , SBMLUnrecognizedElement = 10002 /*!< Encountered unrecognized element. */ , SBMLNotSchemaConformant = 10003 /*!< Document does not conform to the SBML_Lang XML schema. */ -, SBMLInvalidMathElement = 10201 -, SBMLMissingNamespace = 10401 /*!< Missing declaration of the XML namespace for the annotation. */ -, SBMLDuplicateNamespaces = 10402 /*!< Multiple annotations using the same XML namespace. */ -, SBMLNamespaceIn = 10403 /*!< The SBML_Lang XML namespace cannot be used in an object. */ -, SBMLMultiples = 10404 /*!< Only one object is permitted under a given SBML_Lang object. */ -, SBMLNotElement = 10405 -, SBMLNotesNotInXHTMLNamespace = 10801 /*!< Notes must be placed in the XHTML XML namespace. */ -, SBMLNotesContainsXMLDecl = 10802 /*!< XML declarations are not permitted in Notes objects. */ -, SBMLNotesContainsDOCTYPE = 10803 /*!< XML DOCTYPE elements are not permitted in Notes objects. */ -, SBMLInvalidNotesContent = 10804 /*!< Invalid notes content found. */ -, SBMLOnlyOneNotesElementAllowed = 10805 /*!< Only one Notes subobject is permitted on a given SBML_Lang object. */ , SBMLUnknownCoreAttribute = 99994 /*!< Encountered an unknown attribute in the SBML_Lang Core namespace. */ , SBMLCodesUpperBound = 99999 /*!< Upper boundary of libSBML-specific diagnostic codes. */ diff --git a/deviser/code_files/templates/ErrorTable.h b/deviser/code_files/templates/ErrorTable.h index ea8e1021..8fb21fc1 100644 --- a/deviser/code_files/templates/ErrorTable.h +++ b/deviser/code_files/templates/ErrorTable.h @@ -77,126 +77,6 @@ static const sbmlErrorTableEntry sbmlErrorTable[] = } }, - //10201 - { - SBMLInvalidMathElement, - "Invalid MathML", - LIBSBML_CAT_MATHML_CONSISTENCY, - LIBSBML_SEV_ERROR, - "All MathML content in SBML_Lang must appear within a element, and the " - " element must be either explicitly or implicitly in the XML " - "namespace \"http://www.w3.org/1998/Math/MathML\".", - {"" - } - }, - - //10401 - { - SBMLMissingNamespace, - "Missing declaration of the XML namespace for the annotation", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "Every top-level element within an annotation element must " - "have a namespace declared.", - {"" - } - }, - - //10402 - { - SBMLDuplicateNamespaces, - "Multiple annotations using the same XML namespace", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "There cannot be more than one top-level element using a " - "given namespace inside a given annotation element. ", - {"" - } - }, - - //10403 - { - SBMLNamespaceIn, - "The SBML_Lang XML namespace cannot be used in an object", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "Top-level elements within an annotation element cannot use any SBML_Lang " - "namespace, whether explicitly or implicitly (by failing " - "to declare any namespace).", - {"" - } - }, - - //10404 - { - SBMLMultiples, - "Only one object is permitted under a given SBML_Lang object", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "A given SBML_Lang object may contain at most one element.", - {"" - } - }, - - //10801 - { - SBMLNotesNotInXHTMLNamespace, - "Notes must be placed in the XHTML XML namespace", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "The contents of the element must be explicitly placed in the " - "XHTML XML namespace.", - {"" - } - }, - - //10802 - { - SBMLNotesContainsXMLDecl, - "XML declarations are not permitted in Notes objects", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "The contents of the element must not contain an XML declaration " - "(i.e., a string of the form \"\" " - "or similar).", - {"" - } - }, - - //10803 - { - SBMLNotesContainsDOCTYPE, - "XML DOCTYPE elements are not permitted in Notes objects", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "The contents of the element must not contain an XML DOCTYPE " - "declaration (i.e., a string beginning with the characters \" element. ", - {"" - } - }, - - //10805 - { - SBMLOnlyOneNotesElementAllowed, - "Only one Notes subobject is permitted on a given SBML_Lang object", - LIBSBML_CAT_SBML, - LIBSBML_SEV_ERROR, - "A given SBML_Lang object may contain at most one element. ", - {"" - } - }, - /* -------------------------------------------------------------------------- * Boundary marker. SBML_Lang specific errors. * ----------------------------------------------------------------------- */ diff --git a/deviser/pytest_files/test_other_library/test-code/tsb/TSBError.h b/deviser/pytest_files/test_other_library/test-code/tsb/TSBError.h index ab9e2427..cad7fe16 100644 --- a/deviser/pytest_files/test_other_library/test-code/tsb/TSBError.h +++ b/deviser/pytest_files/test_other_library/test-code/tsb/TSBError.h @@ -57,39 +57,26 @@ typedef enum , TSBNotUTF8 = 10001 /*!< File does not use UTF-8 encoding. */ , TSBUnrecognizedElement = 10002 /*!< Encountered unrecognized element. */ , TSBNotSchemaConformant = 10003 /*!< Document does not conform to the TSB XML schema. */ -, TSBInvalidMathElement = 10201 -, TSBMissingTestAnnotationNamespace = 10401 /*!< Missing declaration of the XML namespace for the annotation. */ -, TSBDuplicateTestAnnotationNamespaces = 10402 /*!< Multiple annotations using the same XML namespace. */ -, TSBNamespaceInTestAnnotation = 10403 /*!< The TSB XML namespace cannot be used in an TestAnnotation object. */ -, TSBMultipleTestAnnotations = 10404 /*!< Only one TestAnnotation object is permitted under a given TSB object. */ -, TSBTestAnnotationNotElement = 10405 -, TSBNotesNotInXHTMLNamespace = 10801 /*!< Notes must be placed in the XHTML XML namespace. */ -, TSBNotesContainsXMLDecl = 10802 /*!< XML declarations are not permitted in Notes objects. */ -, TSBNotesContainsDOCTYPE = 10803 /*!< XML DOCTYPE elements are not permitted in Notes objects. */ -, TSBInvalidNotesContent = 10804 /*!< Invalid notes content found. */ -, TSBOnlyOneNotesElementAllowed = 10805 /*!< Only one Notes subobject is permitted on a given TSB object. */ -, TsbNSUndeclared = 10101 -, TsbElementNotInNs = 10102 -, TsbDuplicateComponentId = 10301 -, TsbIdSyntaxRule = 10302 -, TSBInvalidMetaidSyntax = 10303 -, InvalidNamespaceOnTSB = 20101 -, AllowedAttributes = 20102 -, TSBEmptyListElement = 20103 -, TsbDocumentAllowedCoreAttributes = 20201 -, TsbDocumentAllowedCoreElements = 20202 -, TsbDocumentAllowedAttributes = 20203 -, TsbDocumentAllowedElements = 20204 -, TsbDocumentLevelMustBeNonNegativeInteger = 20205 -, TsbDocumentVersionMustBeNonNegativeInteger = 20206 -, TsbDocumentLOCommentsAllowedCoreElements = 20207 -, TsbDocumentLOCommentsAllowedCoreAttributes = 20208 -, TsbCommentAllowedCoreAttributes = 20301 -, TsbCommentAllowedCoreElements = 20302 -, TsbCommentAllowedAttributes = 20303 -, TsbCommentContributorMustBeString = 20304 -, TsbCommentNumberMustBeDouble = 20305 -, TsbCommentPointMustBeString = 20306 +, TSBNSUndeclared = 10101 +, TSBElementNotInNs = 10102 +, TSBInvalidMetaidSyntax = 10201 +, TSBNoAnnotationNS = 10301 +, TSBRepeatAnnotationNS = 10302 +, TSBOnlyOneAnnotation = 10303 +, NotesInXHTML = 10401 +, XMLDeclNotes = 10402 +, DOCTYPEInNotes = 10403 +, TSBOnlyOneNotes = 10404 +, TSBTSBDocumentAllowedAttributes = 20101 +, TSBTSBDocumentAllowedElements = 20102 +, TSBTSBDocumentLevelMustBeNonNegativeInteger = 20103 +, TSBTSBDocumentVersionMustBeNonNegativeInteger = 20104 +, TSBTSBDocumentLOCommentAllowedCoreElements = 20201 +, TSBTSBDocumentLOCommentsAllowedCoreAttributes = 20202 +, TSBCommentAllowedAttributes = 20301 +, TSBCommentContributorMustBeString = 20302 +, TSBCommentNumberMustBeDouble = 20303 +, TSBCommentPointMustBeString = 20304 , TSBUnknownCoreAttribute = 99994 /*!< Encountered an unknown attribute in the TSB Core namespace. */ , TSBCodesUpperBound = 99999 /*!< Upper boundary of libTSB-specific diagnostic codes. */ } TSBErrorCode_t; diff --git a/deviser/pytest_files/test_other_library/test_utils.py b/deviser/pytest_files/test_other_library/test_utils.py index 09c8be7e..d638b434 100644 --- a/deviser/pytest_files/test_other_library/test_utils.py +++ b/deviser/pytest_files/test_other_library/test_utils.py @@ -245,10 +245,10 @@ def compare_code(class_name, end): return compare_files(correct_file, temp_file) def compare_code_headers(class_name): - return compare_code(class_name, ".h") + return compare_code(class_name, ".h") if not class_name == '' else 0 def compare_code_impl(class_name): - return compare_code(class_name, ".cpp") + return compare_code(class_name, ".cpp") if not class_name == '' else 0 def compare_code_cmake(class_name): return compare_code(class_name, ".cmake") diff --git a/deviser/validation/ValidationRulesForClass.py b/deviser/validation/ValidationRulesForClass.py index 35174b5f..4acb29ed 100644 --- a/deviser/validation/ValidationRulesForClass.py +++ b/deviser/validation/ValidationRulesForClass.py @@ -41,7 +41,7 @@ from ..util import strFunctions, query, global_variables -class ValidationRulesForClass(): +class ValidationRulesForClass: """Class for creating the validation rules for an object""" def __init__(self, object_desc, spec_name, number, package, pkg_ref): @@ -53,7 +53,8 @@ def __init__(self, object_desc, spec_name, number, package, pkg_ref): self.number = number self.package = package.lower() self.pkg_ref = pkg_ref - self.up_package = strFunctions.upper_first(self.package) + self.level = object_desc['root']['base_level'] + self.version = object_desc['root']['base_version'] # useful repeated text strings self.valid = '\\validRule{' @@ -82,6 +83,14 @@ def __init__(self, object_desc, spec_name, number, package, pkg_ref): self.parse_elements(self, object_desc['attribs'], object_desc['root']) self.rules = [] self.tc = 'TBC' + # constants for rules + if global_variables.is_sbml: + self.up_package = strFunctions.upper_first(self.package) + self.lib_ref = 'L3V1 {0} V1 Section 3.1'.format(self.up_package) + else: + self.up_package = self.package.upper() + self.lib_ref = '{0} L{1}V{2} Section '.format(self.up_package, self.level, self.version) + ######################################################################## @@ -185,9 +194,9 @@ def add_lo_rules(self): self.write_lochild_attribute_rule(self.lo_reqd_att[i], lo_info) self.add_rule(rule) if rule and 'attributes' in lo_info[0]: - for i in range(0, len(lo_info[0]['attributes'])): + for j in range(0, len(lo_info[0]['attributes'])): self.number += 1 - rule = self.write_attribute_type_rule(self, lo_info[0]['attributes'][i], lo_info[0]) + rule = self.write_attribute_type_rule(self, lo_info[0]['attributes'][j], lo_info[0]) self.add_rule(rule) lo_info = [] @@ -197,9 +206,9 @@ def add_lo_rules(self): self.write_lochild_attribute_rule(self.lo_opt_att[i], lo_info) self.add_rule(rule) if rule and 'attributes' in lo_info[0]: - for i in range(0, len(lo_info[0]['attributes'])): + for j in range(0, len(lo_info[0]['attributes'])): self.number += 1 - rule = self.write_attribute_type_rule(self, lo_info[0]['attributes'][i], lo_info[0]) + rule = self.write_attribute_type_rule(self, lo_info[0]['attributes'][j], lo_info[0]) self.add_rule(rule) def add_rule(self, rule): @@ -225,7 +234,7 @@ def write_attribute_type_rule(self, attribute, lo=None): refname = self.name abbrev = self.name att_type = attribute['type'] - [att_name_no_hyphen, unused] = strFunctions.remove_hyphens(attribute['name']) + [att_name_no_hyphen, __] = strFunctions.remove_hyphens(attribute['name']) att_name = strFunctions.upper_first(att_name_no_hyphen) name = strFunctions.wrap_token(attribute['texname'], self.package) rule_type = 'String' @@ -345,7 +354,7 @@ def write_attribute_type_rule(self, attribute, lo=None): rule_type) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref, + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref, 'object': refname, 'attrib': att_name, 'attrib_type': att_type}) @@ -426,7 +435,7 @@ def write_core_attribute_rule(self, lo_child=None): lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref, + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref, 'plugin': False, 'object': self.name, 'lo': lo, 'reqd': self.reqd_elem, 'opt': self.opt_elem}) @@ -497,7 +506,7 @@ def write_core_subobject_rule(self, lo_child=None): return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref, + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref, 'plugin': False, 'object': self.name, 'lo': lo, 'reqd': self.reqd_elem, 'opt': self.opt_elem}) @@ -538,7 +547,7 @@ def write_package_attribute_rule(self): tc = '{0}{1}AllowedAttributes'.format(self.up_package, self.name) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref, + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref, 'plugin': False, 'object': self.name, 'lo': False, 'reqd': self.reqd_att, 'opt': self.opt_att}) @@ -594,7 +603,7 @@ def write_package_object_rule(self): tc = '{0}{1}AllowedElements'.format(self.up_package, self.name) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref, + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref, 'plugin': False, 'object': self.name, 'reqd': self.reqd_elem, 'opt': self.opt_elem}) @@ -657,7 +666,7 @@ def write_lochild_attribute_rule(self, child, lo_info): strFunctions.plural(name)) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref, + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref, 'plugin': False, 'object': self.name, 'lo': True, 'reqd': child_reqd, 'opt': child_opt, 'lo_object': lo_info[0]['name']}) @@ -722,7 +731,7 @@ def write_optional_lo_rule(self): tc = '{0}{1}EmptyLOElements'.format(self.up_package, self.name, ) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref, + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref, 'plugin': False, 'object': self.name, 'lo_object': self.opt_child_lo_elem}) @@ -783,7 +792,7 @@ def write_reqd_lo_rule(self): tc = '{0}{1}EmptyReqdLOElements'.format(self.up_package, self.name) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) ######################################################################### diff --git a/deviser/validation/ValidationRulesGeneral.py b/deviser/validation/ValidationRulesGeneral.py index ca56e6a0..51904668 100644 --- a/deviser/validation/ValidationRulesGeneral.py +++ b/deviser/validation/ValidationRulesGeneral.py @@ -69,6 +69,13 @@ def __init__(self, spec_name, number, package, pkg_ref, level, version, self.rules = [] self.tc = 'TBC' + # constants for rules + if global_variables.is_sbml: + self.lib_ref = 'L3V1 {0} V1 Section 3.1'.format(self.up_package) + self.up_package = strFunctions.upper_first(self.package) + else: + self.lib_ref = '{0} L{1}V{2} Section '.format(self.up_package.upper(), self.level, self.version) + self.up_package = self.package.upper() ######################################################################## @@ -184,16 +191,15 @@ def add_rule(self, rule): # write rule about ns @staticmethod def write_unknown_rule(self): - text = 'Unknown error from {0}'.format(self.up_package) + text = 'Unknown error from {0}'.format(self.up_package.upper()) ref = '' sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) - short = 'Unknown error from {0}'.format(self.up_package) - lib_ref = '' + short = 'Unknown error from {0}'.format(self.up_package.upper())*10 tc = global_variables.unknown_error return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) # write rules about ns @staticmethod @@ -223,11 +229,11 @@ def write_ns_rule(self): lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'The {0} namespace is not correctly ' \ 'declared.'.format(self.up_package) - lib_ref = 'L3V1 {0} V1 Section 3.1'.format(self.up_package) + tc = '{0}NSUndeclared'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_element_not_ns_rule(self): @@ -253,11 +259,10 @@ def write_element_not_ns_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'Element not in {0} namespace'.format(self.up_package) - lib_ref = 'L3V1 {0} V1 Section 3.1'.format(self.up_package) tc = '{0}ElementNotInNs'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_id_rule(self): @@ -270,11 +275,10 @@ def write_id_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'Duplicate \'id\' attribute value' - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = '{0}DuplicateComponentId'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_id_syntax_rule(self): @@ -289,11 +293,10 @@ def write_id_syntax_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'Invalid SId syntax'.format(self.up_package) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = '{0}IdSyntaxRule'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_reqd_rule(self): @@ -306,11 +309,10 @@ def write_reqd_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'Required {0}:required attribute on '.format(self.package) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = '{0}AttributeRequiredMissing'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_reqd_bool_rule(self): @@ -323,11 +325,10 @@ def write_reqd_bool_rule(self): lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'The {0}:required attribute must be Boolean' \ ''.format(self.package) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = '{0}AttributeRequiredMustBeBoolean'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_reqd_value_rule(self): @@ -342,11 +343,10 @@ def write_reqd_value_rule(self): lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'The {0}:required attribute must be \'{1}\'' \ ''.format(self.package, self.reqd_status) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = '{0}AttributeRequiredMustHaveValue'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_metaid_syntax_rule(self): @@ -367,11 +367,10 @@ def write_metaid_syntax_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'Invalid SId syntax'.format(self.up_package) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = '{0}InvalidMetaidSyntax'.format(global_variables.prefix) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_valid_ns_rule(self): @@ -382,11 +381,10 @@ def write_valid_ns_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'Invalid namespace'.format(self.up_package) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = 'InvalidNamespaceOn{0}'.format(global_variables.prefix) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_allowed_attributes_rule(self): @@ -397,11 +395,10 @@ def write_allowed_attributes_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'Allowed attributes'.format(self.up_package) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = 'AllowedAttributes'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_empty_list_rule(self): @@ -412,11 +409,10 @@ def write_empty_list_rule(self): sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) short = 'No empty listOf'.format(self.up_package) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) tc = '{0}EmptyListElement'.format(global_variables.prefix) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_annotation_rule(self, num): @@ -441,10 +437,9 @@ def write_annotation_rule(self, num): strFunctions.wrap_section('annotation-use', False)) sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref}) @staticmethod def write_notes_rule(self, num): @@ -469,14 +464,11 @@ def write_notes_rule(self, num): 'subobject.'.format(global_variables.language.upper(), 'Notes') short = 'Only one {0}'.format('Notes') tc = '{0}OnlyOneNotes'.format(global_variables.prefix) - - ref = '{0} {1}.' \ .format(self.pkg_ref, strFunctions.wrap_section('notes', False)) sev = 'ERROR' lib_sev = '{0}_SEV_ERROR'.format(global_variables.up_full_lib) - lib_ref = 'L3V1 {0} V1 Section'.format(self.up_package) return dict({'number': self.number, 'text': text, 'reference': ref, 'severity': sev, 'typecode': tc, - 'lib_sev': lib_sev, 'short': short, 'lib_ref': lib_ref}) + 'lib_sev': lib_sev, 'short': short, 'lib_ref': self.lib_ref})