Add more code style automation
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(
- 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
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Add a space after the hash for block comments
Addressed by: https:/
Removes the use of mutables as default args
Addressed by: https:/
Use assertIsNone when comparing against None
Gerrit topic: https:/
Addressed by: https:/
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:/
Adds hacking check for debug logging translations
Addressed by: https:/
Adds missing log hints for level E/I/W
Addressed by: https:/
Extends hacking check for logging to verify i18n hints
Addressed by: https:/
Fixes a spelling error in hacking tests
Addressed by: https:/
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.