Skip to content

Commit

Permalink
fix bug in _detect_new_command (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
kairu-ms authored Dec 10, 2024
1 parent 0f94649 commit 4264b41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions azdev/operations/linter/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def _detect_new_command(self, diff_index):
if idx:
idx = int(idx[0]) + offset
break
with open(os.path.join(get_cli_repo_path(), diff.a_path), encoding='utf-8') as f:
with open(os.path.join(self.git_repo, diff.a_path), encoding='utf-8') as f:
param_lines = f.readlines()
cmds = search_argument_context(idx, param_lines)
for cmd in cmds:
Expand All @@ -292,7 +292,7 @@ def _detect_new_command(self, diff_index):
if idx:
idx = int(idx[0]) + offset
break
with open(os.path.join(get_cli_repo_path(), diff.a_path), encoding='utf-8') as f:
with open(os.path.join(self.git_repo, diff.a_path), encoding='utf-8') as f:
cmd_lines = f.readlines()
cmd = search_command_group(idx, cmd_lines, command)
if cmd:
Expand All @@ -310,14 +310,14 @@ def _detect_tested_command(self, diff_index):
for diff in diff_index:
filename = diff.a_path.split('/')[-1]
if re.findall(r'^test_.*\.py$', filename) and \
os.path.exists(os.path.join(get_cli_repo_path(), diff.a_path)):
os.path.exists(os.path.join(self.git_repo, diff.a_path)):
with open(os.path.join(self.git_repo, diff.a_path), encoding='utf-8') as f:
lines = f.readlines()
ref = get_all_tested_commands_from_regex(lines)
all_tested_command += ref
# get tested command by recording file
if re.findall(r'^test_.*\.yaml$', filename) and \
os.path.exists(os.path.join(get_cli_repo_path(), diff.a_path)):
os.path.exists(os.path.join(self.git_repo, diff.a_path)):
with open(os.path.join(self.git_repo, diff.a_path)) as f:
records = yaml.load(f, Loader=yaml.Loader) or {}
for record in records['interactions']:
Expand Down

0 comments on commit 4264b41

Please sign in to comment.