diff options
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 55 |
1 files changed, 36 insertions, 19 deletions
@@ -99,7 +99,7 @@ class Message(_MsgBase): self.abspath, self.path, self.module, - self.obj, + self.obj, self.line, self.column) return (self.msg_id, self.symbol, location, self.msg, self.confidence) @@ -413,12 +413,15 @@ class MessagesHandlerMixIn(object): def print_full_documentation(self): """output a full documentation in ReST format""" + print("Pylint global options and switches") + print("----------------------------------") + print("") + print("Pylint provides global options and switches.") + print("") + by_checker = {} for checker in self.get_checkers(): if checker.name == 'master': - prefix = 'Main ' - print("Options") - print('-------\n') if checker.options: for section, options in checker.options_by_section(): if section is None: @@ -428,7 +431,7 @@ class MessagesHandlerMixIn(object): print(title) print('~' * len(title)) rest_format_section(sys.stdout, None, options) - print() + print("") else: try: by_checker[checker.name][0] += checker.options_and_values() @@ -438,35 +441,49 @@ class MessagesHandlerMixIn(object): by_checker[checker.name] = [list(checker.options_and_values()), dict(checker.msgs), list(checker.reports)] + + print("Pylint checkers' options and switches") + print("-------------------------------------") + print("") + print("Pylint checkers can provide three set of features:") + print("") + print("* options that control their execution,") + print("* messages that they can raise,") + print("* reports that they can generate.") + print("") + print("Below is a list of all checkers and their features.") + print("") + for checker, (options, msgs, reports) in six.iteritems(by_checker): - prefix = '' - title = '%s checker' % checker + title = '%s checker' % (checker.replace("_", " ").title()) print(title) - print('-' * len(title)) - print() + print('~' * len(title)) + print("") + print("Verbatim name of the checker is ``%s``." % checker) + print("") if options: title = 'Options' print(title) - print('~' * len(title)) + print('^' * len(title)) rest_format_section(sys.stdout, None, options) - print() + print("") if msgs: - title = ('%smessages' % prefix).capitalize() + title = 'Messages' print(title) print('~' * len(title)) for msgid, msg in sorted(six.iteritems(msgs), key=lambda kv: (_MSG_ORDER.index(kv[0][0]), kv[1])): msg = build_message_def(checker, msgid, msg) print(msg.format_help(checkerref=False)) - print() + print("") if reports: - title = ('%sreports' % prefix).capitalize() + title = 'Reports' print(title) print('~' * len(title)) for report in reports: print(':%s: %s' % report[:2]) - print() - print() + print("") + print("") class FileState(object): @@ -664,10 +681,10 @@ class MessagesStore(object): for msgid in msgids: try: print(self.check_message_id(msgid).format_help(checkerref=True)) - print() + print("") except UnknownMessage as ex: print(ex) - print() + print("") continue def list_messages(self): @@ -677,7 +694,7 @@ class MessagesStore(object): if not msg.may_be_emitted(): continue print(msg.format_help(checkerref=False)) - print() + print("") class ReportsHandlerMixIn(object): |