Skip to content

Commit aad94fa

Browse files
committed
csmock --list-tools: print stable plug-ins first
... and shorten pylint's description, which became unnecessarily disturbing in the output. Closes: #40
1 parent cd80276 commit aad94fa

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

py/csmock

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,22 @@ class PluginManager:
576576
max_key_len = max(map(len, self.plug_by_name.keys()))
577577
min_indent_len = 8
578578
description_indent = max_key_len + min_indent_len
579-
for key, plugin in sorted(self.plug_by_name.items()):
580-
props = plugin.get_props()
581-
desc = getattr(props, "description", "")
582-
if not getattr(props, "stable", False):
583-
# highlight the fact that the plug-in is experimental
584-
desc = "[EXPERIMENTAL] " + desc
585-
sys.stdout.write("{}{}{}\n".format(
586-
key, " " * (description_indent - len(key)),
587-
desc.replace('\n', '\n%s' % (" " * description_indent))))
579+
580+
def list_plugins(stable):
581+
for key, plugin in sorted(self.plug_by_name.items()):
582+
props = plugin.get_props()
583+
desc = getattr(props, "description", "")
584+
if stable != getattr(props, "stable", False):
585+
continue
586+
if not stable:
587+
# highlight the fact that the plug-in is experimental
588+
desc = "[EXPERIMENTAL] " + desc
589+
sys.stdout.write("{}{}{}\n".format(
590+
key, " " * (description_indent - len(key)),
591+
desc.replace('\n', '\n%s' % (" " * description_indent))))
592+
593+
list_plugins(stable=True)
594+
list_plugins(stable=False)
588595

589596
def get_name_list(self):
590597
return sorted(self.plug_by_name.keys())

py/plugins/pylint.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929

3030
class PluginProps:
3131
def __init__(self):
32-
self.description = "Python source code analyzer which looks for programming errors.\n" \
33-
"Helps enforcing a coding standard and sniffs for some code smells."
32+
self.description = "Python source code analyzer which looks for programming errors."
3433

3534

3635
class Plugin:

0 commit comments

Comments
 (0)