Fix some PEP-257 issues in reviewboard/accounts/.

Review Request #6929 — Created Feb. 10, 2015 and submitted

Information

Review Board
master
f5fc853...

Reviewers

If we're eventually going to integrate the PEP-257 tool into Review Bot (which
I think we should), we should get our docstring house in order first. This
change goes through reviewboard/accounts and fixes most of the issues that
aren't just a missing docstring.

The one "error" that I chose to disable for this is D203, which wants a blank
line before class docstrings. I didn't see any justification for this in the
actual PEP-257 document, and I think it's ugly. There are also a couple cases
that I chose to ignore where our test docstrings which wrap didn't follow the
usual rules. There are a ton of things that have missing docstrings, but those
will require more work to clean up.

  • Ran unit tests
  • Ran pep257 --ignore=D203 reviewboard/accounts
Description From Last Updated

The summary line should be on the """.

chipx86chipx86

I briefly mentioned this in a different review request when this came up, but I think "Get" isn't explicit enough. …

chipx86chipx86

Summary should be on the previous line.

chipx86chipx86

Same here.

chipx86chipx86

The old docs weren't very explicit, but they had more information than the new one. How about expanding to talk …

chipx86chipx86

"Display" ?

chipx86chipx86

""" on the next line.

chipx86chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/accounts/decorators.py
        reviewboard/accounts/backends.py
        reviewboard/accounts/views.py
        reviewboard/accounts/trophies.py
        reviewboard/accounts/pages.py
        reviewboard/accounts/forms/pages.py
        reviewboard/accounts/managers.py
        reviewboard/accounts/models.py
        reviewboard/accounts/tests.py
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/forms/registration.py
        reviewboard/accounts/admin.py
        reviewboard/accounts/middleware.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/accounts/decorators.py
        reviewboard/accounts/backends.py
        reviewboard/accounts/views.py
        reviewboard/accounts/trophies.py
        reviewboard/accounts/pages.py
        reviewboard/accounts/forms/pages.py
        reviewboard/accounts/managers.py
        reviewboard/accounts/models.py
        reviewboard/accounts/tests.py
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/forms/registration.py
        reviewboard/accounts/admin.py
        reviewboard/accounts/middleware.py
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/accounts/backends.py (Diff revision 1)
     
     
     
    Show all issues

    The summary line should be on the """.

  3. reviewboard/accounts/backends.py (Diff revision 1)
     
     
    Show all issues

    I briefly mentioned this in a different review request when this came up, but I think "Get" isn't explicit enough. Since we're describing it as an action, this sounds like it's saying that the function is getting the backends, but it's not clear that it's actually returning them. Lots of functions get things without returning them.

    1. I'm not sure I agree. "Get" is definitely an overloaded term, but I think that when it's straightforward like this it makes sense (other uses of get would qualify it further, like "get and store X" or "Make an HTTP GET request")

    2. Hmm, but isn't this meant to describe what the function does, rather than what the caller does when calling it? The function doesn't get anything. It does return a thing, but it's not getting things.

      A function like:

      def foo()
          return 42
      

      isn't getting the value 42. It's returning it.

  4. reviewboard/accounts/decorators.py (Diff revision 1)
     
     
     
    Show all issues

    Summary should be on the previous line.

  5. reviewboard/accounts/decorators.py (Diff revision 1)
     
     
     
    Show all issues

    Same here.

  6. reviewboard/accounts/models.py (Diff revision 1)
     
     
     
     

    Just curious, why is the blank line required? It doesn't seem to be consistent with the requirements for functions?

    1. I think it's just following the rule that top-level items within a class are separated by a blank line.

  7. reviewboard/accounts/views.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    The old docs weren't very explicit, but they had more information than the new one. How about expanding to talk about how the auth backend comes into play, and what happens if the auth backend doesn't support registration?

  8. 
      
david
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/accounts/decorators.py
        reviewboard/accounts/backends.py
        reviewboard/accounts/views.py
        reviewboard/accounts/trophies.py
        reviewboard/accounts/pages.py
        reviewboard/accounts/forms/pages.py
        reviewboard/accounts/managers.py
        reviewboard/accounts/models.py
        reviewboard/accounts/tests.py
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/forms/registration.py
        reviewboard/accounts/admin.py
        reviewboard/accounts/middleware.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/accounts/decorators.py
        reviewboard/accounts/backends.py
        reviewboard/accounts/views.py
        reviewboard/accounts/trophies.py
        reviewboard/accounts/pages.py
        reviewboard/accounts/forms/pages.py
        reviewboard/accounts/managers.py
        reviewboard/accounts/models.py
        reviewboard/accounts/tests.py
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/forms/registration.py
        reviewboard/accounts/admin.py
        reviewboard/accounts/middleware.py
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/accounts/views.py (Diff revision 2)
     
     
    Show all issues

    "Display" ?

  3. reviewboard/accounts/views.py (Diff revision 2)
     
     
    Show all issues

    """ on the next line.

  4. 
      
david
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/accounts/decorators.py
        reviewboard/accounts/backends.py
        reviewboard/accounts/views.py
        reviewboard/accounts/trophies.py
        reviewboard/accounts/pages.py
        reviewboard/accounts/forms/pages.py
        reviewboard/accounts/managers.py
        reviewboard/accounts/models.py
        reviewboard/accounts/tests.py
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/forms/registration.py
        reviewboard/accounts/admin.py
        reviewboard/accounts/middleware.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/accounts/decorators.py
        reviewboard/accounts/backends.py
        reviewboard/accounts/views.py
        reviewboard/accounts/trophies.py
        reviewboard/accounts/pages.py
        reviewboard/accounts/forms/pages.py
        reviewboard/accounts/managers.py
        reviewboard/accounts/models.py
        reviewboard/accounts/tests.py
        reviewboard/accounts/forms/auth.py
        reviewboard/accounts/forms/registration.py
        reviewboard/accounts/admin.py
        reviewboard/accounts/middleware.py
    
    
  2. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to master (c40d908)