CosmiQ / solaris

CosmiQ Works Geospatial Machine Learning Analysis Toolkit
https://solaris.readthedocs.io
Apache License 2.0
411 stars 112 forks source link

Fix flake8 #450

Closed rodrigoalmeida94 closed 2 years ago

rodrigoalmeida94 commented 2 years ago

Description

Flake8 step is now lint (tox -e lint).

srmsoumya commented 2 years ago

@rodrigoalmeida94 There are a lot of flake8 errors, we have to filter which ones we would like to catch.

rodrigoalmeida94 commented 2 years ago

@srmsoumya In the ideal world, we would fix them all. I think this is unreasonable at the moment so I ignored the major ones that look relatively harmless:

    E203, # whitespace before ':' 
    E501, # line too long
    F401, # imported but unused
    C901, # is too complex
    E402, # module level import not at top of file (for docs)

These are the ones that are left (after applying black and isort), and I think it makes sense to address:

./tests/test_eval/evaluator_test.py:89:9: F841 local variable 'path_temp' is assigned to but never used
./tests/test_data/test_coco.py:26:9: E266 too many leading '#' for block comment
./tests/test_data/test_coco.py:65:9: E266 too many leading '#' for block comment
./solaris/tile/raster_tile.py:599:9: F821 undefined name 'cog_translate'
./solaris/preproc/pipesegment.py:415:19: F821 undefined name 'self'
./solaris/preproc/sar.py:565:9: E741 ambiguous variable name 'l'
./solaris/eval/vector.py:35:9: E741 ambiguous variable name 'l'
./solaris/eval/base.py:115:9: F841 local variable 'ground_truth_ids' is assigned to but never used

In any case we should fix these after merging and rebasing with #448 cc @rbavery

rodrigoalmeida94 commented 2 years ago

I fixed the remaining linter errors so now CI should be green.

@rbavery I have added rio_cogeo dependency since in one of the functions we are using cog_translate- we can easily remove this, but then we should also remove the call to this function.

rbavery commented 2 years ago

Let's keep it in as a dependency @rodrigoalmeida94 sicne it's currently used and we also want to better support cogs in the future