Avraham Cohen
Avraham Cohen

Reputation: 95

How can I use the googleJavaFormat to make reflowLongStrings set to a max of 120 chars per line

I am using the Spotless plugin to format my Java code. However, when I am enabling the reflowLongStrings rule, it breaks lines to be no longer than 80 chars. Is it possible to change it to 120?

Upvotes: 5

Views: 3151

Answers (1)

frblazquez
frblazquez

Reputation: 178

Google java format is not configurable by design (have a look at this) so there is no way for configuring a custom max line width. What you can do is to configure spotless plugin to work with a custom eclipse jdt formatter. Here you can see how this is done in the spotless documentation.

For example, for gradle you would have:

spotless {
  java {
    eclipse().configFile('custom-config.xml')
  }
}

Instead of:

spotless {
  java {
    googleJavaFormat()
  }
}

Upvotes: 2

Related Questions