Skip to content

Commit

Permalink
Fix SonarCloud bug: Remove this "return" statement from this "finally…
Browse files Browse the repository at this point in the history
…" block.
  • Loading branch information
mpenning committed Oct 11, 2023
1 parent 6ac6416 commit 57fb807
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions ciscoconfparse/ciscoconfparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def enforce_valid_types(var, var_types=None, error_str=None):

@logger.catch(reraise=True)
def initialize_globals():
"""Initialize ciscoconfparse global dunder variables and a couple others."""
"""Initialize ciscoconfparse global dunder-variables and a couple others."""
global ALL_VALID_SYNTAX
global ENCODING
global __author_email__
Expand All @@ -200,28 +200,29 @@ def initialize_globals():
"junos",
)

__author_email__ = r"mike /at\ pennington [dot] net"
__author__ = "David Michael Pennington <{__author_email__}>"
__copyright__ = f'2007-{time.strftime("%Y")}, {author}'
__license__ = "GPLv3"
__status__ = "Production"
try:
__author_email__ = r"mike /at\ pennington [dot] net"
__author__ = "David Michael Pennington <{}>".format(__author_email__)
__copyright__ = "2007-{}, {}".format(time.strftime("%Y"), __author__)
__license__ = "GPLv3"
__status__ = "Production"
__version__ = get_version_number()

except BaseException as eee:
raise ValueError(str(eee))

finally:
# These are all the 'dunder variables' required...
globals_dict = {
"__author_email__": __author_email__,
"__author__": __author__,
"__copyright__": __copyright__,
"__license__": __license__,
"__status__": __status__,
"__version__": __version__,
}
return globals_dict
__version__ = "0.0.0"
error = f"{eee}: could not determine the ciscoconfparse version via get_version_number()."
logger.critical(error)
ValueError(error)

# These are all the 'dunder variables' required...
globals_dict = {
"__author_email__": __author_email__,
"__author__": __author__,
"__copyright__": __copyright__,
"__license__": __license__,
"__status__": __status__,
"__version__": __version__,
}
return globals_dict


@logger.catch(reraise=True)
Expand Down

0 comments on commit 57fb807

Please sign in to comment.