The best practice in Python is not to use mutable object (i.e. list,
dictionary, or instances of most classes) as value of default
argument (see https://goo.gl/Kwhg0T). A hacking rule to enforce this
practice is added as well.
The patch was inspired by CR https://review.openstack.org/#/c/198465/
and took most of its code from it as well. That's why original
copyrights are kept.
Closes-Bug: #1471349
Change-Id: Ia77b1736dbc3d4e28ff2d2c3424e9cfcaefa5077
We have one more import with #noqa: django.conf.urls.include that is also
commonly used in urls.py module and could be included to the list of
import exceptions. This change has also revealed one unused import.
Change-Id: I47cc582340625aac87ab0242b147e11ef1d9b38e
We have two imports with #noqa: django.conf.urls.patterns and
django.conf.urls.url however using them is a standard way of creating
any urls.py module. So there are over 150 imports in Horizon code
where #noqa could be replaced with two lines in list of import_exceptions.
Change-Id: I81c3290e0dc958b5037dd6a87e44df18adfbe751
Since there is a couple of new import exceptions in tox.ini,
we should add corresponding lines to HACKING.rst list.
Change-Id: Ia45eb9a5dcdc4db5205f235c85cfeab80c62d786
Django changed the name to force_unicode and it's only available in
python2 as an alias of force_text. The new name is available since
Django 1.4.2
Closes-Bug: #1345642
Change-Id: Ida8c545ceec7c31999f2497d540a0dc5a653d286
We have a lot of import with #noqa that is there to ignore h302,
because it's traditional to import and use a name directly, instead
of a whole module. This hides other errors and gives people the
impression that it's actually fine to import non-modules, you just
have to slap #noqa on those lines.
I went through the code and identified about a dozen names that are
most commonly imported this way. I remove the #noqa tag from them,
and added them to the list in import_exceptions.
I also removed a few unused imports that were revealed in the process.
Change-Id: I27afb8e2b1d4759ec974ded9464d8f010312ee78
Make HACKING.rst have the same format as in other OpenStack repos. When
working across multiple projects its nicer to have files have the same
formatting to reduce confusion.
Change-Id: I078f7ba512cfd8ccaf646e37287bcdbb11e54e90
The current links in the HACKING file are broken. This references the
correct location for contributors to view.
Change-Id: I785ae8e01a7e88f7bc3b94c59ea0c35068fede13
Add HACKING.rst but instead of copying the file around point to the new
cannonical location for it
https://github.com/openstack-dev/hacking/blob/master/HACKING.rst
Also expand out the flake8 H series ignores, so they can be enabled one
by one.
Change-Id: I6ec39d00c3beabbc3e661754bac6e43a0fb351d6