Doc checker quirks
See original GitHub issueDescribe 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:
- The script does not handle poor monkey-patching (replacing with
lambda
without copying a docstring) numpydoc.Validate()
reports weird results if identation inParameters
section is too big- 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:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To apply to the module documentation,
# noqa: MD02
should be placed in the first line of the file.Tracked by #3033