Skip to content

Added support for generic NativeCmd step#949

Merged
nedtwigg merged 2 commits into
diffplug:mainfrom
tisoft:generic_native_cmd
Sep 27, 2021
Merged

Added support for generic NativeCmd step#949
nedtwigg merged 2 commits into
diffplug:mainfrom
tisoft:generic_native_cmd

Conversation

@tisoft

@tisoft tisoft commented Sep 24, 2021

Copy link
Copy Markdown
Contributor

Allows to call locally installed binaries to format files

@tisoft

tisoft commented Sep 24, 2021

Copy link
Copy Markdown
Contributor Author

Would like to use this, to call a custom formatter, that is installed locally, but can't be added as a "real" formatter into spotless.

TODO: Support writing the unformatted string to a temp file and read it back from another (or the same) file

@nedtwigg nedtwigg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool feature, needs docs and changelog entries (root and plugin-maven).

Comment thread lib/src/main/java/com/diffplug/spotless/generic/NativeCmdStep.java Outdated
Comment thread lib/src/main/java/com/diffplug/spotless/generic/NativeCmdStep.java Outdated
@nedtwigg

nedtwigg commented Sep 24, 2021

Copy link
Copy Markdown
Member

TODO: Support writing the unformatted string to a temp file and read it back from another (or the same) file

This feature is best left unimplemented, imo. stdin/stdout are perfectly suited for this purpose. Unless you absolutely, unavoidably need filebased-IO for a usecase you have right now, I think we're better off leaving this out. 100% guarantee people waste hours fiddling with the filename, whether its local or relative, tools that don't flush filesystem cache, etc, not to mention performance.

@tisoft tisoft requested a review from nedtwigg September 25, 2021 13:25
@tisoft

tisoft commented Sep 25, 2021

Copy link
Copy Markdown
Contributor Author
  • Added CHANGES.md entries
  • Added doc in README.md
  • Incorporated review comments

@nedtwigg

Copy link
Copy Markdown
Member

Please merge the latest origin/main into this PR. That should fix CI, at which point I can merge and release.

@tisoft

tisoft commented Sep 27, 2021

Copy link
Copy Markdown
Contributor Author

@nedtwigg rebased against main and fixed one copyright date. The test failure seems unrelated to me.

Comment thread lib/src/main/java/com/diffplug/spotless/generic/NativeCmdStep.java Outdated
@nedtwigg

Copy link
Copy Markdown
Member

Agree re: test faillure. I would merge if there wasn't low-hanging fruit re: the absolute path.

@nedtwigg nedtwigg merged commit 12aac3c into diffplug:main Sep 27, 2021
@tisoft tisoft deleted the generic_native_cmd branch September 27, 2021 05:55
@nedtwigg

Copy link
Copy Markdown
Member

Published in plugin-maven 2.14.0.

carhartl added a commit to carhartl/spotless that referenced this pull request Oct 11, 2021
carhartl added a commit to carhartl/spotless that referenced this pull request Oct 11, 2021
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

Successfully merging this pull request may close these issues.

2 participants