google / google/google-java-format

Remove redundant string concatenations when unwrapping lines

オープン
#122 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
non-whitespace
主要言語
Java
スター
6.2k
フォーク
937
平均マージ
6分
マージ済み PR(30日)
3

説明

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()));
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。