WIP: Expand the developer documentation #27
1 changed files with 13 additions and 1 deletions
|
@ -30,6 +30,7 @@ class Annotator(Walk):
|
||||||
def __init__(self, objectspace, *args) -> None:
|
def __init__(self, objectspace, *args) -> None:
|
||||||
if not objectspace.paths:
|
if not objectspace.paths:
|
||||||
return
|
return
|
||||||
|
self.alternative_names = {}
|
||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
not_for_commandlines = []
|
not_for_commandlines = []
|
||||||
for family in self.get_families():
|
for family in self.get_families():
|
||||||
|
@ -59,6 +60,17 @@ class Annotator(Walk):
|
||||||
return
|
return
|
||||||
alternative_name = variable.alternative_name
|
alternative_name = variable.alternative_name
|
||||||
variable_path = variable.path
|
variable_path = variable.path
|
||||||
|
all_letters = ''
|
||||||
|
for letter in alternative_name:
|
||||||
|
all_letters += letter
|
||||||
|
if all_letters == 'h':
|
||||||
|
msg = _(f'alternative_name "{alternative_name}" conflict with "--help"')
|
||||||
|
raise DictConsistencyError(msg, 202, variable.xmlfiles)
|
||||||
|
if all_letters in self.alternative_names:
|
||||||
|
msg = _(f'conflict alternative_name "{alternative_name}": "{variable_path}" and "{self.alternative_names[all_letters]}"')
|
||||||
|
raise DictConsistencyError(msg, 202, variable.xmlfiles)
|
||||||
|
|
||||||
|
self.alternative_names[alternative_name] = variable_path
|
||||||
if '.' not in variable_path:
|
if '.' not in variable_path:
|
||||||
path = alternative_name
|
path = alternative_name
|
||||||
else:
|
else:
|
||||||
|
@ -71,7 +83,7 @@ class Annotator(Walk):
|
||||||
raise DictConsistencyError(_(f'negative_description is mandatory for boolean variable, but "{variable.path}" hasn\'t'), 200, variable.xmlfiles)
|
raise DictConsistencyError(_(f'negative_description is mandatory for boolean variable, but "{variable.path}" hasn\'t'), 200, variable.xmlfiles)
|
||||||
return
|
return
|
||||||
if variable.type != 'boolean':
|
if variable.type != 'boolean':
|
||||||
raise DictConsistencyError(_(f'negative_description is only available for boolean variable, but "{variable.path}" is "{variable.type}"'), 200, variable.xmlfiles)
|
raise DictConsistencyError(_(f'negative_description is only available for boolean variable, but "{variable.path}" is "{variable.type}"'), 201, variable.xmlfiles)
|
||||||
self.objectspace.informations.add(
|
self.objectspace.informations.add(
|
||||||
variable.path, "negative_description", variable.negative_description
|
variable.path, "negative_description", variable.negative_description
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue