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

David Stanek
David Stanek
Series goal:
Milestone target:
Started by
Steve Martinelli
Completed by
Steve Martinelli

Related branches



Gerrit topic:,topic:moar_pep8,n,z

Addressed by:
    Add a space after the hash for block comments

Addressed by:
    Removes the use of mutables as default args

Addressed by:
    Use assertIsNone when comparing against None

Gerrit topic:,topic:bp/more-code-style-automation,n,z

Addressed by:
    Adds style checks to ease reviewer burdon

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

Addressed by:
    Adds hacking check for debug logging translations

Addressed by:
    Adds missing log hints for level E/I/W

Addressed by:
    Extends hacking check for logging to verify i18n hints

Addressed by:
    Fixes a spelling error in hacking tests

Addressed by:
    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.


No subscribers.