Skip to content
rebeccakay edited this page Oct 26, 2016 · 35 revisions

Purpose of Reporters in Pylint.

Reporters display messages when they are available. Each of the messages can focus on a particular aspect of the project, such as number of messages by categories. Right after, a global evaluation of the code is evaluated.

Taken from pylint.readthedocs.io

For instance, the metrics report displays summaries gathered from the current run.

  • the number of processed modules
  • for each module, the percentage of errors and warnings
  • the total number of errors and warnings
  • percentage of classes, functions and modules with docstrings, and a comparison from the previous run
  • percentage of classes, functions and modules with correct name (according to the coding standard), and a comparison from the previous run
  • a list of external dependencies found in the code, and where they appear

More information about Pylint and reporters in Pylint:

How are reporters used in PyTA?

When a user calls python_ta.check_all() to check a piece of code, ColorReporter and PlainReporter are also called and they:

More information about python_ta.check_all() and PyTA's custom reporters:

What are the methods that should be implemented for every reporter?

If your reporters are subclasses of BaseReporter, there are two main methods you should consider in addition to the instance method.

  • instance(self) You should initialize an empty list here to store the messages for later use.

  • handle_message(self, msg) This method lets you handle the given msg obg. handle_message should be implemented if msg has many properties and you need some way to sort them.

  • display_messages(self, layout) Essentially, what do you want to do with all the data? This is the most important method in reporters because this is a way for you to report what you have collected from Pylint's checkers. How do you want to display what you have collected?

What are the methods that can be implemented for every reporter?

How is a reporter notified of an error?

As previously mentioned, when a user calls python_ta.check_all() to check a piece of code, ColorReporter and PlainReporter are also called, which means BaseReporter is called eventually.

Clone this wiki locally