Repository navigation
Skip decorator/pragma lines in function intent extraction (#3115) - #3150
Merged
Merged
Conversation
A PL/I function whose file began with a `%PROCESS` compiler-option directive rendered `Intent: %PROCESS SOURCE RULES(LAXIF);` in the section-8 Core Function Hitlist. `_extract_documentation_tether`'s "Harvest Above" scan treats a leading `%` as a comment prefix (correct for MATLAB/Erlang), so it swept the PL/I pragma in as prose intent. Fix: before treating a harvested line as a comment, skip it if it matches the active language's own `decorators` rule (reusing pli.py's existing `%PROCESS`/`*PROCESS`/`OPTIONS(` pattern rather than duplicating it). A pragma line is stepped over, so a genuine doc-comment above it is still captured, and the pragma never becomes the intent. Generalizes safely: only fires for languages that define a `decorators` rule. Verified: new test asserts a `%PROCESS` line is not used as intent while a real prose comment still is; the full tests/extraction/languages suite passes (8249 passed, no cross-language regression); detector.py ruff identical to baseline and no new mypy errors. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #3115.
Problem
Scanning IBM's zopeneditor-sample,
PSAM2(PLI/PSAM2.pli) renderedIntent: %PROCESS SOURCE RULES(LAXIF);in section 8 (Core Function Hitlist). The file's first line is a%PROCESScompiler-option directive._extract_documentation_tether's "Harvest Above" scan treats a leading%as a comment prefix (correct for MATLAB/Erlang), so it swept the PL/I pragma in as the function's prose intent.Fix
Before treating a harvested line as a comment, skip it if it matches the active language's own
decoratorsrule — reusing pli.py's existing%PROCESS/*PROCESS/OPTIONS(pattern rather than duplicating it. The pragma is stepped over (so a genuine doc-comment above it is still captured) and never becomes the intent. Only fires for languages that define adecoratorsrule.Verification
%PROCESSline is not used as intent, and a real prose doc-comment still is (including the case where the comment sits above the pragma).tests/extraction/languagessuite passes — 8249 passed, 3 skipped, 8 xfailed.detector.pyruff identical to baseline; no new mypy errors.