![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
google-java-format
Advanced tools
Node repackaging of Google's native google-java-format tool
Very useful in libraries that wrap native java code in javascript
yarn add google-java-format
(or npm -i google-java-format
if you prefer)npx google-java-format <path to java file>
All arguments are passed directly to the underlying google-java-format tool, with the exception of --glob
.
Multiple files as a glob must be pre-processed to avoid errors with command line arguments being too long
npx google-java-format -i --glob=folder/**/*.java
This will find the matching files and run google-java-format
on chunks of 30 files at a time, then show the total
formatted files at the end.
See node-glob for globbing semantics.
Use the -i
or --replace
argument to format the files by re-writing instead of printing the changes to stdout:
npx google-java-format -i --glob=folder/**/*.java
To just check files use the -n
(or --dry-run
) parameter:
npx google-java-format -n --glob=folder/**/*.java
May be wrapped in git pre-commit if desired, there are examples on line demonstrating this
If you would like to contribute a pre-commit hook, perhaps one that is Husky-compatible, that would be great! Open a PR with the hook and remove this comment :-)
May be used in GitHub Actions workflows to verify PRs meet formatting standards,
as done in Invertase react-native-firebase, specifically this package.json
run script is called in a CI job and sets exit status correctly to fail the job if there are formatting inconsistencies found:
// ...
"scripts": {
// ...
"lint:android": "google-java-format --set-exit-if-changed --replace --glob=\"packages/**/android/**/*.java\"",
// ...
},
// ...
Something like that (with a glob that matches your java file roots) could work for you
The wonderful clang-format from the Angular team is so useful, we wanted the same package for java formatting.
That package already solves so many of the little problems that occur with different platforms, and globbing etc - it's fantastic.
Go to their repo, integrate it for objective-c code, and give them a star! They have earned it. Thanks for the code + inspiration Angular community!
Built and maintained by Invertase.
FAQs
node wrapper around google-java-format
The npm package google-java-format receives a total of 0 weekly downloads. As such, google-java-format popularity was classified as not popular.
We found that google-java-format demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.