google / google/google-java-format
Formatting overly long lines does not respect `--lines` range restriction
- Linguagem predominante
- Java
- Estrelas
- 6.2k
- Forks
- 937
- Merge médio
- 6min
- PRs com merge (30d)
- 3
Descrição
Let Test.java be:
```
class Test {
void foo() {
// Columns:
// 1 2 3 4 5 6 7 8 9
// ..0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
}
}
```
What I did: `$ google-java-format --lines 1:1 Test.java | diff Test.java -`
What I expected to happen: No diff, since line 1 is already correctly formatted.
What actually happens:
```
6c6,7
< System.err.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
---
> System.err.println(
> "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
```
Guia de contribuição
Direção de pesquisa
Reproduce the issue with the provided Test.java example and `google-java-format --lines 1:1 Test.java`, then trace how the `--lines` range is applied to overly long lines. Done means the command produces no diff when the selected line is already correctly formatted, while formatting remains unchanged outside the requested range.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- java
- Domínio
- tooling
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 35/100