Skip to content

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

Merged
merged 3 commits into from
Jul 22, 2022
Merged

WDT-659 cleanup CLAException for compare_model.py #1163

merged 3 commits into from
Jul 22, 2022

Conversation

jshum2479
Copy link
Member

This PR cleanup CLAExceptions and exit code logic

@@ -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])
Copy link
Member

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.

Copy link
Member Author

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])
Copy link
Member

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

Copy link
Member Author

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):
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@ddsharpe ddsharpe merged commit e80b816 into main Jul 22, 2022
@ddsharpe ddsharpe deleted the wdt-659 branch July 22, 2022 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants