Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.1.34
++++++
* `azdev linter`: support to detect commmand groups which are missing in command_group_table.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR number should be added to release note.


0.1.33
++++++
* Bump `pylint` to 2.8.2 and move `--ignore` to `pylintrc` file (#301)
Expand Down
2 changes: 1 addition & 1 deletion azdev/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# license information.
# -----------------------------------------------------------------------------

__VERSION__ = '0.1.33'
__VERSION__ = '0.1.34'
2 changes: 1 addition & 1 deletion azdev/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class AzDevCli(CLI):

def get_cli_version(self):
from . import __VERSION__
from azdev import __VERSION__
return __VERSION__


Expand Down
18 changes: 16 additions & 2 deletions azdev/operations/linter/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, command_loader=None, help_file_entries=None, loaded_help=None
self._parameters = {}
self._help_file_entries = set(help_file_entries.keys())
self._command_parser = command_loader.cli_ctx.invocation.parser

self._command_groups = []
for command_name, command in self._command_loader.command_table.items():
self._parameters[command_name] = set()
for name in command.arguments:
Expand All @@ -58,7 +58,18 @@ def commands(self):

@property
def command_groups(self):
return self._command_loader.command_group_table.keys()
if not self._command_groups:
added_command_groups = set()
for command_group in self._command_loader.command_group_table.keys():
prefix_name = ""
for word in command_group.split():
prefix_name = "{} {}".format(prefix_name, word).strip()
if prefix_name in added_command_groups:
# if the parent command group is added continue
continue
added_command_groups.add(prefix_name)
self._command_groups.append(prefix_name)
return self._command_groups

@property
def help_file_entries(self):
Expand Down Expand Up @@ -139,6 +150,9 @@ def command_group_expired(self, command_group_name):
deprecate_info = group_kwargs.get('deprecate_info', None)
if deprecate_info:
return deprecate_info.expired()
except KeyError:
# ignore command_group_name which is not in command_group_table.
pass
except AttributeError:
# Items with only token presence in the command table will not have any data. They can't be expired.
pass
Expand Down