Skip to content

fix issue #975: last character not a \n after format in Intellij #1113

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

bodote
Copy link

@bodote bodote commented Aug 11, 2024

Before this PR

WHEN creating a new java class using Intellij with palantir-java-format plugin enabled for formating all java files
AND using maven-spotless with palantirJavaFormat
AND the last line in a java file is not an empty line but just } with no \n appended
THEN the mvn spotless:checkusing palantirJavaFormat fails
BECAUSE the Intellij with palantir-java-format plugin enabled does NOT add this required \n

After this PR

fixes : #975

change PalantirJavaFormatFormattingService.java from request.onTextReady(formattedText); to request.onTextReady(formattedText.trim() + "\n"); so that the required \n is added when Intellij formats a source file

Possible downsides?

  • none known

@palantirtech
Copy link
Member

Thanks for your interest in palantir/palantir-java-format, @bodote! 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
Copy link

changelog-app bot commented Aug 11, 2024

Generate changelog in changelog/@unreleased

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

fix #975

Check the box to generate changelog(s)

  • Generate changelog entry

@bodote bodote changed the title fix https://github.com/palantir/palantir-java-format/issues/975 fix issue #975: last character not a \n after format in Intellij Aug 11, 2024
@ash211 ash211 requested a review from crogoz September 10, 2024 15:28
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spotless-maven-palantirJavaFormat : last character not a \n -> check fails
2 participants