fix(linting): add attributive-safe adjective exclusion for MissingPreposition#3683
Open
jlaportebot wants to merge 2 commits into
Open
Conversation
…position - Add ATTRIBUTIVE_SAFE_ADJECTIVES constant with 29 common superlatives and attributive-only adjectives (best, worst, closest, dearest, etc.) - Add is_attributive_safe() helper for case-insensitive matching - Skip MissingPreposition lint when adjective is in safe list - Add test allows_best_friends() covering 7 cases Fixes false positives like "We were best friends" and "They are closest friends".
- Replace fixed index lookup with dynamic search for UPOS::ADJ token - Handles variable whitespace token inclusion in matched_tokens - Fixes test failure for 'allows_best_friends'
Contributor
Author
|
All CI checks passing. PR ready for merge queue. |
Collaborator
Please use our PR template as the AI-related fields in it are important to us. |
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.
Summary
ATTRIBUTIVE_SAFE_ADJECTIVESconstant with 29 common superlatives and attributive-only adjectives (best, worst, closest, dearest, etc.)is_attributive_safe()helper for case-insensitive matchingMissingPrepositionlint when adjective is in safe listallows_best_friends()covering 7 casesProblem
The
MissingPrepositionlint was incorrectly flagging phrases like:These use adjectives that can function attributively (directly modifying a noun) without requiring a preposition.
Solution
Maintain a list of known attributive-safe adjectives and check against it before emitting the lint. This is a targeted fix that avoids false positives while preserving the lint's ability to catch genuine missing prepositions.
Testing
Added comprehensive test case covering all 7 example phrases from the issue.