Skip to content

Add maven shell script formatting support via shfmt - #1998

Merged
nedtwigg merged 9 commits into
diffplug:mainfrom
tbcrawford:tylercrawford/issue-1567/support-sh-bash-maven
Jan 17, 2024
Merged

nedtwigg merged 9 commits into
diffplug:mainfrom
tbcrawford:tylercrawford/issue-1567/support-sh-bash-maven

Conversation

@tbcrawford

@tbcrawford tbcrawford commented Jan 15, 2024 •

Copy link
Copy Markdown
Contributor

This adds Maven support for shfmt and addresses #1567. This is a follow up to #1994. Closes #1567 #1776


import com.diffplug.spotless.maven.MavenIntegrationHarness;

@Disabled // Disabled due to GHA not having shfmt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Please let me know if I missed some detail that enables these types of formatters (ones that need to shell out) to run in GitHub action workflows. I'd be happy to add whatever is needed to get this to run in GHA.

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.

I replaced @Disabled with @ShfmtTest. If you run gradlew test these tests will not run. They only run when you run ./gradlew testShfmt to run them.

If you want them to run on CI, you should add them with the npm test

- name: test npm
if: matrix.kind == 'npm'
run: ./gradlew testNpm

  • change it to ./gradlew testNpm testShfmt

The only tricky part is getting shfmt onto the CI runner. Not that hard though. Feel free to open a PR for it and mess around.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Perfect! Thank you for the clarification.

@tbcrawford tbcrawford changed the title Add maven shell script formattings support via shfmt Add maven shell script formatting support via shfmt Jan 15, 2024
@tbcrawford
tbcrawford marked this pull request as ready for review January 15, 2024 16:22
@Goooler
Goooler requested a review from nedtwigg January 16, 2024 02:24
@nedtwigg
nedtwigg merged commit 409902d into diffplug:main Jan 17, 2024
@tbcrawford
tbcrawford deleted the tylercrawford/issue-1567/support-sh-bash-maven branch January 17, 2024 13:46
@nedtwigg

Copy link
Copy Markdown
Member

Published in plugin-maven 2.43.0.

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.

Add shfmt for sh and bash scripts

3 participants