palantir / palantir-java-format

A modern, lambda-friendly, 120 character Java formatter.
Apache License 2.0
427 stars 46 forks source link

feat: allow configurable max line length #896

Closed simschla closed 1 year ago

simschla commented 1 year ago

Before this PR

The max line length for Palantir is 120 characters.

After this PR

The max line length for Palantir java format is configurable. ==COMMIT_MSG== Enable users to override max line length. ==COMMIT_MSG==

Possible downsides?

We are introducing configurability, which diverts from the way GJF handles things.

Notes

  1. This is a draft to open up discussion. Of course, we would need to provide tests for this change, as well as enable ways for setting the configuration in the IntelliJ and Gradle plugins. I wanted to be sure the owners were willing to go this way before investing too much time.
  2. I'm unsure on how to tackle the com.palantir.javaformat.java.FormatterService for allowing configuration. I'm open for suggestions here.

This resolves #859

palantirtech commented 1 year ago

Thanks for your interest in palantir/palantir-java-format, @simschla! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

changelog-app[bot] commented 1 year ago

Generate changelog in changelog-dir>`changelog/@unreleased`</changelog-dir

What do the change types mean? - `feature`: A new feature of the service. - `improvement`: An incremental improvement in the functionality or operation of the service. - `fix`: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way. - `break`: Has the potential to break consumers of this service's API, inclusive of both Palantir services and external consumers of the service's API (e.g. customer-written software or integrations). - `deprecation`: Advertises the intention to remove service functionality without any change to the operation of the service itself. - `manualTask`: Requires the possibility of manual intervention (running a script, eyeballing configuration, performing database surgery, ...) at the time of upgrade for it to succeed. - `migration`: A fully automatic upgrade migration task with no engineer input required. _Note: only one type should be chosen._
How are new versions calculated? - ❗The `break` and `manual task` changelog types will result in a major release! - 🐛 The `fix` changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease. - ✨ All others will result in a minor version release.

Type

- [ ] Feature - [ ] Improvement - [ ] Fix - [ ] Break - [ ] Deprecation - [ ] Manual task - [ ] Migration

Description

Enable users to override max line length. **Check the box to generate changelog(s)** - [ ] Generate changelog entry
simschla commented 1 year ago

@fawind looking for maintainer's insights here - is this something palantir-java-format would be open to doing? (It is clearly a wish on the customer side and seems pretty easy to achieve.)

mtzagkarakis commented 1 year ago

Any updates on this? @simschla thanks for the pr by the way

fawind commented 1 year ago

Thanks for putting up this PR! I'm sorry, but for now, I don't think we want to pursue making this configurable. I left a comment on the origin issue with some thoughts: https://github.com/palantir/palantir-java-format/issues/859#issuecomment-1665671443.

atrujillofalcon commented 11 months ago

Thanks for putting up this PR! I'm sorry, but for now, I don't think we want to pursue making this configurable. I left a comment on the origin issue with some thoughts: #859 (comment).

There are any specific reason to deny this PR ? Is pretty basic to be able to change line character limit, a lot of developer we are using +2K screens.