What PEP8 tool/settings?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

What PEP8 tool/settings?

Paul Smith

Gramps is written to (almost?) PEP8 but what tool should I be using to validate source that I’ve written?

 

I’ve tried ‘flake8’ but get many false positives against existing code – is it just a case of excluding certain tests in which case what is the defined list?

 

Thanks,

Paul DS.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: What PEP8 tool/settings?

prculley
Our standard for new Gramps code is Pep8. Using the pylint tool should give good results. We generally aim for a score above 9.0.

Be aware that our older code does not yet meet this standard. Sometimes when working on a module a developer will go through it and update it to the standard. But it doesn't happen everyday.

Paul Culley 

On Feb 20, 2018 2:06 AM, "Paul Smith" <[hidden email]> wrote:

Gramps is written to (almost?) PEP8 but what tool should I be using to validate source that I’ve written?

 

I’ve tried ‘flake8’ but get many false positives against existing code – is it just a case of excluding certain tests in which case what is the defined list?

 

Thanks,

Paul DS.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: What PEP8 tool/settings?

Nick Hall
In reply to this post by Paul Smith
On 20/02/18 08:05, Paul Smith wrote:

Gramps is written to (almost?) PEP8 but what tool should I be using to validate source that I’ve written?

We use pylint with the configuration file found in the root directory.

https://www.pylint.org/

https://github.com/gramps-project/gramps/blob/master/.pylintrc

Please see our programming guidelines for further information:

https://gramps-project.org/wiki/index.php?title=Programming_guidelines

Try to write code with a high pylint score, but also use some common sense.  It is sometimes acceptable to break the rules. e.g. if you are writing graphics code then the variables x, y and z can be used for co-ordinates.

Don't disable warnings locally; other developers may find them useful.  We want to avoid pages of warnings though.

You should be able to achieve a pylint score greater than 9 on new files.  However, there may be some exceptions for very small files.

We appreciate contributions that tidy up existing code.  Please put pylint improvements in a separate commit to other changes.

Feel free to ask if you have any questions.

Regards,


Nick.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel