开发者

how can i retrieve column offsets for pylint messages?

i want to format the output of pylint myself, so i'm calling pylint.lint.Run 开发者_运维问答directly, and receiving callbacks to my add_message method. pretty smooth process, but i need the column offset for the messages to build my output (i'm highlighting sections of the offending lines).

pylint reports the line number of each message, where appropriate. however, it seems that pylint does not report any offset information - so it isn't reporting where in the line the problem was detected. under the hood pylint uses another library from logilab, called astng, which is an update to python's _ast. _ast parse nodes include offset information, but this doesn't seem to be replicated in astng.


turns out that astng is built on ast, and the guys at logilab gave me instructions on how to patch both astng and pylint to get the offsets. links to the tickets with patches attached: astng: http://www.logilab.org/ticket/69217?vid=primary&_cwmsgid=091770639ada4996a455c48aa1eb70b3 pylint: http://www.logilab.org/ticket/69220?vid=primary&_cwmsgid=0660d106aa764a4189b1f4f1faa8aa82

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜