Skip to content

Commit

Permalink
Address sonarcube bug and code smells
Browse files Browse the repository at this point in the history
Signed-off-by: javrin <jawabiscuit@users.noreply.github.com>
  • Loading branch information
Jawabiscuit committed Sep 15, 2023
1 parent 544272a commit 3da8f11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/rez/rex.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def _fn(str_):
# in a request string which python on windows will expand
# regardless if the user exists or not
matches = re.findall(r"[\\/]?", str_)
matches = list(set(matches)).remove("")
matches = list(set(matches))
matches.remove("")
if matches:
return os.path.expanduser(str_)
else:
Expand Down
18 changes: 7 additions & 11 deletions src/rez/shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,27 +139,28 @@ def get_syspaths(cls):
def __init__(self):
self._lines = []
self.settings = config.plugins.shell[self.name()]
self.env_sep_map = self._get_env_sep_map()
self.validate_env_sep_map()
self.env_sep_map = self._shell_env_seps()

def _global_env_seps(self):
setting = self.env_sep_map_setting
value = config.get(setting, {})
return value

def _shell_env_seps(self):
self.validate_env_sep_map()
shell = self.name()
setting = self.shell_env_sep_map_setting
values = config.get(setting, {})
value = values.get(shell, {})
return value

def _get_env_sep_map(self):
def validate_env_sep_map(self):
"""
Get a dict of environment variable names to path separators.
Validate environment path separator settings.
"""
if getattr(self, "env_sep_map", None):
return self.env_sep_map
# Return early if validation is disabled.
if not config.warn("shell_startup"):
return

global_env_seps = self._global_env_seps()
shell_env_seps = self._shell_env_seps()
Expand All @@ -180,11 +181,6 @@ def _get_env_sep_map(self):
pathsep,
)

return shell_env_seps

def validate_env_sep_map(self):
pass

def _addline(self, line):
self._lines.append(line)

Expand Down

0 comments on commit 3da8f11

Please sign in to comment.