palantir / palantir/palantir-java-format

Allow overriding the formatter config (avoid breaking long method names into new lines)

Open
#942 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
907
Forks
101
Avg merge
1d 3h
Merged PRs (30d)
19

Description

What happened?

The formatter should allow the users to set a config file and override the default formatting. There is a special case where I'd like to override the formatter config to avoid breaking long method names into new lines and it is not possible.

In Java, sometimes we have long method names for testing, and the formatter is formatting the method name to a new line:

    @Test
    void
            i_am_a_long_method_name_that_will_break_into_a_new_line_but_I_should_not_and_allow_something_to_override_it_and_customize_according_what_the_users_want() {}

What did you want to happen?

The formatter should allow to override configurations via config file. We could have properties like line-length-limit: X and then break to new line only when the method name is bigger than what is set in the config.

The expected output I'd like to get from the above example is:

@Test
void i_am_a_long_method_name_that_will_break_into_a_new_line_but_I_should_not_and_allow_something_to_override_it_and_customize_according_what_the_users_want() {}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by locating how formatter configuration is loaded and how long method names are wrapped. Define a config-file override for the line-length limit, then verify that the supplied long test method remains on one line when the configured limit permits it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.