Skip to content

[ 2374944 ] Code maintenance (2) #333

@HolQue

Description

@HolQue

What is the current state of the naming convention check for key names?

#206

While searching for answers I found:

def __keyNameValidation(self, sInput):
    """
Validates the key names of a JSON object to ensure they adhere to certain rules and conventions.
...
    """
    if CNameMangling.STRINGCONVERT.value in sInput:
        sInput = sInput.replace(CNameMangling.STRINGCONVERT.value, '')
        errorMsg = f"A substitution in key names is not allowed! Please update the key name {sInput}"
        self.__reset()
        raise Exception(errorMsg)

The interface description tells that this method validates the key name. I assume now that 'sInput' is the key name. If this is true, the parameter should be renamed to 'sKeyName'. This would ease the readability.

'sInput' is checked against one single string only. Is this really the only thing that has to be done to realize a naming convention check? How shall this work?

Under certain circumstances the string 'CNameMangling.STRINGCONVERT.value' is added. Out of the existence of this string, in the code above you conclude, that a substitution in key names is not allowed. In other areas of the JsonPreprocessor code you make it an issue, if the string is not part of any input (the complete opposite). The conclusion in this case is that the expression cannot be evaluated.

These are much different things, but depend on the same indicator string. This is really hard to understand and makes it very difficult, to maintain, modify and extend the code.

Please try to find better solutions to make the code more plausible.

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions