New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PEP8: bulk fixes on entire grass7/ subdirectory tree with flake8 #357
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I checked what you linked. In the following, a manual change would be better:
# grass7/gui/wxpython/wx.rdigit/rdigit/dialogs_core.py
- UsingGDAL = vExternalOut.has_key('Not using GDAL') == False
+ UsingGDAL = "Not using GDAL" not in vExternalOut
Although that looks like super fragile code in any case.
You are right about import ipdb; ipdb.set_trace()
. It should be just deleted.
If I remember correctly, bulk autopep run on wxGUI code broke several places mainly due to bad replacement of tabs by spaces (perhaps autopep did not expect tab to be used for character number reduction). It would be good to check files which had tabs on lines with some code (the relevant commit has many files with tabs only at empty lines).
Thanks @wenzeslaus - changed as suggested. |
scrolled through my addons and a few others where I've been involved (e.g. r.basin, r.hazard.flood, r.hypso, ...), looks good so far |
from the submitting guidelines:
though in the bulk refactoring only the first space around the first parentheses is deleted, the second is still there. for example:
changed in
|
Indeed. While this rule here https://www.flake8rules.com/rules/E201.html states "Open parentheses should not have any space before or after them." (which was in this PR done with 1205fa6) I do not find the corresponding "Closing parentheses ..." pendant for it. Does anyone know the flake8 code to be applied here? |
... found it :-) E202: whitespace before ‘)’ |
|
I suggest to separate Black application out into a new PR. This PR is already large enough.
Not sure what you mean. I simply overlooked to apply E202 initially when preparing this PR.
I checked and identified these related commits: I did a shallow test of |
I agree. Just saying the Black whitespace is different than the Flake8 (still PEP8/Flake8 complaint, but more strict and sometimes different than other auto-formatting tools.
I mean running the Flake8 checks. It seemed to me you are talking about auto-applying changes.
These look good. No changes in if branches. |
This reverts commit 755cf54. Reason: conversion to raw strings seems to break the mapcalculator expressions
Is there anything else left open or may I merge? |
While not being a big fan of bulk fixes I have taken liberty to apply flake8 recursively on
grass-addons/grass7/
.The fixes are separated by commit in order to more easily review them.
Eventually, after review, all can be squashed into one commit.
Rationale: follow more closely our coding style: https://trac.osgeo.org/grass/wiki/Submitting/Python#PEP8standardStyle
Once accepted, the GitHub Action flake8 test from core GRASS GIS may be used also here.
The script I wrote to auto-create this PR: