Skip to content

feat: barely unusable → barely usable etc.#3774

Open
hippietrail wants to merge 3 commits into
Automattic:masterfrom
hippietrail:barely-unusable
Open

feat: barely unusable → barely usable etc.#3774
hippietrail wants to merge 3 commits into
Automattic:masterfrom
hippietrail:barely-unusable

Conversation

@hippietrail

Copy link
Copy Markdown
Collaborator

Issues

N/A

Description

Somewhere yesterday I read where somebody wrote "barely un-adjective", I think "barely unusable".

My guess is this is a kind of overthinking mistake made by native speakers, it's very similar to a double negative and/or to an oxymoron. As if the writer is not sure whether to use "barely" or use the "un-" prefix and end up using both. It could be nonnative speakers with a poor understanding of how "barely" works. But from the examples I found they look more typical of native speaker errors to me.

I went with the Miscellaneous LintKind as that's what the Oxymorons linter uses, which is pretty close to this one.

This linter can be a good example for anyone that wants to incorporate a dictionary check in the "pattern" side of their linter rather than the match_to_lint side. Closing with Lrc is needed. I'd like @elijah-potter to double-check that logic too please.

It also includes a new strip_prefix_ignore_ascii_case_chars() method on &[char]. This is a method I've learned is quite valuable on strings and slices generally, but the ones in the standard library are not case insensitive and would require conversion/allocation with .to_lowercase()

The dictionary is used to check that the word is an uninflected adjective both before and after removing the prefix, thus not blindly permitting uniquenique. But there could be more subtle false positives where the result of stripping the prefix is still an adjective, but not the opposite of the original. I couldn't think of any.

For now it only tackles the un- prefix, but could be extended to support im-, in-, de-, dis- - but some of those might involve more subtleties.

Running the fuzzer on this would be appreciated!

How Has This Been Tested?

cargo test

AI Disclosure

  • I am a human and didn't use any AI.
  • I used LLM features of my editor, but not an agent.
  • I used an AI agent interactively.
  • I am an agent or I got an agent to do the work autonomously.

I asked Google Search AI for tips on getting the dictionary code in the pattern side working, and again to get my final working versions more rusty/more functional style.

If Your PR Implements or Enhances a Linter

  • I made up the sentences in the unit tests.
  • The sentences in the unit tests were generated by an AI.
  • I'm using examples from the bug report / feature request.
  • I collected real-world sentences for the unit tests.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have considered splitting this into smaller pull requests.

Includes a new `strip_prefix_ignore_ascii_case_chars()` method on `&[char]`
@hippietrail hippietrail requested a review from elijah-potter July 6, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant