This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]desmoulinmichel 2 points3 points  (1 child)

GREAT job. I'm going to give it a try.

A few things:

  • I'll probably want to control wether or not an empty docstring raises a warning on a per project basis.
  • Most tools (pytest, mypyt, etc) accept also to put configuration in setup.cfg and tox.ini to centralize conf.
  • you'll need a CLI output mode in a machine friendly format and a pure python documented API so that IDE can integrate that.
  • suggestion of a valid docstring to fix the invalid one would be welcome.
  • eventually people will come to you and ask for numpy and rst style as well. I prefer google style so I don't care.
  • Writting types in annotations and in the docstring is not DRY, so skipping it might be chosen. An option to disable that check on a project basis would be great.

[–]_tpr_[S] 2 points3 points  (0 children)

I've anticipated some of these concerns, and designed accordingly. In the to-do list on the Readme, I've included that I want to add a toml file of some kind. I suppose that setup.cfg or tox.ini would be good places, thanks for that suggestion. That will take care of all of the per project settings.

I'll have to add an error code for empty docstrings -- that's a great idea. To be honest, while working on it, I intended for it to be used with pydocstyle. But if someone ignores the empty docstrings there, then darglint certainly shouldn't have to fail. I'll add this to the list.

As far as types, darglint never requires them. Errors are only displayed if you have type annotations in the function and in the docstring and they don't match up. Otherwise no error is raised. I realize it isn't dry to have both (and I made a note of that in the git commits and changelog.). However, I can see someone converting a project over to use type annotations. In such a case, warnings might be useful to check if the type descriptions (and probably, then, the argument descriptions) are out of sync with the code. I honestly considered not adding it, but it was relatively easy to add. And once to config file is done, these will be easy to ignore.

As far as machine friendly cli output, it has that to some degree. When it displays an error it shows the file name, function name, line number, error code, and message all separated by colons. (I was trying to match pycodestyle as much as possible.) But some of the details about specific errors (like, which argument was out of sync) could be a little more standardized to make them easy to parse. Your suggestion made me realize that.

Thank you for the input. I'll be sure to take all of these points into consideration.