Skip to content

fix(lint): add 'side' to ignore list for effect/affect rule (fix issue #2958)#2983

Open
estefafdez wants to merge 2 commits intoAutomattic:masterfrom
estefafdez:issue_2958
Open

fix(lint): add 'side' to ignore list for effect/affect rule (fix issue #2958)#2983
estefafdez wants to merge 2 commits intoAutomattic:masterfrom
estefafdez:issue_2958

Conversation

@estefafdez
Copy link
Contributor

Issues

Fixes #2958

Description

The EffectToAffect lint rule was incorrectly suggesting "side affect" instead of leaving "side effect" unchanged.

"Side" is POS-tagged as NOUN, which matched the rule's preceding context check and caused "effect" to be flagged as a verb form needing correction. The fix adds "side" to the existing list of words that suppress the lint (alongside "take", "takes", etc.), since "side effect" is always a compound noun.

Changes:

  • harper-core/src/linting/noun_verb_confusion/effect_affect/effect_to_affect.rs: added "side" to the preceding-word exclusion list
  • harper-core/src/linting/noun_verb_confusion/mod.rs: added a regression test using the exact example from the issue

Demo

Before: "I forgot to test the side effect that users are deleted when clearing data." → Harper suggests changing "effect" to "affect" ❌

After: no lint triggered ✅

How Has This Been Tested?

Added a unit test no_change_side_effect in mod.rs that asserts 0 lints are produced for the sentence from the issue report.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

Add 'side' as an exception to prevent false positive for the common term "side effect" in the noun-verb confusion lint rule. Also adds a test case to verify the fix.
@hippietrail
Copy link
Collaborator

Hey thanks for the PR! I would say this one needs a bunch of tests since "side effect" and "side affect" are both legit English (same with "side effects" and "side affects"). Let me do a quick Google to find some examples where "affect(s)" is correct:

  • Should marker-side affect 'direction' computation?
  • I am still not clear how padding side affects the results, both in training and inference.
  • Would an unfreed reference in the js side affect the blazor side somehow, or would blazor automatically free the js module?
  • I guess it may be that the loading of other add-ins in your side affect the performance of your current add-in's CF.
  • Move that to the top level so you don't need to worry about what side affects the import machinery

It is at least 10x more common as a mistake, but it's too common to be marginal as legit usage. Some are even ambiguous.

Sorry I haven't looked at the PR yet so apologies if this is handled already. I just thought I'd share these thoughts with you quickly.

@estefafdez
Copy link
Contributor Author

Hey thanks for the PR! I would say this one needs a bunch of tests since "side effect" and "side affect" are both legit English (same with "side effects" and "side affects"). Let me do a quick Google to find some examples where "affect(s)" is correct:

* Should marker-side affect 'direction' computation?

* I am still not clear how padding side affects the results, both in training and inference.

* Would an unfreed reference in the js side affect the blazor side somehow, or would blazor automatically free the js module?

* I guess it may be that the loading of other add-ins in your side affect the performance of your current add-in's CF.

* Move that to the top level so you don't need to worry about what side affects the import machinery

It is at least 10x more common as a mistake, but it's too common to be marginal as legit usage. Some are even ambiguous.

Sorry I haven't looked at the PR yet so apologies if this is handled already. I just thought I'd share these thoughts with you quickly.

Hey @hippietrail, thanks for the quick feedback! You're absolutely right — "side affect(s)" is legitimate in many contexts, so we definitely need solid test coverage to avoid false positives.

I'd be happy to add more tests. Could you share more examples of cases where "side affect(s)" is correct so I can include them? That way we can make sure the rule only triggers when it's clearly a mistake and not on valid usage.

Thanks again for taking the time to look into this! :) looking forward to collaborating for the first time in this project!

@estefafdez
Copy link
Contributor Author

Thanks for the feedback again @hippietrail ! I've added 6 new tests to cover the cases you mentioned.

Tests that verify side effect(s) is never flagged (noun usage):

  • "There were no side effects from the medication." → 0 lints
  • "Avoid side effects in your functions." → 0 lints
  • "This change has no side effects." → 0 lints

Tests that verify legitimate verb uses of side affects are not flagged:

  • "I am still not clear how padding side affects the results." → 0 lints
  • "Move that to the top level so you don't need to worry about what side affects the import machinery." → 0 lints
  • "Would an unfreed reference in the script side affect the other side somehow?" → 0 lints

The verb cases pass cleanly because AffectToEffect patterns require a specific following context (AUX/VERB, or ADJ+NOUN, etc.) that isn't present when affects is the main predicate followed by a noun phrase like the results (DET + NOUN).

Let me know if you have more examples to add :)

Copy link
Collaborator

@elijah-potter elijah-potter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good enough to merge. I'll approve it.

But, I have one question. Be honest, are you a bot? Forgive me but your code and your responses are giving "Claude". No offense intended.

@elijah-potter elijah-potter added this pull request to the merge queue Mar 20, 2026
@estefafdez
Copy link
Contributor Author

This looks good enough to merge. I'll approve it.

But, I have one question. Be honest, are you a bot? Forgive me but your code and your responses are giving "Claude". No offense intended.

Hey there @elijah-potter , no, I'm not 😂 I was leaning rust for a few months and I love your app, so I wanted to keep practicing and contribute to your Repo.

You can check my profile if you want. And thanks for the approval! Looking forward to keep contributing to this project if you let me!

@elijah-potter
Copy link
Collaborator

Okay. I appreciate your work so far. It's quite good and I hope to hear more from you.

@hippietrail and I were discussing another recent contributor who seems to be an OpenClaw bot. I suppose I just had it on the brain. My deepest apologies!

@estefafdez
Copy link
Contributor Author

Okay. I appreciate your work so far. It's quite good and I hope to hear more from you.

@hippietrail and I were discussing another recent contributor who seems to be an OpenClaw bot. I suppose I just had it on the brain. My deepest apologies!

No problem at all! As I said, looking forward to keep contributing to open source projects that I used every day to make them better 💪

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 20, 2026
@hippietrail
Copy link
Collaborator

hippietrail commented Mar 20, 2026

I'd be happy to add more tests. Could you share more examples of cases where "side affect(s)" is correct so I can include them? That way we can make sure the rule only triggers when it's clearly a mistake and not on valid usage.

I was also getting the same bot vibe Elijah was getting so I was about to write advice in the way I'd instruct a bot. But since we know you're human it's easier (-: I don't have examples to hand. What I do is use my Google-fu - bots typically can't do actual Google queries which makes it hard to automate.

What I do is start with all the valid inflections and restrict the domain to GitHub:

"side affect OR affects site:github.com"

For one like this where the false positives are fewer than one in ten I just go through all the findings page by page to see which hits are not misspellings of "side effect(s)".

If I notice any patterns, like what following word types might be when it's legit but not when it's a spello, then I add to the query. For instance when not a mistake "affect" is a transitive verb, so it can take an object, which means a noun, pronoun, or noun phrase. So I might add all the object pronouns separated by AND:

"side affect OR affects me OR us OR you OR him OR her OR it OR them" site:github.com

Sometimes I widen the search. Since Harper is targeting coders I start with tech/coding sites. So I'll add slashdot.org, stackoverflow.com, stackexchange.com one by one.

If I'm still looking for more, or haven't hit one of the pronouns or one verb inflection, etc. then I widen to medium.com and after that reddit.com - that order tends to increase the number of English mistakes while decreasing the tech/coding feel of the content in increments.

Thanks again for taking the time to look into this! :) looking forward to collaborating for the first time in this project!

Happy hunting!

@estefafdez
Copy link
Contributor Author

I'd be happy to add more tests. Could you share more examples of cases where "side affect(s)" is correct so I can include them? That way we can make sure the rule only triggers when it's clearly a mistake and not on valid usage.

I was also getting the same bot vibe Elijah was getting so I was about to write advice in the way I'd instruct a bot. But since we know you're human it's easier (-: I don't have examples to hand. What I do is use my Google-fu - bots typically can't do actual Google queries which makes it hard to automate.

What I do is start with all the valid inflections and restrict the domain to GitHub:

side affect OR affects site:github.com

For one like this where the false positives are fewer than one in ten I just go through all the findings page by page to see which hits are not misspellings of "side effect(s)".

If I notice any patterns, like what following word types might be when it's legit but not when it's a spello, then I add to the query. For instance when not a mistake "affect" is a transitive verb, so it can take an object, which means a noun, pronoun, or noun phrase. So I might add all the object pronouns separated by AND:

side affect OR affects me OR us OR you OR him OR her OR it OR them site:github.com

Sometimes I widen the search. Since Harper is targeting coders I start with tech/coding sites. So I'll add slashdot.org, stackoverflow.com, stackexchange.com one by one.

If I'm still looking for more, or haven't hit one of the pronouns or one verb inflection, etc. then I widen to medium.com and after that reddit.com - that order tends to increase the number of English mistakes while decreasing the tech/coding feel of the content in increments.

Thanks again for taking the time to look into this! :) looking forward to collaborating for the first time in this project!

Happy hunting!

Perfect, thank you for the explanation. As those are my first contribution, I tried to get small/concrete issues easy to resolve (as I'm also a junior in rust) but I will check the Repo and try to understand better the code and the way you work just to make better PRs next 😊 thanks again for the code review and the insight and thank you for doing such an amazing job with the app!

@hippietrail
Copy link
Collaborator

"side affect OR affects me OR us OR you OR him OR her OR it OR them" site:github.com

Perfect, thank you for the explanation. As those are my first contribution, I tried to get small/concrete issues easy to resolve (as I'm also a junior in rust) but I will check the Repo and try to understand better the code and the way you work just to make better PRs next 😊 thanks again for the code review and the insight and thank you for doing such an amazing job with the app!

Oh I just spotted that I forgot the essential double quotes in my Google examples. Fixed above. Even though I've been coding for decades I still feel like a junior in Rust at just over a year into it.
Thank Elijah - he made the app. I'm just contributing because it's fun (-:

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.

3 participants