question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doc checker quirks

See original GitHub issue

Describe the problem

There are certain quirks which doc checker from #2968 does not handle.

To reproduce place the code below as modin/demo.py and run python scripts/doc_checker modin/demo.py.

The issues are:

  1. The script does not handle poor monkey-patching (replacing with lambda without copying a docstring)
  2. numpydoc.Validate() reports weird results if identation in Parameters section is too big
  3. The script does not point to exact line of failure, but rather to object definition start (makes fixing misspelled moDin in the example below harder)

We should check identation and report it to the user.

Source code / logs

modin/demo.py
def foo(a, b, c):
    """
    Foo mumble mumble.

    moDin is misspelled on purpose.

    Parameters
    ----------
        a : object
            This is description.
        b : object
            More text goes here.
        c : object
            Outta fantasy what to say.

    Returns
    -------
    int
        Random number, generated by fair dice roll.
    """
    return 4


foo = lambda a, b, c: 5
Output when `foo` monkey-patching is active
INFO:PYDOCSTYLE OUTPUT FOR modin\demo.py
ERROR:modin\demo.py:1 at module level:
        D100: Missing docstring in public module
modin\demo.py:1 in public function `foo`:
        D103: Missing docstring in public function

Traceback (most recent call last):
  File "scripts/doc_checker.py", line 557, in <module>
    if not validate(args.paths, args.add_ignore, not args.disable_numpydoc):
  File "scripts/doc_checker.py", line 489, in validate
    if not numpydoc_validate(path):
  File "scripts/doc_checker.py", line 402, in numpydoc_validate
    results = list(map(validate_object, to_validate))
  File "scripts/doc_checker.py", line 328, in validate_object
    noqa_checks = get_noqa_checks(doc)
  File "scripts/doc_checker.py", line 298, in get_noqa_checks
    if "# noqa:" in noqa_str:
TypeError: argument of type 'NoneType' is not iterable
Output when `foo = lambda` is commented out
INFO:PYDOCSTYLE OUTPUT FOR modin\demo.py
ERROR:modin\demo.py:1 at module level:
        D100: Missing docstring in public module

INFO:NUMPYDOC OUTPUT FOR modin\demo.py
ERROR:modin.demo:0:GL08:The object does not have a docstring
ERROR:modin.demo.foo:1:PR01:Parameters {'c', 'b'} not documented
ERROR:modin.demo.foo:1:MD02:Spelling error in line: 3, found: 'moDin', reference: 'Modin'
ERROR:INVALID DOCUMENTATION FOUND

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
anmyachevcommented, Apr 26, 2021

Now there is only one way - use # noqa: MD02, but since such a solution disables checking of all words in the dockstring, then in #3001 I will need change regexp pattern.

I have troubles placing # noqa: MD02 correctly. Whenever I put it, it has no effect on the docstring at the beginning of this file. How do you suggest to do it?

To apply to the module documentation, # noqa: MD02 should be placed in the first line of the file.

0reactions
vnlitvinovcommented, Apr 29, 2021

The problem has to do with how _inherit_docstrings handle functions with classmethod decorator. cc @vnlitvinov

Tracked by #3033

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Doc checker quirks - - Bountysource
Coming soon: A brand new website interface for an even better experience!
Read more >
How to tell if a browser is in "quirks" mode? - Stack Overflow
In Firefox and Opera you can determine if your browser is in "quirks mode" by checking page info. Using document.compatMode , will tell...
Read more >
What happens in Quirks Mode in web browsers?
Quirks Mode is triggered by doctype sniffing , also known as doctype switching . This means that the browser inspects the start of...
Read more >
Fix Your Site With the Right DOCTYPE! - A List Apart
If your document contains no DOCTYPE or contains a “non-standard” one, the browser will revert to quirks mode. If your DOCTYPE does not...
Read more >
Free Grammar Checker Online - ProWritingAid
A great online grammar checker won't just show you your mistakes. It'll help you learn about your writing. Knowing your own quirks, habits,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found