All Projects → axel-op → googlejavaformat-action

axel-op / googlejavaformat-action

Licence: MIT license
GitHub Action that formats Java files following Google Style guidelines

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to googlejavaformat-action

winston-dev-console
Winston@3 console format aimed to improve development UX
Stars: ✭ 88 (+33.33%)
Mutual labels:  formatter, format
clojure-dependency-update-action
A simple GitHub Actions job to create Pull Requests for outdated dependencies in clojure projects
Stars: ✭ 37 (-43.94%)
Mutual labels:  github-actions, github-action
clang-format-action
GitHub Action for clang-format checking
Stars: ✭ 48 (-27.27%)
Mutual labels:  github-actions, github-action
lit-date
Light-weight, faster datetime formatter for modern browsers.
Stars: ✭ 33 (-50%)
Mutual labels:  formatter, format
pre-commit-hooks
Standardizing our code quality tooling 🛠️
Stars: ✭ 44 (-33.33%)
Mutual labels:  formatter, google-java-format
action-setup-kube-tools
Github Action that setup Kubernetes tools (kubectl, kustomize, helm, kubeconform, conftest, yq, rancher, tilt, skaffold) very fast and cache them on the runner. Please [✩Star] if you're using it!
Stars: ✭ 45 (-31.82%)
Mutual labels:  github-actions, github-action
action-github-workflow-sync
Github Action To Sync Github Action's Workflow Files Across Repositories
Stars: ✭ 51 (-22.73%)
Mutual labels:  github-actions, github-action
Fmt Obj
Stringifies any javascript object in your console for CLI inspection ✨
Stars: ✭ 428 (+548.48%)
Mutual labels:  formatter, format
slsa-provenance-action
Github Action implementation of SLSA Provenance Generation
Stars: ✭ 34 (-48.48%)
Mutual labels:  github-actions, github-action
setup-bats
GitHub Action to setup BATS testing framework
Stars: ✭ 25 (-62.12%)
Mutual labels:  github-actions, github-action
Uncrustify
Code beautifier
Stars: ✭ 2,442 (+3600%)
Mutual labels:  formatter, format
action-netlify-deploy
🙌 Netlify deployments via GitHub actions
Stars: ✭ 32 (-51.52%)
Mutual labels:  github-actions, github-action
Brazilian Utils
Utils library for specific Brazilian businesses
Stars: ✭ 1,023 (+1450%)
Mutual labels:  formatter, format
sentry-releases-action
A GitHub action that creates releases for Sentry.io.
Stars: ✭ 38 (-42.42%)
Mutual labels:  github-actions, github-action
Translatedjs
Internationalization and localization for JavaScript and Node.js
Stars: ✭ 17 (-74.24%)
Mutual labels:  formatter, format
restrict-cursing-action
Github Action to prevent cursing and bad language in issues and pull requests
Stars: ✭ 20 (-69.7%)
Mutual labels:  github-actions, github-action
teks
Easily get custom go template based outputs to your command-line tool. Like in docker/kubernetes
Stars: ✭ 41 (-37.88%)
Mutual labels:  formatter, format
pretty-remarkable
Plugin for prettifying markdown with https://github.com/jonschlinkert/remarkable using custom renderer rules.
Stars: ✭ 22 (-66.67%)
Mutual labels:  formatter, format
recent-activity
Add your recent activity to your profile readme!
Stars: ✭ 87 (+31.82%)
Mutual labels:  github-actions, github-action
changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+1010.61%)
Mutual labels:  github-actions, github-action

Google Java Format Action

Automatically format your Java files using Google Java Style guidelines.

This action automatically downloads the latest release of the Google Java Format program.

This action can format your files and push the changes, or just check the formatting without committing anything.

You must checkout your repository with actions/checkout before calling this action (see the example).

Examples

Format all Java files in the repository and commit the changes:

# Example workflow
name: Format

on:
  push:
    branches:
      - master

jobs:

  formatting:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2 # v2 minimum required
      - uses: axel-op/googlejavaformat-action@v3
        with:
          args: "--skip-sorting-imports --replace"
          # Recommended if you use MacOS:
          # githubToken: ${{ secrets.GITHUB_TOKEN }}

Check if the formatting is correct without pushing anything:

# Example workflow
name: Format

on: [push, pull_request]

jobs:

  formatting:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2 # v2 minimum required
      - uses: axel-op/googlejavaformat-action@v3
        with:
          args: "--set-exit-if-changed"

Inputs

None of these inputs is required, but you can add them to change the behavior of this action.

githubToken

Recommended if you execute this action on MacOS. Due to this issue, calling the GitHub API from a MacOS machine can result in an error because of a rate limit. To overcome this, provide the GITHUB_TOKEN to authenticate these calls. If you provide it, it will also be used to authenticate the commits made by this action.

version

Set this input to use a specific version of Google Java Format. For example: 1.7, 1.8...

files

A pattern to match the files to format. The default is **/*.java, which means that all Java files in your repository will be formatted.

files-excluded

A pattern to match the files to be ignored. Optional.

skipCommit

Set to true if you don't want the changes to be committed by this action. Default: false.

commitMessage

You can specify a custom commit message. Default: Google Java Format.

args

The arguments to pass to the Google Java Format executable. By default, only --replace is used.

-i, -r, -replace, --replace
  Send formatted output back to files, not stdout.

--assume-filename, -assume-filename
  File name to use for diagnostics when formatting standard input (default is <stdin>).

--aosp, -aosp, -a
  Use AOSP style instead of Google Style (4-space indentation).

--fix-imports-only
  Fix import order and remove any unused imports, but do no other formatting.

--skip-sorting-imports
  Do not fix the import order. Unused imports will still be removed.

--skip-removing-unused-imports
  Do not remove unused imports. Imports will still be sorted.

--skip-reflowing-long-strings
  (JDK 11+) Do not reflow string literals that exceed the column limit.

--skip-javadoc-formatting
  (JDK 11+) Do not reformat javadoc.

--dry-run, -n
  Prints the paths of the files whose contents would change if the formatter were run normally.

--set-exit-if-changed
  Return exit code 1 if there are any formatting changes.

--length, -length
  Character length to format.

--lines, -lines, --line, -line
  Line range(s) to format, like 5:10 (1-based; default is all).

--offset, -offset
  Character offset to format (0-based; default is all).

Note:

  • If you add --dry-run or -n, no commit will be made.
  • The argument --set-exit-if-changed will work as expected and this action will fail if some files need to be formatted.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].