darglint icon indicating copy to clipboard operation
darglint copied to clipboard

Section indentation not triggering error

Open kannes opened this issue 7 years ago • 4 comments

"Sections should be indented two spaces, except for the heading." says https://google.github.io/styleguide/pyguide.html#383-functions-and-methods (and I wonder why it says two while their example uses four...)

Consider

def f(foo):
    """foobar foobars foobar

         Args:
             foo: foobar
            
           Returns:
              foobarred bar
    """
    return "bar"

I would have expected a error about the messed up indentation. But got a successful linting run instead:

$ darglint -v 2 f.py 
$ 

I am on 0.5.1.

kannes avatar Nov 23 '18 14:11 kannes

Ah, this would be another stylistic error.

I just like reporting whatever my students end up writing ;)

kannes avatar Nov 23 '18 15:11 kannes

So, currently darglint expects indentation to be four spaces (as all the examples show.) I actually want to change this to be any indentation amount, so long as it is consistent. I'll probably add this at the same time I handle the other style errors (since this will also require updates to the parser.)

terrencepreilly avatar Nov 23 '18 15:11 terrencepreilly

Probably, though, an issue/merge request should be put into the Google style guide. (So that others don't run into the same ambiguity.)

terrencepreilly avatar Nov 23 '18 15:11 terrencepreilly

Okay, I've submitted an issue here.

terrencepreilly avatar Nov 23 '18 15:11 terrencepreilly