Skip to content

Commit 94d93dc

Browse files
authored
{CI} Fix Incorrect Detection of Code Changes as New Commands (#499)
1 parent bacb725 commit 94d93dc

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎HISTORY.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
33
Release History
44
===============
5+
0.1.90
6+
++++++
7+
* `azdev cmdcov`: Fix incorrect detection of code changes as new commands
8+
59
0.1.89
610
++++++
711
* `azdev scan/mask`: Add `--continue-on-failure` support

‎azdev/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# license information.
55
# -----------------------------------------------------------------------------
66

7-
__VERSION__ = '0.1.89'
7+
__VERSION__ = '0.1.90'

‎azdev/operations/linter/rules/command_coverage_rules.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ..linter import RuleError, LinterSeverity
99

1010

11-
@CommandCoverageRule(LinterSeverity.HIGH)
11+
@CommandCoverageRule(LinterSeverity.MEDIUM)
1212
def missing_command_test_coverage(linter):
1313
exec_state, violations = linter.get_command_test_coverage()
1414
if not exec_state:

‎azdev/operations/regex.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def search_argument(line):
144144
def search_command_group(row_num, lines, command):
145145
cmd = ''
146146
while row_num > 0:
147+
row_num = len(lines) - 1 if row_num >= len(lines) else row_num
147148
row_num -= 1
148149
# Match `with self.command_group('local-context',` and `with self.command_group('xxx')`
149150
sub_pattern = r'with self.command_group\(\'(.*?)\',?'
@@ -166,8 +167,8 @@ def search_command(line):
166167

167168
def search_deleted_command(line):
168169
command = ''
169-
# Match `- g.*command(xxx)`
170-
pattern = r'\-\s+g.(?:\w+)?command\((.*)\)'
170+
# Match `[-!] g.*command(xxx)`
171+
pattern = r'[-!]\s+g.(?:\w+)?command\((.*)\)'
171172
ref = re.findall(pattern, line)
172173
if ref:
173174
command = ref[0].split(',')[0].strip("'")

0 commit comments

Comments
 (0)