Cirq icon indicating copy to clipboard operation
Cirq copied to clipboard

Inconsistent docstring line lengths

Open dabacon opened this issue 3 years ago • 4 comments

A few years ago we switched to using black to auto-format and set the character width at 100. When we did this, we ended up with a lot of doc strings that were not touched and so are 80 characters. We now have both 80 or 100 or a mixture of docstrings.

  1. Would be nice to just standardize on one width going forward, just so we don't have to think about it. Possibly also say new docstring follow this, old ones are ok.

  2. We could use a docstring format enforcer. The best I've found so far is https://github.com/PyCQA/docformatter . It is not super aggressive, if your description in a doc string has special characters, it prefers not to wrap things.

Low priority.

dabacon avatar Feb 09 '22 20:02 dabacon

Marked discuss even though we already had a discussion about this since it seems to me that there are still some unknowns, e.g. which tool to use.

viathor avatar Feb 09 '22 22:02 viathor

In going through the annotations of docformatter, there are lots of methods that have multiline doc strings that don't follow PEP 257 in that they don't have a single line comment followed by a space, but are instead multiline right of the bat. Other than that it seems to make pretty reasonable choices.

dabacon avatar Feb 10 '22 17:02 dabacon

@dabacon Change after-1.0 if you feel strongly about it.

tanujkhattar avatar Mar 28 '22 20:03 tanujkhattar

I have a proposal for doing this before 1.0: #4981

dabacon avatar Mar 29 '22 17:03 dabacon