-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Dangling hyphens in many PEPs #3028
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
Comments
Reading through this issue, the linked issue in I manually verified
I didn't go through the rest of the PEPs listed in your original post here, but I expect there is probably some inconsistencies with those as well. I'm still investigating and I'll try going through the raw text (the "source code" for these examples) and see what I can find there when I get the chance, but I'm adding what I've found so far in case this might help someone else identify the problem sooner than I can. |
Looking at https://github.com/sphinx-contrib/sphinx-lint/pull/56/files#diff-6001213f99f3fd6caff3790df503e4c40a7ff69166cbdc3d6551ae9e5bdb8d45R452, I think this is the specific usecase the PR was trying to address - so it sometimes works? (Will continue to investigate.) |
We're still using sphinx-lint 0.6.7 in https://github.com/python/peps/blob/main/.pre-commit-config.yaml, would you like to make a PR to update it so we're using sphinx-contrib/sphinx-lint#56? python -m pip install pre-commit
pre-commit autoupdate
pre-commit run --all-files |
This new release includes the changes from https://github.com/sphinx-contrib/sphinx-lint/pull/56/files, which should address python#3028. For details about `sphinx-lint` release 0.6.8, see https://github.com/sphinx-contrib/sphinx-lint/releases/tag/v0.6.8.
* Update `sphinx-lint` package dependency version number → 0.6.8 This new release includes the changes from https://github.com/sphinx-contrib/sphinx-lint/pull/56/files, which should address #3028. For details about `sphinx-lint` release 0.6.8, see https://github.com/sphinx-contrib/sphinx-lint/releases/tag/v0.6.8. * Update other outdated dependencies Run the following: ``` python -m pip install pre-commit pre-commit autoupdate pre-commit run --all-files ```
Thanks for updating to 0.6.8 in #3291. Sphinx-lint doesn't report any errors. Looking again: ❯ git grep -- '[a-z]-$'
pep-0201.txt:already be accomplished in Python through the use of the map() built-
pep-0205.txt:reference containers that must be cleared for each weakly-
pep-0209.txt:This PEP proposes a redesign and re-implementation of the multi-
pep-0209.txt: class or a special array type, depending on your point-of-
pep-0209.txt: arguments are lists of CFuncObjects for those arrays needing pre-
pep-0235.txt:#B is the same rule as is used on Unix, so this will improve cross-
pep-0249.txt: Return ``True`` if the connection is operating in autocommit (non-
pep-0333.txt: requested by the application, or it may pre-
pep-0333.txt:Some operating environments provide special high-performance file-
pep-0344.txt:Several attribute names for chained exceptions have been suggested on Python-
pep-0367.txt:name may simplify implementation, however some are against the actual keyword-
pep-0367.txt:names, in cases where that is needed. One use case this fails is where a base-
pep-0367.txt:both of which needing to properly make super calls to the one in the base-
pep-0374.txt:support setting this information on a per-user basis, and on a per-
pep-0439.txt:issue tracker [2]_. Most notably, the addition of --bootstrap and --bootstrap-
pep-0451.txt:A module's spec will not be kept in sync with the corresponding import-
pep-0451.txt:added in Python 3.3. However, the extra complexity and a less-than-
pep-0465.txt:package on PyPI). Starred lines indicate packages which export array-
pep-0471.txt:on POSIX systems**. So we're not talking about micro-
pep-0479.txt:limitation, but notes that "use cases for these [are] rare to non-
pep-0492.txt:The function applies ``CO_ITERABLE_COROUTINE`` flag to generator-
pep-0492.txt: and having ``__call__`` and no ``__cocall__`` for coroutine-
pep-0492.txt: associated protocol with ``__aiter__``, ``__aexit__`` and new built-
pep-0512.txt:repository [#cpython-repo]_. Because of its importance and high-
pep-0520.txt:namespace be ordered (e.g. ``OrderedDict``) by default. The long-
pep-0520.txt:properly set. That could certainly be handled through specific class-
pep-0554.rst: own subinterpreter may prove quite interesting to reconcile multi-
pep-0615.rst: http://cldr.unicode.org/#TOC-How-to-Use-
pep-3001.txt:with information on possible substitutes or alternatives. This infor-
pep-3101.txt: 'x' - Hex format. Outputs the number in base 16, using lower-
pep-3101.txt: 'X' - Hex format. Outputs the number in base 16, using upper-
pep-3115.txt:assignment algorithm. (Note also that *metaclass* is a keyword-
pep-3124.txt:which the overload is adding support. Thus, overloads are highly-
pep-3135.txt:names, in cases where that is needed. One use case this fails is where a base-
pep-3135.txt:both of which needing to properly make super calls to the one in the base-
pep-3333.txt: requested by the application, or it may pre-
pep-3333.txt:Some operating environments provide special high-performance file- Why doesn't sphinx-lint pick these up? Because they all have We can temporarily make sphinx-lint check diff --git a/sphinxlint/checkers.py b/sphinxlint/checkers.py
index 5354606..3039ebe 100644
--- a/sphinxlint/checkers.py
+++ b/sphinxlint/checkers.py
@@ -461,7 +461,7 @@ def check_bad_dedent(file, lines, options=None):
yield from errors
-@checker(".rst", rst_only=True)
+@checker(".rst", ".txt", rst_only=True)
def check_dangling_hyphen(file, lines, options):
"""Check for lines ending in a hyphen."""
for lno, line in enumerate(lines): Which gives these results to check and potentially fix: ❯ sphinx-lint pep-*.txt | sort
pep-0201.txt:49: Line ends with dangling hyphen (dangling-hyphen)
pep-0205.txt:188: Line ends with dangling hyphen (dangling-hyphen)
pep-0209.txt:131: Line ends with dangling hyphen (dangling-hyphen)
pep-0209.txt:15: Line ends with dangling hyphen (dangling-hyphen)
pep-0209.txt:268: Line ends with dangling hyphen (dangling-hyphen)
pep-0235.txt:128: Line ends with dangling hyphen (dangling-hyphen)
pep-0249.txt:941: Line ends with dangling hyphen (dangling-hyphen)
pep-0333.txt:1344: Line ends with dangling hyphen (dangling-hyphen)
pep-0333.txt:599: Line ends with dangling hyphen (dangling-hyphen)
pep-0344.txt:88: Line ends with dangling hyphen (dangling-hyphen)
pep-0367.txt:125: Line ends with dangling hyphen (dangling-hyphen)
pep-0367.txt:516: Line ends with dangling hyphen (dangling-hyphen)
pep-0367.txt:518: Line ends with dangling hyphen (dangling-hyphen)
pep-0374.txt:277: Line ends with dangling hyphen (dangling-hyphen)
pep-0439.txt:192: Line ends with dangling hyphen (dangling-hyphen)
pep-0451.txt:681: Line ends with dangling hyphen (dangling-hyphen)
pep-0451.txt:719: Line ends with dangling hyphen (dangling-hyphen)
pep-0465.txt:391: Line ends with dangling hyphen (dangling-hyphen)
pep-0471.txt:49: Line ends with dangling hyphen (dangling-hyphen)
pep-0479.txt:60: Line ends with dangling hyphen (dangling-hyphen)
pep-0492.txt:1319: Line ends with dangling hyphen (dangling-hyphen)
pep-0492.txt:176: Line ends with dangling hyphen (dangling-hyphen)
pep-0492.txt:999: Line ends with dangling hyphen (dangling-hyphen)
pep-0512.txt:265: Line ends with dangling hyphen (dangling-hyphen)
pep-0520.txt:188: Line ends with dangling hyphen (dangling-hyphen)
pep-0520.txt:40: Line ends with dangling hyphen (dangling-hyphen)
pep-3001.txt:32: Line ends with dangling hyphen (dangling-hyphen)
pep-3115.txt:140: Line ends with dangling hyphen (dangling-hyphen)
pep-3124.txt:962: Line ends with dangling hyphen (dangling-hyphen)
pep-3135.txt:168: Line ends with dangling hyphen (dangling-hyphen)
pep-3135.txt:170: Line ends with dangling hyphen (dangling-hyphen)
pep-3333.txt:1460: Line ends with dangling hyphen (dangling-hyphen)
pep-3333.txt:679: Line ends with dangling hyphen (dangling-hyphen) |
Just checked one PR at random: #3362 The fix there would have been to delete the hyphen, it is not needed between an adverb and an adjective. |
I tried to take the approach of maintaining the author's original wording, though I agree some cases were questionable over simply deleting the hypen alltogether. A |
All of these probably lead to badly rendered text:
Opened sphinx-contrib/sphinx-lint#54 to have sphinx-lint catch this.
The text was updated successfully, but these errors were encountered: