google / google/google-java-format

String splitting / wrapping can increase line length

未關閉
#989 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
6.2k
分支
937
平均合併
6 分鐘
30 天內合併 PR
3

描述

### Version
1.18.1, all-deps JAR

### Description
In some cases Google Java Format wraps / splits long string literals which exceed the maximum line length in a way which makes the string literal exceed the maximum line length even further.

In those cases maybe it would be better if the string had not been split / wrapped.

### Example
```java
class Test {
void test() {
System.out.println(
"\nSee https://example.com/some-really-long-path-which-exceeds-the-maximum-line-length-of-the-formatter");
}
}
```

The formatted result is:
```java
class Test {
void test() {
System.out.println(
"\n"
+ "See https://example.com/some-really-long-path-which-exceeds-the-maximum-line-length-of-the-formatter");
}
}
```

貢獻指南

開啟貢獻指南

研究方向

使用 google-java-format 1.18.1,透過 issue 中顯示的 Java 輸入與輸出重現該報告。追蹤格式化器拆分字串常值的邏輯及其行長度測試;完成標準是長字串常值不會因換行而變得更長,且現有的格式化行為仍由測試涵蓋。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。