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

Starting with v3.3.1 scalafmt formats boilerplate code in a weird way #3079

Closed
satorg opened this issue Jan 23, 2022 · 3 comments · Fixed by #3080
Closed

Starting with v3.3.1 scalafmt formats boilerplate code in a weird way #3079

satorg opened this issue Jan 23, 2022 · 3 comments · Fixed by #3080

Comments

@satorg
Copy link

satorg commented Jan 23, 2022

See typelevel/cats#4116

Configuration:

version=3.3.3
align.openParenCallSite = true
align.openParenDefnSite = true
maxColumn = 120
continuationIndent.defnSite = 2
assumeStandardLibraryStripMargin = true
danglingParentheses.preset = true
rewrite.rules = [AvoidInfix, SortImports, RedundantParens, SortModifiers]
docstrings = JavaDoc
newlines.afterCurlyLambda = preserve
docstrings.style = keep
docstrings.oneline = unfold

runner.dialect = scala213source3
fileOverride {
  "glob:**/*.sbt" {
    runner.dialect = sbt1
  }
  "glob:**/src/{main,test}/scala-2.12/**" {
    runner.dialect = scala212source3
  }
  "glob:**/src/{main,test}/scala-3.x/**" {
    runner.dialect = scala3
  }
}
project.excludeFilters = [
  "scalafix/*"
]

Problem

Scalafmt formats code in boilerplate blocks which is not expected to happen.
Furthermore, the formatted results look pretty ugly: the formatting breaks block margins:
https://github.com/typelevel/cats/pull/4116/files?diff=unified&w=0#diff-dedd06aeff4542c5b99c68ad8ee7fecde2588c7adba68944521cda08e709aa83L153-R154

Expectation

The boilerplate code blocks should not be formatted by default since the result code can be very different from the source template.

Or at least there should be an option to disable it in configs.

@kitbellew
Copy link
Collaborator

what is boilerplate code?

@satorg
Copy link
Author

satorg commented Jan 23, 2022

@kitbellew I mean code templates for sbt-boilerplate plug-in

@kitbellew
Copy link
Collaborator

Сергей, я понятия не имею, что это такое. с точки зрения scala, что это за конструкция?

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 a pull request may close this issue.

2 participants