-
Notifications
You must be signed in to change notification settings - Fork 58
Pre-process parsed docstrings to add hints on how to resolve names #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #723 +/- ##
==========================================
+ Coverage 93.22% 93.37% +0.14%
==========================================
Files 47 47
Lines 8743 8908 +165
Branches 1601 1639 +38
==========================================
+ Hits 8151 8318 +167
+ Misses 335 331 -4
- Partials 257 259 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pydoctor/epydoc2stan.py
Outdated
else: | ||
_ReferenceTransform(document, ctx).apply() | ||
|
||
def transform_parsed_names(node:'model.Module') -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be re-run on nodes that have been reparented. Meaning we must keep track of reparented nodes for every modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue will be fixed if we move the reparenting in post process and call transform_parsed_names()
before.
Also enamble msg(once=True) when using report().
…rsed_annotations, FunctionOverload.parsed_decorators, Attribute.parsed_decorators, Attribute.parsed_value. Fixes links in presentation of these components.
pydoctor/epydoc2stan.py
Outdated
Fixing "Lookup of name in annotation fails on reparented object #295". | ||
The fix is not 100% complete at the moment: attribute values and decorators | ||
are not handled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing "Lookup of name in annotation fails on reparented object #295". | |
The fix is not 100% complete at the moment: attribute values and decorators | |
are not handled. | |
Fixing "Lookup of name in annotation fails on reparented object #295". |
pydoctor/epydoc2stan.py
Outdated
if ob.parsed_docstring: | ||
_apply_reference_transform(ob.parsed_docstring, ob) | ||
for f in ob.parsed_docstring.fields: | ||
_apply_reference_transform(f.body(), ob) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're not using ensure_parsed_docstring
, we might miss some docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling ensure_parsed_docstring at this stage of the processing can have unintended side effects related to the docformat handling. More specifically, if a docformat is specified in a __docformat__
variable in a parent package tht has not been processed yet at the time we call ensure_parsed_docstring, then it will be parsed with the system's docformat instead. While this is a very niche bug, it's still a bug that should be considered.
f'{self.description}:{linenumber}: {descr}', | ||
thresh=thresh) | ||
# some warnings can be reported more that once. | ||
thresh=thresh, once=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably not change this behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s revert that.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
# transform bare builtin name into builtins.<name> | ||
attribs['refuri'] = '.'.join(('builtins', name, *rest)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is.
This comment has been minimized.
This comment has been minimized.
# some warnings can be reported more that once. | ||
thresh=thresh, once=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# some warnings can be reported more that once. | |
thresh=thresh, once=True) | |
thresh=thresh) |
That PR was wrongly closed |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good, I have still a bit of work to do...
if isinstance(obj, model.Function): | ||
fh.set_param_types_from_annotations(obj.annotations) | ||
fh.set_param_types_from_annotations() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't see why this change is necessary
# Report eventual warnings. It warns when a regex failed to parse. | ||
reportWarnings(obj, doc.warnings, section='colorize constant') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the warnings are now triggered in get_parsed_value
# per title_reference element. | ||
attribs = node.attributes | ||
if target == attribs.get('refuri', target) and 'rawtarget' not in attribs: | ||
is_annotation = node.attributes.get('is_annotation') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_annotation = node.attributes.get('is_annotation') | |
is_annotation = attribs.get('is_annotation') |
# transform bare builtin name into builtins.<name> | ||
attribs['refuri'] = '.'.join(('builtins', name, *rest)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is.
…ing happens in order to be sure we're using the right docformat.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There is something problematic with the diff from pydoctor_primer. I'll try to hack a reproducer... |
This comment has been minimized.
This comment has been minimized.
Diff from pydoctor_primer, showing the effect of this PR on open source code: pycma (https://github.com/CMA-ES/pycma)
- /projects/pycma/cma/boundary_handler.py:15: Cannot find link target for "list"
- /projects/pycma/cma/boundary_handler.py:15: Cannot find link target for "None"
+ /projects/pycma/cma/boundary_handler.py:15: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/boundary_handler.py:15: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/boundary_handler.py:19: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/boundary_handler.py:68: Cannot find link target for "builtins.callable", resolved from "callable" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/boundary_handler.py:71: Cannot find link target for "builtins.callable", resolved from "callable" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/boundary_handler.py:79: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/boundary_handler.py:19: Cannot find link target for "list"
- /projects/pycma/cma/boundary_handler.py:68: Cannot find link target for "callable"
- /projects/pycma/cma/boundary_handler.py:71: Cannot find link target for "callable"
- /projects/pycma/cma/boundary_handler.py:79: Cannot find link target for "None"
- /projects/pycma/cma/boundary_handler.py:79: Cannot find link target for "None"
- /projects/pycma/cma/boundary_handler.py:282: Cannot find link target for "True"
+ /projects/pycma/cma/boundary_handler.py:282: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/boundary_handler.py:377: Cannot find link target for "True"
+ /projects/pycma/cma/boundary_handler.py:377: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/boundary_handler.py:303: Cannot find link target for "True"
+ /projects/pycma/cma/boundary_handler.py:303: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/boundary_handler.py:502: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/boundary_handler.py:303: Cannot find link target for "True"
- /projects/pycma/cma/boundary_handler.py:303: Cannot find link target for "x"
- /projects/pycma/cma/boundary_handler.py:502: Cannot find link target for "None"
- /projects/pycma/cma/boundary_handler.py:502: Cannot find link target for "None"
+ /projects/pycma/cma/boundary_handler.py:576: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/boundary_handler.py:578: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/boundary_handler.py:624: Cannot find link target for "x"
- /projects/pycma/cma/boundary_handler.py:576: Cannot find link target for "None"
- /projects/pycma/cma/boundary_handler.py:576: Cannot find link target for "None"
- /projects/pycma/cma/boundary_handler.py:578: Cannot find link target for "list"
- /projects/pycma/cma/constraints_handler.py:136: Cannot find link target for "list"
+ /projects/pycma/cma/constraints_handler.py:136: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:556: Cannot find link target for "list"
- /projects/pycma/cma/constraints_handler.py:589: Cannot find link target for "True"
- /projects/pycma/cma/constraints_handler.py:613: Cannot find link target for "True"
- /projects/pycma/cma/constraints_handler.py:613: Cannot find link target for "False"
- /projects/pycma/cma/constraints_handler.py:646: Cannot find link target for "True"
- /projects/pycma/cma/constraints_handler.py:646: Cannot find link target for "False"
- /projects/pycma/cma/constraints_handler.py:583: Cannot find link target for "True"
- /projects/pycma/cma/constraints_handler.py:595: Cannot find link target for "True"
- /projects/pycma/cma/constraints_handler.py:595: Cannot find link target for "False"
- /projects/pycma/cma/constraints_handler.py:634: Cannot find link target for "True"
- /projects/pycma/cma/constraints_handler.py:634: Cannot find link target for "False"
- /projects/pycma/cma/constraints_handler.py:395: Cannot find link target for "None"
- /projects/pycma/cma/constraints_handler.py:457: Cannot find link target for "None"
- /projects/pycma/cma/constraints_handler.py:548: Cannot find link target for "True"
+ /projects/pycma/cma/constraints_handler.py:556: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:589: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:613: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:613: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:646: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:646: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:583: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:595: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:595: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:634: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:634: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:395: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:457: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/constraints_handler.py:548: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:434: Cannot find link target for "TypeError"
+ /projects/pycma/cma/constraints_handler.py:434: Cannot find link target for "builtins.TypeError", resolved from "TypeError" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:773: Cannot find link target for "False"
+ /projects/pycma/cma/constraints_handler.py:773: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/constraints_handler.py:822: Cannot find link target for "False"
+ /projects/pycma/cma/constraints_handler.py:822: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/evolution_strategy.py:3933: Cannot find link target for "tuple"
+ /projects/pycma/cma/evolution_strategy.py:3933: Cannot find link target for "builtins.tuple", resolved from "tuple" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:4001: Cannot find link target for "builtins.dict", resolved from "dict" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:4010: Cannot find link target for "builtins.callable", resolved from "callable" (you can link to external docs with --intersphinx)
- /projects/pycma/cma/evolution_strategy.py:4001: Cannot find link target for "dict"
- /projects/pycma/cma/evolution_strategy.py:4001: Cannot find link target for "dict"
- /projects/pycma/cma/evolution_strategy.py:4010: Cannot find link target for "callable"
- /projects/pycma/cma/evolution_strategy.py:4018: Cannot find link target for "list"
- /projects/pycma/cma/evolution_strategy.py:4027: Cannot find link target for "True"
+ /projects/pycma/cma/evolution_strategy.py:4018: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:4027: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:4049: Cannot find link target for "builtins.callable", resolved from "callable" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:4053: Cannot find link target for "builtins.callable", resolved from "callable" (you can link to external docs with --intersphinx)
+ /projects/pycma/cma/evolution_strategy.py:4057: Cannot find link target for "builtins.callable", resolved from "callable" (you can link to external docs with --intersphinx)
... (truncated 303 lines) ...
attrs (https://github.com/python-attrs/attrs)
- /projects/attrs/src/attr/_make.py:390: bad docstring: Inline interpreted text or phrase reference start-string without end-string.
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:50: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:62: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:62: bad docstring: Unknown interpreted text role "term".
- /projects/attrs/src/attr/_next_gen.py:456: bad docstring: No role entry for "term" in module "docutils.parsers.rst.languages.en".
- Trying "term" as canonical role name.
- /projects/attrs/src/attr/_next_gen.py:456: bad docstring: Unknown interpreted text role "term".
+ /projects/attrs/src/attr/_funcs.py:31: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:31: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:41: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:42: Cannot find link target for "builtins.tuple", resolved from "tuple" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:42: Cannot find link target for "builtins.set", resolved from "set" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:42: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:227: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:227: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:236: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:236: Cannot find link target for "builtins.dict", resolved from "dict" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:237: Cannot find link target for "builtins.tuple", resolved from "tuple" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:237: Cannot find link target for "builtins.set", resolved from "set" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_funcs.py:238: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:141: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:1387: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:1394: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:1405: Cannot find link target for "builtins.DeprecationWarning", resolved from "DeprecationWarning" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_funcs.py:31: Cannot find link target for "True"
- /projects/attrs/src/attr/_funcs.py:31: Cannot find link target for "False"
- /projects/attrs/src/attr/_funcs.py:41: Cannot find link target for "list"
- /projects/attrs/src/attr/_funcs.py:42: Cannot find link target for "tuple"
- /projects/attrs/src/attr/_funcs.py:42: Cannot find link target for "set"
- /projects/attrs/src/attr/_funcs.py:42: Cannot find link target for "True"
- /projects/attrs/src/attr/_funcs.py:227: Cannot find link target for "True"
- /projects/attrs/src/attr/_funcs.py:227: Cannot find link target for "False"
- /projects/attrs/src/attr/_funcs.py:236: Cannot find link target for "list"
- /projects/attrs/src/attr/_funcs.py:236: Cannot find link target for "dict"
- /projects/attrs/src/attr/_funcs.py:237: Cannot find link target for "tuple"
- /projects/attrs/src/attr/_funcs.py:236: Cannot find link target for "dict"
- /projects/attrs/src/attr/_funcs.py:237: Cannot find link target for "set"
- /projects/attrs/src/attr/_funcs.py:238: Cannot find link target for "True"
- /projects/attrs/src/attr/_make.py:141: Cannot find link target for "None"
- /projects/attrs/src/attr/_make.py:1387: Cannot find link target for "None"
- /projects/attrs/src/attr/_make.py:1394: Cannot find link target for "None"
- /projects/attrs/src/attr/_make.py:1405: Cannot find link target for "DeprecationWarning"
- /projects/attrs/src/attr/_cmp.py:50: Cannot find link target for "True"
- /projects/attrs/src/attr/_cmp.py:51: Cannot find link target for "NotImplemented"
+ /projects/attrs/src/attr/_cmp.py:50: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_cmp.py:51: Cannot find link target for "builtins.NotImplemented", resolved from "NotImplemented" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:54: Cannot find link target for "object.__init_subclass__" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_next_gen.py:54: Cannot find link target for "builtins.object.__init_subclass__", resolved from "object.__init_subclass__" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:80: Cannot find link target for "True"
- /projects/attrs/src/attr/_next_gen.py:80: Cannot find link target for "False"
- /projects/attrs/src/attr/_next_gen.py:84: Cannot find link target for "BaseException"
- /projects/attrs/src/attr/_next_gen.py:104: Cannot find link target for "setattr"
+ /projects/attrs/src/attr/_next_gen.py:80: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_next_gen.py:80: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_next_gen.py:84: Cannot find link target for "builtins.BaseException", resolved from "BaseException" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_next_gen.py:104: Cannot find link target for "builtins.setattr", resolved from "setattr" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:132: Cannot find link target for "Exception"
+ /projects/attrs/src/attr/_next_gen.py:132: Cannot find link target for "builtins.Exception", resolved from "Exception" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:151: Cannot find link target for "None"
+ /projects/attrs/src/attr/_next_gen.py:151: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:165: Cannot find link target for "object"
+ /projects/attrs/src/attr/_next_gen.py:165: Cannot find link target for "builtins.object", resolved from "object" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:177: Cannot find link target for "object.__hash__" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_next_gen.py:177: Cannot find link target for "builtins.object.__hash__", resolved from "object.__hash__" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:313: Cannot find link target for "None"
+ /projects/attrs/src/attr/_next_gen.py:313: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:346: Cannot find link target for "True"
- /projects/attrs/src/attr/_next_gen.py:349: Cannot find link target for "False"
+ /projects/attrs/src/attr/_next_gen.py:346: Cannot find link target for "builtins.True", resolved from "True" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_next_gen.py:349: Cannot find link target for "builtins.False", resolved from "False" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:474: Cannot find link target for "TypeError"
+ /projects/attrs/src/attr/_next_gen.py:474: Cannot find link target for "builtins.TypeError", resolved from "TypeError" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:490: Cannot find link target for "list"
+ /projects/attrs/src/attr/_next_gen.py:490: Cannot find link target for "builtins.list", resolved from "list" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_next_gen.py:582: Cannot find link target for "setattr"
+ /projects/attrs/src/attr/_next_gen.py:582: Cannot find link target for "builtins.setattr", resolved from "setattr" (you can link to external docs with --intersphinx)
- /projects/attrs/src/attr/_make.py:64: Cannot find link target for "None"
- /projects/attrs/src/attr/_make.py:95: Cannot find link target for "None"
+ /projects/attrs/src/attr/_make.py:64: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
+ /projects/attrs/src/attr/_make.py:95: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
... (truncated 78 lines) ...
astroid (https://github.com/pylint-dev/astroid)
- /projects/astroid/astroid/brain/brain_builtin_inference.py:738: Cannot find link target for "issubclass"
+ /projects/astroid/astroid/brain/brain_builtin_inference.py:738: Cannot find link target for "builtins.issubclass", resolved from "issubclass" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/brain/brain_builtin_inference.py:740: Cannot find link target for "issubclass"
+ /projects/astroid/astroid/brain/brain_builtin_inference.py:740: Cannot find link target for "builtins.issubclass", resolved from "issubclass" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/brain/brain_builtin_inference.py:613: Cannot find link target for "property"
- /projects/astroid/astroid/brain/brain_builtin_inference.py:615: Cannot find link target for "property"
- /projects/astroid/astroid/brain/brain_builtin_inference.py:682: Cannot find link target for "slice"
+ /projects/astroid/astroid/brain/brain_builtin_inference.py:613: Cannot find link target for "builtins.property", resolved from "property" (you can link to external docs with --intersphinx)
+ /projects/astroid/astroid/brain/brain_builtin_inference.py:615: Cannot find link target for "builtins.property", resolved from "property" (you can link to external docs with --intersphinx)
+ /projects/astroid/astroid/brain/brain_builtin_inference.py:682: Cannot find link target for "builtins.slice", resolved from "slice" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/brain/brain_namedtuple_enum.py:576: Cannot find link target for "type"
+ /projects/astroid/astroid/brain/brain_namedtuple_enum.py:576: Cannot find link target for "builtins.type", resolved from "type" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/manager.py:413: Cannot find link target for "hook"
- /projects/astroid/astroid/manager.py:415: Cannot find link target for "astroid.nodes.Module", resolved from "astroid.Module"
- /projects/astroid/astroid/nodes/_base_nodes.py:141: Cannot find link target for "tuple"
+ /projects/astroid/astroid/nodes/_base_nodes.py:141: Cannot find link target for "builtins.tuple", resolved from "tuple" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/nodes/node_classes.py:3170: Cannot find link target for "tuple"
+ /projects/astroid/astroid/nodes/node_classes.py:3170: Cannot find link target for "builtins.tuple", resolved from "tuple" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/nodes/node_classes.py:2831: Cannot find link target for "tuple"
+ /projects/astroid/astroid/nodes/node_classes.py:2831: Cannot find link target for "builtins.tuple", resolved from "tuple" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/nodes/node_classes.py:3457: Cannot find link target for "NotImplementedError"
- /projects/astroid/astroid/nodes/node_classes.py:3459: Cannot find link target for "NotImplementedError"
+ /projects/astroid/astroid/nodes/node_classes.py:3457: Cannot find link target for "builtins.NotImplementedError", resolved from "NotImplementedError" (you can link to external docs with --intersphinx)
+ /projects/astroid/astroid/nodes/node_classes.py:3459: Cannot find link target for "builtins.NotImplementedError", resolved from "NotImplementedError" (you can link to external docs with --intersphinx)
- /projects/astroid/astroid/protocols.py:48: Cannot find link target for "NotImplemented"
+ /projects/astroid/astroid/protocols.py:48: Cannot find link target for "builtins.NotImplemented", resolved from "NotImplemented" (you can link to external docs with --intersphinx)
- astroid.nodes.Dict._update_with_replacement
- astroid.nodes.NodeNG.infer
- astroid.nodes.NodeNG.inferred
+ astroid.nodes.node_classes.Dict._update_with_replacement
+ astroid.nodes.node_ng.NodeNG.infer
+ astroid.nodes.node_ng.NodeNG.inferred
pylint (https://github.com/pylint-dev/pylint)
- /projects/pylint/pylint/pyreverse/utils.py:239: bad docstring: Inline emphasis start-string without end-string.
- /projects/pylint/pylint/checkers/base/basic_checker.py:824: Cannot find link target for "reversed"
+ /projects/pylint/pylint/checkers/base/basic_checker.py:824: Cannot find link target for "builtins.reversed", resolved from "reversed" (you can link to external docs with --intersphinx)
+ /projects/pylint/pylint/checkers/classes/class_checker.py:451: Cannot find link target for "builtins.property", resolved from "property" (you can link to external docs with --intersphinx)
- /projects/pylint/pylint/checkers/classes/class_checker.py:451: Cannot find link target for "property"
- /projects/pylint/pylint/checkers/classes/class_checker.py:451: Cannot find link target for "property"
- /projects/pylint/pylint/checkers/classes/class_checker.py:451: Cannot find link target for "property"
- /projects/pylint/pylint/checkers/exceptions.py:361: Cannot find link target for "None"
+ /projects/pylint/pylint/checkers/exceptions.py:361: Cannot find link target for "builtins.None", resolved from "None" (you can link to external docs with --intersphinx)
- /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:353: Cannot find link target for "all"
- /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:353: Cannot find link target for "any"
- /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:354: Cannot find link target for "filter"
- /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:355: Cannot find link target for "bool"
+ /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:353: Cannot find link target for "builtins.all", resolved from "all" (you can link to external docs with --intersphinx)
+ /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:353: Cannot find link target for "builtins.any", resolved from "any" (you can link to external docs with --intersphinx)
+ /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:354: Cannot find link target for "builtins.filter", resolved from "filter" (you can link to external docs with --intersphinx)
+ /projects/pylint/pylint/checkers/refactoring/implicit_booleaness_checker.py:355: Cannot find link target for "builtins.bool", resolved from "bool" (you can link to external docs with --intersphinx)
- /projects/pylint/pylint/checkers/refactoring/refactoring_checker.py:1229: Cannot find link target for "nodes.Call" (you can link to external docs with --intersphinx)
+ /projects/pylint/pylint/checkers/refactoring/refactoring_checker.py:1229: Cannot find link target for "astroid.nodes.Call", resolved from "nodes.Call" (you can link to external docs with --intersphinx)
- /projects/pylint/pylint/checkers/refactoring/refactoring_checker.py:2429: Cannot find link target for "enumerate"
+ /projects/pylint/pylint/checkers/refactoring/refactoring_checker.py:2429: Cannot find link target for "builtins.enumerate", resolved from "enumerate" (you can link to external docs with --intersphinx)
- /projects/pylint/pylint/checkers/typecheck.py:2026: Cannot find link target for "type"
+ /projects/pylint/pylint/checkers/typecheck.py:2026: Cannot find link target for "builtins.type", resolved from "type" (you can link to external docs with --intersphinx)
- /projects/pylint/pylint/checkers/utils.py:2330: Cannot find link target for "True"
+ /projects/pylint/pylint/checkers/utils.py:2330: Cannot find link target for "pylint.checkers.utils.builtins.True", resolved from "True"
- /projects/pylint/pylint/checkers/utils.py:673: Cannot find link target for "None"
+ /projects/pylint/pylint/checkers/utils.py:673: Cannot find link target for "pylint.checkers.utils.builtins.None", resolved from "None"
- /projects/pylint/pylint/checkers/deprecated.py:190: Cannot find link target for "arg2"
- /projects/pylint/pylint/checkers/deprecated.py:190: Cannot find link target for "arg4"
- /projects/pylint/pylint/checkers/deprecated.py:103: Cannot find link target for "nodes.Call" (you can link to external docs with --intersphinx)
+ /projects/pylint/pylint/checkers/deprecated.py:103: Cannot find link target for "astroid.nodes.Call", resolved from "nodes.Call" (you can link to external docs with --intersphinx)
- these 29 objects' docstrings contain syntax errors:
+ these 30 objects' docstrings contain syntax errors:
- pylint.checkers.BaseChecker.check_consistency
+ pylint.checkers.base_checker.BaseChecker.check_consistency
+ pylint.checkers.deprecated.DeprecatedMixin.deprecated_arguments
- pylint.checkers.refactoring.RefactoringChecker._apply_boolean_simplification_rules
+ pylint.checkers.refactoring.refactoring_checker.RefactoringChecker._apply_boolean_simplification_rules
- pylint.checkers.refactoring.RefactoringChecker._check_consider_using_join
+ pylint.checkers.refactoring.refactoring_checker.RefactoringChecker._check_consider_using_join
- pylint.lint.PyLinter._check_file
+ pylint.lint.pylinter.PyLinter._check_file
- pylint.lint.PyLinter._lint_file
+ pylint.lint.pylinter.PyLinter._lint_file
- pylint.lint.PyLinter.load_plugin_configuration
+ pylint.lint.pylinter.PyLinter.load_plugin_configuration
- pylint.testutils._get_tests_info
+ pylint.testutils.get_test_info._get_tests_info
coco (https://github.com/numbbo/coco)
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- /projects/coco/code-postprocessing/cocopp/findfiles.py:8: bad docstring: Unknown interpreted text role "file".
- /projects/coco/code-postprocessing/cocopp/findfiles.py:56: bad docstring: No role entry for "file" in module "docutils.parsers.rst.languages.en".
- Trying "file" as canonical role name.
- /projects/coco/code-postprocessing/cocopp/findfiles.py:56: bad docstring: Unknown interpreted text role "file".
... (truncated 663 lines) ...``` |
Fixes #295.
We're running a docutils transformer on the parsed docstrings to resolve locally existing names early, it sets a
refuri
attribute on reference nodes. This means all parsed docstrings must be cached as a Documentable attribute: so I’ve create a little memoize function for that. The transform is ran at the time we're leaving the module (but it should run in post-processing when something like #724 is merged - that moves the reparenting to the post processing step).The linker also got updated to be able to link to an object with it's outdated (before reparenting) fullname, which could be what we stored in the
refuri
attribute earlier by our transformer.There are a couple of blind spot:
decorator, attribute values and function annotations within the parameter table do not have theirparsed_*
attribute to storeParsedDocstring
instance, so no transformation is possible at the moment. These ParsedDocstring are create at the time of the stan generation, it's worthless to apply the transformation at this step of processing since we already loose the original code model structure. So we really need to have the ParsedDocstring stored in Documentable attributes.names that are both defined in a class level and at the module level will not be expanded because of ambiguity. Basically that would require to mimic the logic implemented in Fix name resolving issues #663 into the._ReferenceTransform
we loose the formatting detail of the reference, we don't know anymore at the time of resolving the link if the developer wrote.L{split}
orL{split <os.path.split>}
links to builtins are broken in reparented class inside a module that shadows some of the builtinsparsed_docstring
attribute set at the time we're transforming links, because the docstring can come from inherited members. To fix this situation all the reparenting should be taking place in post-processing (Rework reparenting and allobjects attribute #725) and link transformation as well (after MRO computing and before reparenting).This PR does not cover all improvements cited in #295. Especially a new issue should be created to actually separate our code model VS our view model. The view model would be initiated in post-processing. The separation between the two models could firstly be done with
Protocol
classes (so we keep a unique structure at first) defining all required attributes byastbuilder
andtemplatewriter
. Classes that would be used to annotateDocumentable
to restrict the attributes that can be accessed. Then we could look at creating two sets of concrete classes.The main challenge of that operation (and probably the reason it has not been done a long time ago) is that the code model is strongly couple with the docstring parsing. Namely:
@ivar
-like fields which creates model instance withparsed_docstring
attribute already populated.Function.signature
attribute which stores ast values as ParsedDocstring in _ValueFormatter.parsed_docstring
attribute already populated.The main goal being not perform docstring parsing until we have the final state for all objects.