-
Notifications
You must be signed in to change notification settings - Fork 91
WDT-659 cleanup CLAException for compare_model.py #1163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -254,20 +260,11 @@ def main(): | |||
|
|||
for f in [model1, model2]: | |||
if not os.path.exists(f): | |||
raise CLAException("Model %s does not exists" % f) | |||
raise CLAException(2, 'WLSDPLY-85717', [f]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this use ExitCode.ERROR ? (recently merged to main).
3 places in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
or FileUtils.isJsonFile(model1_file) and FileUtils.isJsonFile(model2_file)): | ||
ext = os.path.splitext(model1)[1] | ||
raise CLAException("Model %s is not a %s file " % (model2, ext)) | ||
raise CLAException(2, 'WLSDPLY-85718', [f]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these literal 2's use the static ExitCode.ERROR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know there is such a thing, CLAException constructor hard coded as 2.
@@ -232,6 +232,12 @@ def debug(format_string, *arguments): | |||
else: | |||
_logger.finest(format_string, arguments) | |||
|
|||
def _checkModelExtension(file): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python function names should be Snake case, not camel case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Kudos, SonarCloud Quality Gate passed! |
This PR cleanup CLAExceptions and exit code logic