Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary line breaks and missed (maybe?) line breaks #1077

Open
Ledmington opened this issue Apr 23, 2024 · 0 comments
Open

Unnecessary line breaks and missed (maybe?) line breaks #1077

Ledmington opened this issue Apr 23, 2024 · 0 comments

Comments

@Ledmington
Copy link

What happened?

Hello everyone, I am using palantir 2.43.0 in a pretty large codebase through the spotless gradle plugin 6.25.0 and with gradle 8.7. Today I came around this:

private String toString(final String indent) {
    return indent
            + name
            + (parameters.isEmpty()
                    ? ""
                    : "\n" + parameters.stream().map(s -> indent + s).collect(Collectors.joining("\n")))
            + (sons.isEmpty()
                    ? ""
                    : "\n"
                            + sons.stream()
                                    .map(s -> s.toString(indent + "  "))
                                    .collect(Collectors.joining("\n")));
}

What did you want to happen?

Maybe something more like this, to avoid unnecessary line breaks.

private String toString(final String indent) {
    return indent
            + name
            + (parameters.isEmpty()
                    ? ""
                    : "\n" + parameters.stream()
                            .map(s -> indent + s)
                            .collect(Collectors.joining("\n")))
            + (sons.isEmpty()
                    ? ""
                    : "\n" + sons.stream()
                                    .map(s -> s.toString(indent + "  "))
                                    .collect(Collectors.joining("\n")));
}

I understand that it is a bit specific but I want to understand if it is an error on my side caused by ignorance and misconfiguration or if it is something that palantir can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant