fix(core): catch less common that comparisons#3763
Open
terminalchai wants to merge 1 commit into
Open
Conversation
Collaborator
|
I'm pretty sure this is going to have false positives along the lines of:
|
581d299 to
0516606
Compare
Author
|
Good catch, thanks. I narrowed this so the new branch only matches the digit-bearing comparison target at the end of the chunk/sentence, with optional trailing punctuation. That keeps the reported I added your example as a no-lint regression test and reran:
|
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.
AI/agent assistance was used to prepare this patch.
This fixes #3736 by extending the existing
ThatThanlinter to catch the reportedless common that mp3comparison shape without enabling the broadermore/less adjective thatpattern that already has known false positives.The matcher now supports the existing comparative-adjective pattern and a constrained
more/less common that <token containing a digit>pattern. I also updatedmatch_to_lintto locate the matchedthattoken dynamically, then added true-positive tests for the reported MP3 comparison and false-positive tests for validless/more common that ...clauses.Verification:
cargo test -p harper-core that_than -- --nocapturecargo run -p harper-cli -- lint "This format is way less common that mp3."cargo run -p harper-cli -- lint "It is less common that people configure this manually."cargo fmt -- harper-core\src\linting\that_than.rsgit diff --check