Add more code style automation

Registered by David Stanek

Hacking is a great start at automating checks for common style issues. There are still lots of things that it is not checking for that it probably should. This is the list of things I check for when I'm reviewing that that would be nice to move into an automated check:

 - block comments should have a space after the # (this is already enforced for inline comments)
 - mutables should not be used as default args
 - % should not be used in log statements
 - assertNone should be used when using None with assertEqual
 - spelling check for comments and docstrings
 - warn if children that change method signature of their parent
 - methods that just pass are useless and should be deleted
 - warn on try-except that just passes
 - enforce import ordering and spacing
 - _() should not be used in debug log statements

I'm sure that as I'm fixing the code to conform to the new checks, I'll identify additional checks to implement.

(stevemar) if I may add some more:
- ensure no vim headers
- assertEqual(len(some_list), 0) should be assertEqual(some_list, [])
- methods / functions that are unused
- class properties that are unused
- ensure incoming method args are actually used
- doc strings - ensure all method args are mentioned (if any are mentioned)
- use ' over "
- ensure we don't go assigning copyrights to OpenStack Foundation

Blueprint information

Status:
Complete
Approver:
None
Priority:
Low
Drafter:
David Stanek
Direction:
Approved
Assignee:
David Stanek
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Steve Martinelli
Completed by
Steve Martinelli

Related branches

Sprints

Whiteboard

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

Addressed by: https://review.openstack.org/78116
    Add a space after the hash for block comments

Addressed by: https://review.openstack.org/78117
    Removes the use of mutables as default args

Addressed by: https://review.openstack.org/78118
    Use assertIsNone when comparing against None

Gerrit topic: https://review.openstack.org/#q,topic:bp/more-code-style-automation,n,z

Addressed by: https://review.openstack.org/78119
    Adds style checks to ease reviewer burdon

Why not add some of these back to hacking so all projects can use them?

Addressed by: https://review.openstack.org/101636
    Adds hacking check for debug logging translations

Addressed by: https://review.openstack.org/118883
    Adds missing log hints for level E/I/W

Addressed by: https://review.openstack.org/118884
    Extends hacking check for logging to verify i18n hints

Addressed by: https://review.openstack.org/119461
    Fixes a spelling error in hacking tests

Addressed by: https://review.openstack.org/125233
    Fixes aggressive use of translation hints

(stevemar) 2016-02-02: marking this as complete, it's been finished for a while and a great help to our code base, any additional changes can be performed as bugs.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.