grass
grass copied to clipboard
[Bug] Fix currently ignored Flake8 warnings
Fix one or more of the issues reported by Flake8.
This issue is not something which will be fixed by one PR. Instead, it serves as a pointer to the list of ignored warnings in the source code. Pick one or more issues or files, fix them, and submit a PR.
Getting the existing issues to fix
- Go to the source code.
- Find one of the
.flake8files in the source tree. - See the
per-file-ignoressection. - Pick a file, group of files, issues, or group of issues, e.g.,
E741orutils/mkrest.py. - Delete that from the
.flake8file. - Run
flake8 --show-source --statisticsin the directory where the edited.flake8file is. - See where the errors are.
Note that all issues in the per-file-ignores section should be fixed unless noted otherwise. Some Flake8 warnings may be false positives or perhaps there is a good reason for the code to break some of the best practices. In that case, the issue should be ignored at the particular line using # noqa: ... with a comment stating the reason for it.
Finding .flake8 files
Currently, there is several .flake8 files. To find them use, e.g., find:
find . -name ".flake8"
or ls
ls .flake8 */.flake8 */*/.flake8
The current list is:
./.flake8
./gui/wxpython/.flake8
./lib/init/.flake8
./python/grass/.flake8
./scripts/.flake8
./temporal/.flake8
Example
At the time of writing, the file ./scripts/.flake8 contains line i.in.spotvgt/i.in.spotvgt.py: E722 in the per-file-ignores section. Searching online for "Flake8 E722" leads to Flake8 Rules: Do not use bare except, specify exception instead page which explains the issue and a general guide on how to fix it.
Hi, I'm new to open source environments and coding, but I would like to work on this issue. If you can guide me a bit...
Hi, that's great. Get the basic stuff first, like source code through Git and compile the source code (easiest on Linux, e.g., on Ubuntu). Then you can start making modifications.
Given that GRASS GIS is not only Python, you need to recompile to test the code. What to test and how might be difficult to guess first, but often it won't be even needed depending on what you decide to fix from these issues, so I would just worry about it once you have an open PR to keep things simple at the beginning.
I'm adding this info here for convenience, but the place to discuss this further is grass-dev mailing list. You don't need to subscribe, but it is the best place to discuss technical issues with your setup, compilation etc. You can also create an issue to ask for a better documentation if you can't find some information in the existing resources.
I have cloned the code. After that, I executed the following two commands: git remote add upstream https://github.com/OSGeo/grass git remote -v After this can I directly start editing the code? Or compilation is still required? I am new to this and I'm not able to understand the compilation. Kindly help me with this.
Please, sign up for the grass-dev mailing list. As I said, that's the for these questions. See here and here. This issue is not the right place to discuss compiling or dealing with source code because we want the keep comments comments strictly relevant to the reported issue itself. (This is a general pratice, so you can happily add it to your what-I-learned-today list. :+1:)
Hey! I want to contribute to this issue! If you could provide me the access! I tried doing it for build_html.py mentioned in .flake8 file . While running flake8 —show-source —statistics it shows access denied error. Please direct me to resource on which files I should commit to!
Hey! I want to contribute to this issue! If you could provide me the access! I tried doing it for build_html.py mentioned in .flake8 file . While running flake8 —show-source —statistics it shows access denied error
Program 'flake8.exe' failed to run: Access is deniedAt line:1 char:1
- flake8 --show-source --statistics
-
At line:1 char:1
- flake8 --show-source --statistics
-
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException + FullyQualifiedErrorId : NativeCommandFailed
Whatever access issue you have is unrelated to anything related to this project. You get the source code and then run Flake8 on it. Try on your own file with some guide on using Flake8 (blog post, documentation, ...).
@echoix This issue might be a challenge to you :-) The list is long...
I didn't see that issue yet, but I started a bit on my own without knowing. The part that I said "Should I make another PR with the missing fixes", it's because I had them in another branch (the commits that followed what I sent as a PR)