Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude "of" from default AvoidInfix configuration (used in ScalaTest) #3700

Closed
wants to merge 1 commit into from

Conversation

piter75
Copy link

@piter75 piter75 commented Nov 23, 2023

Fixes #3699

It also:

  • makes the more ScalaTest formatting test a bit more realistic
  • uses some arbitrary infix call in excludeFilters list append test

@kitbellew
Copy link
Collaborator

@piter75 thank you for this submission. there's an alternative, #3711, which takes a slightly more conservative approach of excluding only behavior.of, as opposed to *.of which might be a little too wide.

@piter75
Copy link
Author

piter75 commented Nov 27, 2023

@kitbellew The "wideness" of the exclusion crossed my mind but I decided it's ok if we already exclude both in and be.

Anyway, being specific here is much better.

@piter75 piter75 closed this Nov 27, 2023
@piter75 piter75 deleted the exclude_of_from_avoidinfix branch November 27, 2023 16:54
@kitbellew
Copy link
Collaborator

@kitbellew The "wideness" of the exclusion crossed my mind but I decided it's ok if we already exclude both in and be.

is there a way to limit in or be?

@piter75
Copy link
Author

piter75 commented Nov 27, 2023

IMHO be always comes after should or must in assertions but I would have to do some research to be certain

in is used in both FlatSpec and FreeSpec styles which implies that it comes after a String "literal".
Maybe we could narrow it down to " in.
Someone may probably store the preceding string in a variable but that would (most probably) be rare.

Those changes could potentially be backwards incompatible so maybe it's not worth changing it.

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.

Allow usage of "behavior of" (used in ScalaTest) by default when AvoidInfix is enabled
2 participants