google / google/google-java-format

Remove redundant string concatenations when unwrapping lines

Aperta
#122 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
non-whitespace
Lingua principale
Java
Stelle
6.2k
Fork
937
Merge medio
6m
PR unite (30g)
3

Descrizione

In code that has string concatenation wrapped on multiple lines, the formatter should remove any redundant concatenations when unwrapping the line.

See [this reformatting change on the gerrit project](https://gerrit-review.googlesource.com/#/c/91444/7/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java) for example:

The original code:

```
throw new IllegalStateException(String.format(
"SubmitRuleEvaluator.evaluate for change %s " +
"returned empty list for %s in %s",
cd.getId(),
patchSet.getId(),
cd.change().getProject().get()));
```

And after reformatting:

```
throw new IllegalStateException(
String.format(
"SubmitRuleEvaluator.evaluate for change %s " + "returned empty list for %s in %s",
cd.getId(), patchSet.getId(), cd.change().getProject().get()));
```

The first parameter to `String.format` now has a redundant concatenation, and would be better as:

```
String.format(
"SubmitRuleEvaluator.evaluate for change %s returned empty list for %s in %s",
cd.getId(), patchSet.getId(), cd.change().getProject().get()));
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.