google / google/google-java-format
Avoid excessive newlines for short variable names with --aosp
- 主要语言
- Java
- 星标
- 6.2k
- 派生
- 937
- 平均合并
- 6 分钟
- 30 天内合并 PR
- 3
描述
I'm trying this out in chromium codebase, and besides the known-issue of excessive lambda whitespace (issue #19), I'm finding the most jarring thing is odd whitespace for variable assignments.
google-java-format does:
```
desc =
getResources()
.getString(R.string.cablev2_error_ble_permission, packageLabel);
```
instead of:
```
desc = getResources()
.getString(R.string.cablev2_error_ble_permission, packageLabel);
```
I'm guessing it might be because with two space indents, the wrapped line appears under the = sign (which looks less weird), but with four space indent, it looks really odd
贡献指南
调研方向
首先定位在 --aosp 下处理变量赋值和换行的 formatter 逻辑。然后找到相关的格式化测试,添加一个与此处所示短名称赋值相匹配的用例,并确认输出按要求将赋值表达式保持在一起。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100