HACKING.rst and import standards

Registered by Tatiana Ovchinnikova

It appears that rebasing on changed master branch is not a trivial task now. When nearly each Horizon module includes comma separated imports, all patch sets including import from the same module in an existing import statement can't be merged automatically. You have to rebase manually, just because of a few imports.

It would be nice to implement all imports uniformly like that is done in other projects. For example we could write one import per line or just replace all related imports with module import. That would solve merging problems and code would look much better.

It also would be nice to add HACKING.rst to Horizon. We could describe coding standards there and we would (hopefully) never get such kind of rebase and merge problems.

Since we start using HACKING.rst, the following import standarts are to be enabled:
F841 local variable '<smth>' is assigned to but never used
H101 Use TODO(NAME)
H201 no 'except:' at least use 'except Exception:'
H301 one import per line
H302 import only modules
H303 No wildcard (*) import
H304 No relative imports
H306 imports not in alphabetical order

Blueprint information

Status:
Complete
Approver:
Matthias Runge
Priority:
Medium
Drafter:
None
Direction:
Approved
Assignee:
Tatiana Ovchinnikova
Definition:
Approved
Series goal:
Accepted for havana
Implementation:
Implemented
Milestone target:
milestone icon 2013.2
Started by
Matthias Runge
Completed by
Gabriel Hurley

Whiteboard

Link to the discussion on the dev ML
http://lists.openstack.org/pipermail/openstack-dev/2013-June/thread.html#9993

Gerrit topic: https://review.openstack.org/#q,topic:hacking,n,z

Addressed by: https://review.openstack.org/32217
    Add HACKING.rst

Addressed by: https://review.openstack.org/32497
    Start using Hacking

https://review.openstack.org/#/c/38115/
    Enable pep8 F841 checking

https://review.openstack.org/#/c/34167/
    Enable hacking H101 test

https://review.openstack.org/#/c/41611/
    Enable H201

https://review.openstack.org/#/c/32385
    Enable H301

https://review.openstack.org/#/c/41870
    Enable H302 check

https://review.openstack.org/#/c/38435/
    Enable H303

https://review.openstack.org/#/c/35664/
    Enable H304 check

https://review.openstack.org/#/c/34771/
    Enable H306 check

[2013-08-12 | Gabriel] I believe this can safely be marked completed. All the linked reviews are merged, and I'm not aware of current plans for more. If there are other specific issues we can open new tickets for them.

Addressed by: https://review.openstack.org/55888
    Make HACKING.rst formatting sync with other repos

Addressed by: https://review.openstack.org/121784
    Bringing HACKING.rst in correspondence with tox.ini

Gerrit topic: https://review.opendev.org/#/q/topic:hacking

Addressed by: https://review.opendev.org/715286
    Add cap for hacking

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.