whatsopt / WhatsOpt

Web application for multidisciplinary design analysis and optimization
GNU Affero General Public License v3.0
30 stars 10 forks source link

PEP8 compliancy #58

Closed sverley closed 3 years ago

sverley commented 3 years ago

Generated python files doesn't respect totally the PEP8 recommendations. Since WOP use a code generator, it should be great to have PEP8 compliant files in order to promote the PEP8.

relf commented 3 years ago

Thanks for the heads up. As I use an IDE which auto-formats code on save, I try to keep generated code readable but I forgot a bit about PEP8 when writing code templates (and trailing spaces, among other things, slips through). I should create an automated test before fixing this.

christophe-david commented 3 years ago

@sverley, I guess you have the line length in mind, as it is the only recommendation that I find not respected from my experience with WhatsOpt.

I also think that limiting line length would be a good thing. Nevertheless, though I understand the limitation to 79 characters in a general context, I think that, for standard applications of WhatsOpt, such a strong limitation could hinder readability more than improve it. Yet I would support the choice to limit line lengths to 100 (or at least 88, which is the nicely argued default value of Black).

christophe-david commented 3 years ago

In the same vein, I would suggest to remove the coding: utf-8 lines, since Python 2 is no more supported.

christophe-david commented 3 years ago

... And factory classes should not inherit from object anymore 😁

christophe-david commented 3 years ago

@sverley, I guess you have the line length in mind, as it is the only recommendation that I find not respected from my experience with WhatsOpt.

My bad, I had not realized that the generated code was modified by my automated runs of Black. So indeed, there is room for improvement 😅.

sverley commented 3 years ago

I have started a fix #67

relf commented 3 years ago

I consider this is fixed by #67 and #80. Feel free to open specific issue related to generated code format.