You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please paste the contents of your .scalafmt.conf file here:
version = 3.7.17
rewrite {
rules = [AvoidInfix]
}
Steps
Given code like this:
behavior of "XYZ"
Problem
Scalafmt formats code like this:
behavior.of("XYZ")
Expectation
I would like the formatted output to look like this:
behavior of "XYZ"
Workaround
A workaround is to add the following line to the configuration:
rewrite.neverInfix.exclude."+" = "of"
However it seems to be an unnecessary tediousness and complexity of configuration especially given that most other ScalaTest infix keywords are already excluded from AvoidInfix rule by default.
Proposed solution
I am willing to submit a pull request (PR) that adds "of" to the default neverInfix.exclude list.
However, it's worth noting that the "behavior of" example is used in tests as a manual token append demonstration. We could potentially choose a different keyword in the test scenario to make the change.
I would like to confirm this before contributing.
The text was updated successfully, but these errors were encountered:
piter75
changed the title
Allow usage of "behavior of" (used in ScalaTest) by default when AvoidInfix is used
Allow usage of "behavior of" (used in ScalaTest) by default when AvoidInfix is enabled
Nov 23, 2023
Configuration
Please paste the contents of your
.scalafmt.conf
file here:Steps
Given code like this:
behavior of "XYZ"
Problem
Scalafmt formats code like this:
behavior.of("XYZ")
Expectation
I would like the formatted output to look like this:
behavior of "XYZ"
Workaround
A workaround is to add the following line to the configuration:
However it seems to be an unnecessary tediousness and complexity of configuration especially given that most other ScalaTest infix keywords are already excluded from
AvoidInfix
rule by default.Proposed solution
I am willing to submit a pull request (PR) that adds "of" to the default
neverInfix.exclude
list.However, it's worth noting that the "behavior of" example is used in tests as a manual token append demonstration. We could potentially choose a different keyword in the test scenario to make the change.
I would like to confirm this before contributing.
The text was updated successfully, but these errors were encountered: