From 64f4b0f7564260b2e480cf522a3e4fbd34fbc382 Mon Sep 17 00:00:00 2001 From: ZelinWang Date: Wed, 9 Aug 2023 11:40:12 +0800 Subject: [PATCH] {CI} Fix cmdcov issue: Any name of a parameter has been tested, the parameter should be considered as passing the parameter test coverage. (#417) * Update linter.py * update * Update HISTORY.rst --- HISTORY.rst | 4 ++++ azdev/__init__.py | 2 +- azdev/operations/linter/linter.py | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 177176ca..6cbe1663 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +0.1.58 +++++++ +* Fix cmdcov issue(#417): Any name of a parameter has been tested, the parameter should be considered as passing the parameter test coverage. + 0.1.57 ++++++ * `azdev command-change meta-diff`: Remove duplicated meta-diff code and use azure-cli-diff-tool diff --git a/azdev/__init__.py b/azdev/__init__.py index 5d7476e7..2671cf5b 100644 --- a/azdev/__init__.py +++ b/azdev/__init__.py @@ -4,4 +4,4 @@ # license information. # ----------------------------------------------------------------------------- -__VERSION__ = '0.1.57' +__VERSION__ = '0.1.58' diff --git a/azdev/operations/linter/linter.py b/azdev/operations/linter/linter.py index 8438d924..e12d6a98 100644 --- a/azdev/operations/linter/linter.py +++ b/azdev/operations/linter/linter.py @@ -224,7 +224,7 @@ def _detect_new_command(self, diff_index): for p, r in v['parameters'].items(): if 'missing_parameter_test_coverage' in r['rule_exclusions']: exclude_parameters.append((c, p)) - elif 'rule_exclusions' in v: + if 'rule_exclusions' in v: if 'missing_command_test_coverage' in v['rule_exclusions']: exclude_comands.append(c) _logger.debug('exclude_parameters: %s', exclude_parameters) @@ -340,11 +340,11 @@ def _run_parameter_test_coverage(parameters, all_tested_command): if command in code and opt in code: flag = True break - else: - violations.append(f'Missing parameter test coverage: `{command} {opt}`') - exec_state = False if flag: break + else: + violations.append(f'Missing parameter test coverage: `{command} {opt}`') + exec_state = False if violations: violations.insert(0, 'Failed.') violations.extend([