diff options
author | Vincent <> | 2009-11-25 16:08:37 +0100 |
---|---|---|
committer | Vincent <> | 2009-11-25 16:08:37 +0100 |
commit | 372671c91522060fe98c5be1a9c4832328a3189b (patch) | |
tree | b1463a735ec28cce5d6180707535573daaf92d60 | |
parent | a125f80faedfb8860362221650035435cc3c459f (diff) | |
download | pylint-372671c91522060fe98c5be1a9c4832328a3189b.tar.gz |
fix #9791
https://www.logilab.net/elo/ticket/9791
In lint.py:
* rename "--list-msgs" option into "--full-documentation",
* add a specific "--list-msgs" option ant its callback,
and in MessagesHandlerMixIn in utils.py:
* rename list_messages() method into print_full_documentation(),
* add list_checkers_messages() method,
* add list_messages() method,
*add list_sorted_messages().
-rw-r--r-- | lint.py | 15 | ||||
-rw-r--r-- | utils.py | 28 |
2 files changed, 38 insertions, 5 deletions
@@ -787,6 +787,12 @@ exit. The value may be a comma separated list of message ids.'''}), {'action' : 'callback', 'metavar': '<msg-id>', 'callback' : self.cb_list_messages, 'group': 'Commands', + 'help' : "Generate pylint's messages."}), + + ('full-documentation', + {'action' : 'callback', 'metavar': '<msg-id>', + 'callback' : self.cb_full_documentation, + 'group': 'Commands', 'help' : "Generate pylint's full documentation."}), ('generate-rcfile', @@ -922,9 +928,14 @@ been issued by analysing pylint output status code self.linter.help_message(splitstrip(value)) sys.exit(0) - def cb_list_messages(self, option, opt_name, value, parser): + def cb_full_documentation(self, option, opt_name, value, parser): + """optik callback for printing full documentation""" + self.linter.print_full_documentation() + sys.exit(0) + + def cb_list_messages(self, option, opt_name, value, parser): # FIXME """optik callback for printing available messages""" - self.linter.list_messages() + self.linter.list_sorted_messages() sys.exit(0) def cb_init_hook(option, opt_name, value, parser): @@ -279,7 +279,12 @@ class MessagesHandlerMixIn: print continue - def list_messages(self): + def list_checkers_messages(self, checker): + """print checker's messages in reST format""" + for msg_id in sort_msgs(checker.msgs.keys()): + print self.get_message_help(msg_id, False) + + def print_full_documentation(self): """output a full documentation in ReST format""" for checker in sort_checkers(self._checkers.values()): if checker.name == 'master': @@ -313,8 +318,7 @@ class MessagesHandlerMixIn: title = ('%smessages' % prefix).capitalize() print title print '~' * len(title) - for msg_id in sort_msgs(checker.msgs.keys()): - print self.get_message_help(msg_id, False) + self.list_checkers_messages( checker) print if getattr(checker, 'reports', None): title = ('%sreports' % prefix).capitalize() @@ -325,6 +329,24 @@ class MessagesHandlerMixIn: print print + def list_messages(self): + """output full messages list documentation in ReST format""" + for checker in sort_checkers(self._checkers.values()): + if checker.msgs: + self.list_checkers_messages( checker) + print + + def list_sorted_messages(self): + """output full sorted messages list in ReST format""" + msg_ids = [] + for checker in self._checkers.values(): + for msg_id in checker.msgs.keys(): + msg_ids.append(msg_id) + msg_ids.sort() + for msg_id in msg_ids: + print self.get_message_help(msg_id, False) + print + class ReportsHandlerMixIn: """a mix-in class containing all the reports and stats manipulation |