-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
False positive for "--enable default-role" in 0.6.2 #46
Comments
Same thing happened in the CPython docs in python/cpython#97962 ; the new regex generated over 18 000 false positives and at least in my spot checks, appeared to match on most if not all double backtick inline string literals. |
I tested this on the "friends projects" and got: $ # with an older version of sphinx-lint
$ sphinx-lint tests/fixtures/friends/ --enable=default-role | wc -l
598
$ # with the latest version
$ sphinx-lint tests/fixtures/friends/ --enable=default-role | wc -l
33604
$ sphinx-lint tests/fixtures/friends/cpython/ --enable=default-role | wc -l
18086
$ sphinx-lint tests/fixtures/friends/devguide/ --enable=default-role | wc -l
865
$ # no issues without --enable=default-role
$ sphinx-lint tests/fixtures/friends/
No problems found. |
Oops. |
I just published v0.6.3 with a fix for this:
|
@CAM-Gerlach The 0.6.3 version finds 83 default-role (the few of them I checked were true positives) in cpython, I'll try to fix them later. |
Please keep this issue open until we find a proper way to check friend repositories with the right flags (I mean in ( |
This is a false positive: $ echo '`issue tracker`_ and submit a :ref:`pull request <pullrequest>`' > buggy.rst
$ sphinx-lint --enable=default-role buggy.rst
buggy.rst:1: default role used (hint: for inline literals, use double backticks) (default-role)
$ echo '`tracker`_ and submit a :ref:`pull request <pullrequest>`' > buggy.rst
$ sphinx-lint --enable=default-role buggy.rst
buggy.rst:1: default role used (hint: for inline literals, use double backticks) (default-role)
$ echo '`tracker`_ and submit a :ref:`pull`' > buggy.rst
$ sphinx-lint --enable=default-role buggy.rst
buggy.rst:1: default role used (hint: for inline literals, use double backticks) (default-role)
$ echo '`issue tracker`_ and submit a' > buggy.rst
$ sphinx-lint --enable=default-role buggy.rst
No problems found.
$ echo 'and submit a :ref:`pull request <pullrequest>`' > buggy.rst
$ sphinx-lint --enable=default-role buggy.rst
No problems found. It fails when a |
Another one: $ cat buggy.rst
Instead, these security concerns should be gathered into a dedicated
"Security Considerations" section within the module's documentation, and
cross-referenced from the documentation of affected interfaces with a note
similar to ``"Please refer to the :ref:`security-considerations` section
for important information on how to avoid common mistakes."``.
Similarly, if there is a common error that affects many interfaces in a
$ sphinx-lint --enable=default-role buggy.rst
buggy.rst:4: default role used (hint: for inline literals, use double backticks) (default-role)
$ echo 'A ref in a literal looks like: ``foo :ref:`bar` baz``.' > buggy.rst
$ sphinx-lint --enable=default-role buggy.rst
No problems found. The issue seem to be related to the multiline literal that contains a pair of |
A false positive multiline with ellipsis: :class:`subprocess.Popen` destructor now emits a :exc:`ResourceWarning` warning
if the child process is still running. Use the context manager protocol (``with
proc: ...``) or explicitly call the :meth:`~subprocess.Popen.wait` method to
read the exit status of the child process. (Contributed by Victor Stinner in
:issue:`26741`.)
And multiline without ellipsis: A new :data:`~html.entities.html5` dictionary that maps HTML5 named character
references to the equivalent Unicode character(s) (e.g. ``html5['gt;'] ==
'>'``) has been added to the :mod:`html.entities` module. The dictionary is
now also used by :class:`~html.parser.HTMLParser`. (Contributed by Ezio
Melotti in :issue:`11113` and :issue:`15156`.)
|
It's not recognising the * ``-X importtime`` to show how long each import takes. It shows module
name, cumulative time (including nested imports) and self time (excluding
nested imports). Note that its output may be broken in multi-threaded
application. Typical usage is ``python3 -X importtime -c 'import
asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`. 1.rst:5: default role used (hint: for inline literals, use double backticks) (default-role) For example, no complaints about this: * ``-X importtime`` to show how long each import takes. It shows module
name, cumulative time (including nested imports) and self time (excluding
nested imports). Note that its output may be broken in multi-threaded
application. Typical usage is python3 -X importtime -c 'import
asyncio'. See also :envvar:`PYTHONPROFILEIMPORTTIME`. (As it happens, PyCharm has a similar bug) |
Wow thanks all for your examples! I just released v0.6.4 that should fix all of them, can you try it? |
A clean run on the PEP repo comes back green ✔️ FWIW, maybe a little too late now, but the pre-commit pygrep check uses |
All good with 0.6.4 and 0.6.5! Thanks for the quick fixes and releases! |
$ cat buggy.rst
.. this is a comment
this is not a `default role`
$ sphinx-lint --enable=default-role buggy.rst
buggy.rst:2: default role used (hint: for inline literals, use double backticks) (default-role) |
Thanks for your hard work at short notice, @JulienPalard @ezio-melotti and @hugovk . |
Just to note, I can confirm that #34 (false positive when last character inside a verbatim is `:`` is still present and reproducible on the PEPs repo with Sphinx-Lint 0.6.5, so we still can't enable this flag for now, unfortunately. |
I'm closing this issue as I think all reported false positives are now fixed, don't hesitate to report new ones as new issues. We were having a script to fetch "friend repos" (cpython, sphinx, ...) to test them before relasing to avoid this exact issue, but it was just testing with the default flags, not with |
The few of these checked look fine though:
https://github.com/python/devguide/blame/main/getting-started/setup-building.rst#L28
``Tools`` Various tools that are (or have been) used to maintain Python.
https://github.com/python/devguide/blame/main/getting-started/setup-building.rst#L604
The text was updated successfully, but these errors were encountered: