Re: [PATCH] Exclude .tox, distro_tracker/vendor, and docs/conf.py from flake8

2017-12-20 Thread Raphael Hertzog
Hello,

On Tue, 19 Dec 2017, Ville Skyttä wrote:
> I see a bunch of errors related to use of bare except there. Full list

Yes, me too. Those appeared recently.

> Subject: [PATCH] Exclude .tox and docs/conf.py from flake8
> 
> ---
>  tox.ini | 2 +-

Merged your patch.

On Tue, 19 Dec 2017, Paul Wise wrote:
> > But why distro_tracker/vendor?
> 
> That sounds like embedded code copies so it should be checked/fixed by
> the upstream projects rather than by distro-tracker.

Ah, in fact it's "vendor" in the sense of dpkg-vendor. So it's real
distro-tracker code. :)

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/



Re: [PATCH] Exclude .tox, distro_tracker/vendor, and docs/conf.py from flake8

2017-12-19 Thread Ville Skyttä
On Tue, Dec 19, 2017 at 11:13 AM, Raphael Hertzog  wrote:
> On Mon, 18 Dec 2017, Ville Skyttä wrote:
>> -exclude = 
>> .git,.ropeproject,__pycache__,distro_tracker/project/settings/local.py,*/migrations/*.py
>> +exclude = 
>> .git,.ropeproject,.tox,__pycache__,distro_tracker/project/settings/local.py,distro_tracker/vendor,docs/conf.py,*/migrations/*.py
>
> Ok, for .tox and docs/conf.py. But why distro_tracker/vendor?

Without having had a closer look, I assumed that the vendor dir is for
"vendored" packages, i.e. bundled ones from other upstreams, but that
seems wrong. Updated patch attached.

> And why is it needed at all? I was not getting any warning from those
> directories (I see a few errors currently with the latest version of
> flake8, but not specially in the above directories).

I see a bunch of errors related to use of bare except there. Full list
attached, generated with:
$ flake8 --version
3.5.0 (flake8-bugbear: 17.12.0, mccabe: 0.6.1, pycodestyle: 2.3.1,
pyflakes: 1.6.0) CPython 3.6.3 on Linux
./setup.py:9:1: E302 expected 2 blank lines, found 1
./setup.py:12:22: E225 missing whitespace around operator
./setup.py:42:81: E501 line too long (81 > 80 characters)
./setup.py:47:9: E121 continuation line under-indented for hanging indent
./setup.py:52:6: E124 closing bracket does not match visual indentation
./setup.py:60:9: E121 continuation line under-indented for hanging indent
./setup.py:65:6: E124 closing bracket does not match visual indentation
./manage.py:17:81: E501 line too long (86 > 80 characters)
./distro_tracker/accounts/views.py:194:36: B306 `BaseException.message` has 
been deprecated as of Python 2.6 and is removed in Python 3. Use `str(e)` to 
access the user-readable message. Use `e.args` to access arguments passed to 
the exception.
./distro_tracker/core/panels.py:727:13: E722 do not use bare except'
./distro_tracker/core/panels.py:727:13: B001 Do not use bare `except:`, it also 
catches unexpected events like memory errors, interrupts, system exit, and so 
on.  Prefer `except Exception:`.  If you're sure what you're doing, be explicit 
and write `except BaseException:`.
./distro_tracker/core/retrieve_data.py:60:5: E722 do not use bare except'
./distro_tracker/core/retrieve_data.py:60:5: B001 Do not use bare `except:`, it 
also catches unexpected events like memory errors, interrupts, system exit, and 
so on.  Prefer `except Exception:`.  If you're sure what you're doing, be 
explicit and write `except BaseException:`.
./distro_tracker/core/admin.py:73:5: E722 do not use bare except'
./distro_tracker/core/admin.py:73:5: B001 Do not use bare `except:`, it also 
catches unexpected events like memory errors, interrupts, system exit, and so 
on.  Prefer `except Exception:`.  If you're sure what you're doing, be explicit 
and write `except BaseException:`.
./distro_tracker/core/models.py:2021:9: E722 do not use bare except'
./distro_tracker/core/models.py:2021:9: B001 Do not use bare `except:`, it also 
catches unexpected events like memory errors, interrupts, system exit, and so 
on.  Prefer `except Exception:`.  If you're sure what you're doing, be explicit 
and write `except BaseException:`.
./distro_tracker/core/management/commands/tracker_run_task.py:56:13: E722 do 
not use bare except'
./distro_tracker/core/management/commands/tracker_run_task.py:56:13: B001 Do 
not use bare `except:`, it also catches unexpected events like memory errors, 
interrupts, system exit, and so on.  Prefer `except Exception:`.  If you're 
sure what you're doing, be explicit and write `except BaseException:`.
./distro_tracker/core/tests/tests_utils.py:599:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:602:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:605:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:612:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:630:25: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:632:26: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:634:25: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:635:26: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_utils.py:668:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_models.py:127:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_models.py:128:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/tests/tests_models.py:139:9: E741 ambiguous variable name 
'l'
./distro_tracker/core/utils/__init__.py:97:24: E741 ambiguous variable name 'l'
./distro_tracker/core/utils/http.py:225:9: E722 do not use bare except'
./distro_tracker/core/utils/http.py:225:9: B001 Do not use bare `except:`, it 
also catches unexpected events like memory errors, interrupts, system exit, and 
so on.  Prefer `except Exception:`.  If you're sure what you're doing, 

Re: [PATCH] Exclude .tox, distro_tracker/vendor, and docs/conf.py from flake8

2017-12-19 Thread Paul Wise
On Tue, Dec 19, 2017 at 5:13 PM, Raphael Hertzog wrote:

> But why distro_tracker/vendor?

That sounds like embedded code copies so it should be checked/fixed by
the upstream projects rather than by distro-tracker.

> And why is it needed at all? I was not getting any warning from those
> directories (I see a few errors currently with the latest version of
> flake8, but not specially in the above directories).

I guess it avoids the time needed for checking code that doesn't need
to be checked.

-- 
bye,
pabs

https://wiki.debian.org/PaulWise



Re: [PATCH] Exclude .tox, distro_tracker/vendor, and docs/conf.py from flake8

2017-12-19 Thread Raphael Hertzog
On Mon, 18 Dec 2017, Ville Skyttä wrote:
> -exclude = 
> .git,.ropeproject,__pycache__,distro_tracker/project/settings/local.py,*/migrations/*.py
> +exclude = 
> .git,.ropeproject,.tox,__pycache__,distro_tracker/project/settings/local.py,distro_tracker/vendor,docs/conf.py,*/migrations/*.py

Ok, for .tox and docs/conf.py. But why distro_tracker/vendor?

And why is it needed at all? I was not getting any warning from those
directories (I see a few errors currently with the latest version of
flake8, but not specially in the above directories).

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: https://www.freexian.com/services/debian-lts.html
Learn to master Debian: https://debian-handbook.info/get/



[PATCH] Exclude .tox, distro_tracker/vendor, and docs/conf.py from flake8

2017-12-18 Thread Ville Skyttä
---
 tox.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tox.ini b/tox.ini
index b8da0bd..04e5e39 100644
--- a/tox.ini
+++ b/tox.ini
@@ -57,7 +57,7 @@ deps =
 [flake8]
 max-complexity = 12
 max-line-length = 80
-exclude = 
.git,.ropeproject,__pycache__,distro_tracker/project/settings/local.py,*/migrations/*.py
+exclude = 
.git,.ropeproject,.tox,__pycache__,distro_tracker/project/settings/local.py,distro_tracker/vendor,docs/conf.py,*/migrations/*.py
 ignore = N813,N806,N802
 
 [testenv:coverage]
-- 
2.14.1