google / google/google-java-format

Remove redundant string concatenations when unwrapping lines

Aberta
#122 0 comentários 0 reações 0 responsáveis Ver no GitHub
non-whitespace
Linguagem predominante
Java
Estrelas
6.2k
Forks
937
Merge médio
6min
PRs com merge (30d)
3

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

A issue não nomeia arquivos nem testes; comece executando o formatter no exemplo Java String.format e rastreie o tratamento de concatenações de strings envolvidas durante o unwrapping. Está concluído quando as concatenações redundantes são removidas, enquanto a string de formato resultante e a formatação ao redor permanecem corretas.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
java
Domínio
tooling
Tipo de issue
Funcionalidade
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.