PEP 12: Update guidance on linking PEPs/RFCs per recent changes, and add check for it#2291
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #2209 , @AA-Turner removed the legacy implicit PEP/RFC link logic, and batch-converted existing PEPs to use explicit
:pep:and:rfc::roles to reference other PEPs and RFCs, rather than relying on hacky, fragile and limited implicit links, or hardcoding URLs (often in footnotes). However, PEP 12 has not been updated accordingly to reflect this, still containing a substantial quantity of outdated language on this point.Therefore, it was updated to update these now-misleading descriptions and examples, describe the new practice and explain and give examples of its use. This also, as a necessary side effect, addresses the most straightforward and obvious aspects of #2130 , though I will address the remaining parts of it not directly concerned with PEP/RFC links and footnotes thereof in another separate PR immediately after this one is merged, to keep things focused here.
Furthermore, some users may still be tempted to do the latter, whether due to the limitations of GitHub's rendered previews (as saw in #2282 ), or simply being unaware of the role's existence. Ensuring we always reference PEPs with the appropriate roles rather than hard links is simpler, more concise and more reliable, ensures they are formatted correctly and (with the new build system proposed in PEP-0676) allows us to do things like automatically including the PEP title in the link titletext, as users have requested.
Therefore, as originally prompted by @AA-Turner 's suggestion on #2282 , this PR adds a cheap Pre-Commit pygrep check for direct hardcoded URLs to other PEPs and RFCs. This avoids regressions in future PEPs (and spot-fixes the couple remaining instances not caught by that PR) and allowing authors and reviewers to easily spot where this occurs and replace it with the simpler, more concise, more reliable and more functional roles.
As a historical note, these changes were originally included in #2286 , but @AA-Turner and @JelleZijlstra wisely suggested splitting them out, as they deserved to be addressed separately.
:pep:and:rfc:roles in PEP 12, and update/remove outdated references section content