[Plone-testing-team] On plone.recipe.codeanalysis

Gil Forcada gil.forcada at freitag.de
Mon Jul 22 07:42:59 UTC 2013


Hi!

Sorry for the late response:

El Jul 20, 2013, a les 1:30 PM, Timo Stollenwerk va escriure:

> On Fri, Jul 19, 2013 at 5:46 PM, Gil Forcada <gil.forcada at freitag.de> wrote:
> Hi!
> 
> El Jul 19, 2013, a les 5:29 PM, Héctor Velarde va escriure:
> 
>> On 19/07/13 12:09, Gil Forcada wrote:
>>> Namely the checks I currently do are:
>>> - flake8 / pep8 / pyflakes
>>> - zptlint
>>> - trailing spaces on files (any kind of file, not just code)
>>> - tabs on files (remove them everywhere!, again not just code)
>>> - utf-8 header on python files
> 
> +1
>>> - keep imports as per plone.api style guide (one per line, not grouped)
> 
> 
> +1 
>>> - use only single quotes (that's a completely personal taste, just for
>>> consistency)
> 
> So 'foo: "bar"' would be ok then?

Yes, actually when there are both single and double quotes I skip that, because for my personal taste I find it better to use both within a string than starting a escape madness.

>>> - use new style string formatting ({0} instead of %s as per plone.api
>>> style guide)
> 
> I have to check on that. Do you have a link?

Right here: http://ploneapi.readthedocs.org/en/latest/contribute/conventions.html#string-formatting

The PEP itself is: http://www.python.org/dev/peps/pep-3101

>>> 
>>> So, the question is: which of the above would be merged if a pull
>>> request is made?
> 
> In general I don't mind adding options with a personal opinion node. Ideally p.r.codeanalysis can be configured to check everything that the current plone(.api) style guide recommends.
> 
> @Gil: You can do single pull requests or one pull request for all or just commit to the master, whatever you like. Thanks for your contributions. Make sure you add yourself to the contributors list for proper credit.

As I'm a bit obsessed in clean patches and well-formatted and formatted commits I keep rebasing them on top of master.

Once I'm done with them I will make a pull request.


> 
> One other enhancement we could discuss are "auto"-fixes (like autopep8, or a script that adds the utf-8 headers). I'd like to include that as well.

But then that would be a different option right? I mean, doesn't make sense that the utf8-header validator adds the header on the missing ones on jenkins for example, then on the next commit jenkins will fail to pull as there will be local changes.

But providing separate commands, sure, why not.

Probably we need a generic line parser, so that instead of repeating the loop and counter and all that we just pass a method on it.

>  
>> 
>> HV> IMO all of them, except for the latest 3; zptlint will need to be enhanced.
> 
> Out of the three last ones, two of them come from plone.api style guide which the FWT decided to be "the Plone style guide", so I would guess that we want to enforce that coding style, aren't we?
> 
> As for the zptlint, care to elaborate which kind of enhancements?
> 
> That would be interesting to know indeed. Maybe we should ask Godefroid and Balazs to elaborate if necessary.
>>> Any other code checker in mind (apart from CSS and JS) you have in mind
>>> for the future? I will try to create them..
>> 
>> HV> I have mentioned more on previous emails.
> 
> I only saw the deprecated testing methods which we could generalize as a deprecated methods checker?
> 
> That was my first thought as well. We can either have rather specific checks (e.g. check-for-deprecated-unittest-methods) or a generalized option where we can add whatever methods or regular expressions we want.

Right now, on my github fork I added a validator for debug statements (print and pdb so far), but I would say that both (deprecated methods and debugging statements) have different purposes, so I would rather keep them guarded by different options.

Cheers,
Gil

> 
> Cheers,
> Timo

_________________________________________________________

DER FREITAG Mediengesellschaft mbH & Co. KG

Gil Forcada
Webentwickler - Freitag Online

Hegelplatz 1
D-10117 Berlin

Telefon: +49 (30) 25 00 87-601
Fax:     +49 (30) 25 00 87-99

E-Mail: gil.forcada at freitag.de
Website: http://www.freitag.de

Geschäftsführung: Jakob Augstein

HRA 41657 B
_________________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-testing-team/attachments/20130722/299006f7/attachment.html>


More information about the Plone-testing-team mailing list