Skip to content

Remove redundant string concatenations when unwrapping lines #122

Open
@dpursehouse

Description

@dpursehouse

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions