harper icon indicating copy to clipboard operation
harper copied to clipboard

False positive: Sentence capitalization of sentence in brackets

Open chrisgrieser opened this issue 11 months ago • 5 comments

What got flagged?

I like pizza. (Well, food is nice.)

The word "food" with This sentence does not start with a capital letter Harper: SentenceCapitalization

Why is this incorrect? The sentence is correct.


Removing the brackets, the word "food" is not falsely flagged anymore.

chrisgrieser avatar Dec 27 '25 10:12 chrisgrieser

Another example:

A timestamp formatted as `HH:MM:SS` is needed. (For millisecond-precision, use `.timeLog()` instead)

Here use is flagged SentenceCapitalization as well.

chrisgrieser avatar Dec 28 '25 11:12 chrisgrieser

Thanks for these! It would be more immediately obvious what it's doing wrong if you could include an image of the wrong lint as well as the text.

hippietrail avatar Dec 28 '25 14:12 hippietrail

I assumed most people prefer the raw text for reproduction, but sure, I can of course also share screenshots for quicker scanning what's going on:

Image

chrisgrieser avatar Dec 28 '25 14:12 chrisgrieser

I assumed most people prefer the raw text for reproduction, but sure, I can of course also share screenshots for quicker scanning what's going on:

The raw text is definitely best for reproducing but it's not the most illustrative. I've been trying to train myself to include both in my reports. In any case that is really weird!

hippietrail avatar Dec 28 '25 17:12 hippietrail

A temporary workaround for this would be to disable IsolateEnglish.

This bug happens because IsolateEnglish strips out the (Well, chunk, which causes Harper to see the sentence as:

I like pizza. food is nice.)

hence the incorrect capitalization lint.


I tried taking a crack at this, but there doesn't seem to be a straight-forward solution. IsolateEnglish removes this chunk because it considers it to be code. However, I don't think there is enough context in a chunk like (Well, to confidently say whether it's code or not. Iterating on sentences instead of chunks seems intuitive at first, but it breaks some of the cases IsolateEnglish wants to support. Which leads me to think that IsolateEnglish needs to iterate on tokens instead and do its own chunking as it sees fit, which is no easy feat.

86xsk avatar Jan 03 '26 01:01 86xsk