As GSOC was a great experience last year, I decided to apply for GSOC-2012. I got the confirmation two days ago, so I’ll work on Pylint this year. It’s a great chance to make improvements on a well-used python tool.
What is planned?
Three main tasks are planned:
Python-3000 compatibility
Pylint should be compatible with Python-3000 (http://wiki.python.org/moin/PyLint-3k and http://www.logilab.org/ticket/19645) but currently Pylint is not installable with Python-3. It’s likely to be just an installation problem, but it need to be solved. I’ll then check that all tests pass and correct the eventual bugs.
JSON Output
Currently pylint support only 5 output formats:
- text, the default, works well for human
- parseable, the format for machine parsing
- colorized, same as text format, but with some colors
- html
- msvs
What we can see is that pylint doesn’t support for a well-used output format which can ease machine parsing. The only format which can answer this need is the “parseable” format:
dir/pylint/lint.py:64: [I] Unable to consider inline option "(.*)')"
dir/pylint/lint.py:417: [I] Locally disabling E1102
dir/pylint/lint.py:419: [I] Locally disabling E1101
dir/pylint/lint.py:212: [C] Line too long (86/80)
dir/pylint/lint.py:221: [C] Line too long (81/80)
dir/pylint/lint.py:301: [C] Line too long (83/80)
dir/pylint/lint.py:349: [W] Bad indentation. Found 7 spaces, expected 8
dir/pylint/lint.py:350: [W] Bad indentation. Found 7 spaces, expected 8
dir/pylint/lint.py:351: [W] Bad indentation. Found 11 spaces, expected 12
dir/pylint/lint.py:352: [W] Bad indentation. Found 15 spaces, expected 16
dir/pylint/lint.py:426: [C] Line too long (87/80)
dir/pylint/lint.py:821: [C] Line too long (82/80)
dir/pylint/lint.py:879: [C] Line too long (91/80)
dir/pylint/lint.py:539: [W] XXX hack, to be correct we need to keep module_msgs_state
It will be better if Pylint can support JSON support and even if the JSON output can group messages by lines and by files, giving the “status” of each line or file. Good news, it’s already on work. An example of current JSON output is:
{
"contents": [
{
"stop-date": 1335259863.060986,
"status": "Refactor",
"filepath": "pylint/dir/pylint/test/input/indirect1.py",
"start-date": 1335259863.023868,
"type": "context.file",
"id": "pylint/dir/pylint/test/input/indirect1.py",
"contents": [
{
"stop-date": 1335259863.059295,
"status": "Refactor",
"start-date": 1335259863.058008,
"line": 1,
"type": "context.line",
"id": 1,
"contents": [
{
"date": 1335259863.058394,
"message": "Convention: [c0]: Missing docstring",
"type": "log.message",
"severity": "INFO"
},
{
"date": 1335259863.058649,
"message": "Convention: TotoInterface[c0]: Missing docstring",
"type": "log.message",
"severity": "INFO"
},
{
"date": 1335259863.058947,
"message": "Refactor: TotoInterface[c0]: Abstract class not referenced",
"type": "log.message",
"severity": "INFO"
}
]
},
{
"stop-date": 1335259863.060527,
"status": "Convention",
"start-date": 1335259863.059687,
"line": 2,
"type": "context.line",
"id": 2,
"contents": [
{
"date": 1335259863.060092,
"message": "Convention: TotoInterface.machin[c4]: Missing docstring",
"type": "log.message",
"severity": "INFO"
}
]
}
]
}
]
}
What we can see with this example is that messages are grouped by line and each line contains a status field, which is the most serious. This output is generated using Goatlog, an advanced logging manager. It makes possible to manage logs contexts (a file is a context and a line is a context too). For more information about Goatlog, check it’s doc at http://goatlog.readthedocs.org/en/latest/index.html.
The good thing using Goatlog is that it provides a colorized output too. You can view it if you run pylint without the option “–files-output”. Here, you have an example of this output:
Outputs must be enhanced, but it currently works quite well.
Tickets closing
Pylint has a lot of ticket open on bug tracker (http://www.logilab.org/857?rql=Any%20X%20WHERE%20X%20eid%20857&fname=view&vid=projecttickets_tab). Most tickets are just optimization or correction about specific messages. I’ll try to close the maximum of them.
If you have some specifics tickets you want me to work on, leave a comment.
Conclusion
Pylint is a great project, it’s widely used and I hope my work will help a lot of people. Stay tuned for progress of work.