[code-quality] Minimal example

mrx patrik.mrx at gmail.com
Thu Aug 18 08:15:33 EDT 2016


Done, thanks again!

Patrik Iselind

On Wed, Aug 17, 2016 at 11:05 PM, Claudiu Popa <pcmanticore at gmail.com>
wrote:

>
>
> On Wed, Aug 17, 2016 at 10:37 PM, Patrik Iselind <patrik.mrx at gmail.com>
> wrote:
>
>> Thanks, i got it to work now.
>>
>> I have some feedback on the page you referred to.
>>
>> I was missing the implements line as well. This was not highlighted at
>> all.
>>
>> Bullet two concerning priority. How checkers are ordered (internally?)
>> doesn't help me to decide if i should set a negative priority close to zero
>> or very far from zero in order for the checker to be first or at least
>> among the first.
>>
>> I interpret this page as a resource you'd give programmers new to pylint
>> checkers to get them started, awesome start! I think it would be really
>> helpful if the page gave a overview of how the AST is buid and how i'm
>> meant to access for example function variables in a function or the
>> identifiers defined in a module. Where can i find a list of all the visit_*
>> methods that i can use? I cannot find any class defining them all, are they
>> dynamically called somehow?
>>
>> In examples directory referred to, looking at custom_raw.py. It
>> implements process_module() instead of visit_*. What is the difference?
>> When should i choose one over the other?
>>
>> Thanks a lot for your assistance in getting my first checker running.
>>
>> // Patrik
>>
>>
> Hi Patrik,
>
> These are all really good questions!
>
> Would you mind adding your feedback over this issue
> (https://github.com/PyCQA/pylint/issues/1071),
> where I am tracking the documentation effort for writing a new checker?
>
> In the mean time, some answers for your questions:
>
>  - probably you shouldn't care that much about the priority,
>    I don't know what its initial purpose was, so I presume it could
>    be removed at some point. For what I care, each checker should
>    not care about its order of execution, especially when considering
>    calling them in a parallel environment.
>
> - sure, we need to document these as well. Basically, any node
>   from the builtin ast module should be available in pylint as well,
>   under a visit_<node name> method.
>
> - the process_module method is called whenever the checker is also
>   a raw checker. The checkers can be AST checkers, operating on trees,
>   token checkers, operating on tokens and raw checkers, operating on the
>   file content itself. A checker can be all of these at the same
>   time, if you declare the right __implements__. process_module is usually
>   used when you need the entire content of the file for some reason.
>   Of course, this can also be implemented with a visit_module()
>    and getting the string representation of the module node, although
>   we have some problems now with that, since we can't respect the
>   invariant that ast.to_string() == file content.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20160818/88d754bf/attachment-0001.html>


More information about the code-quality mailing list