{"id":38955360,"url":"https://github.com/gherynos/pre-commit-java","last_synced_at":"2026-01-17T16:15:21.410Z","repository":{"id":41485647,"uuid":"246929567","full_name":"gherynos/pre-commit-java","owner":"gherynos","description":"A collection of git hooks for Java to be used with the pre-commit framework.","archived":false,"fork":false,"pushed_at":"2026-01-11T18:34:29.000Z","size":52,"stargazers_count":50,"open_issues_count":2,"forks_count":24,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T21:59:00.113Z","etag":null,"topics":["checkstyle","java","pmd","pre-commit"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gherynos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-03-12T20:57:20.000Z","updated_at":"2026-01-11T18:34:32.000Z","dependencies_parsed_at":"2025-12-07T13:02:13.574Z","dependency_job_id":null,"html_url":"https://github.com/gherynos/pre-commit-java","commit_stats":null,"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"purl":"pkg:github/gherynos/pre-commit-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherynos%2Fpre-commit-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherynos%2Fpre-commit-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherynos%2Fpre-commit-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherynos%2Fpre-commit-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gherynos","download_url":"https://codeload.github.com/gherynos/pre-commit-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gherynos%2Fpre-commit-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checkstyle","java","pmd","pre-commit"],"created_at":"2026-01-17T16:15:20.513Z","updated_at":"2026-01-17T16:15:21.398Z","avatar_url":"https://github.com/gherynos.png","language":"Shell","readme":"# pre-commit-java\n\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/gherynos/pre-commit-java)\n[![update](https://github.com/gherynos/pre-commit-java/actions/workflows/update.yaml/badge.svg)](https://github.com/gherynos/pre-commit-java/actions/workflows/update.yaml)\n\nA collection of git hooks for Java to be used with the [pre-commit framework](http://pre-commit.com).\n\n## Requirements\n\npre-commit-java requires the following to run:\n\n* [pre-commit](http://pre-commit.com)\n* [Docker](https://www.docker.com)\n\n## Install\n\n1. create `.pre-commit-config.yaml` in you git project\n2. pre-commit install\n3. enjoy :)\n\nexample `.pre-commit-config.yaml`:\n\n```yaml\n- repo: https://github.com/gherynos/pre-commit-java\n  rev: v0.2.1  # Use the ref you want to point at\n  hooks:\n    - id: pmd\n      exclude: /test/\n    - id: cpd\n      exclude: /test/\n    - id: checkstyle\n      exclude: /test/\n    # ...\n```\n\n## Available Hooks\n\n| Hook name    | Description                                                                                   |\n|--------------|-----------------------------------------------------------------------------------------------|\n| `pmd`        | Runs the [PMD](https://pmd.github.io) static code analyzer.                                   |\n| `cpd`        | Runs the [Copy/Paste Detector (CPD)](https://pmd.github.io/pmd-6.22.0/pmd_userdocs_cpd.html). |\n| `checkstyle` | Runs the [Checkstyle](https://checkstyle.sourceforge.io) static code analysis tool.           |\n\n### Notes about the `pmd` hook\n\nThe default ruleset used is [ruleset.xml](https://github.com/gherynos/pre-commit-java/blob/master/ruleset.xml), which runs all the Java rules, except for `LoosePackageCoupling`.\n\nTo specify a custom ruleset, simply pass the argument to the hook:\n\n```yaml\n    - id: pmd\n      args: [\"-R=my_ruleset.xml\"]\n```\n\nFurthermore, the default language version passed to PMD is `java-17`, which can be tweaked using the `--use-version` argument.\n\nOther [CLI](https://pmd.github.io/latest/pmd_userdocs_cli_reference.html#options) arguments are also supported, like `--cache` for incremental analysis.\n\nThe arguments must be specified using the `--\u003carg\u003e=\u003cvalue\u003e` (`-\u003carg\u003e=\u003cvalue\u003e`) convention, as opposed to `--\u003carg\u003e \u003cvalue` (`-\u003carg\u003e \u003cvalue`) to avoid parsing errors.\n\n### Notes about the `cpd` hook\n\nThe default minimum token length is 100.\n\nTo change it, simply pass the argument to the hook:\n\n```yaml\n    - id: cpd\n      args: [\"--minimum-tokens=50\"]\n```\n\nOther [CLI](https://pmd.github.io/latest/pmd_userdocs_cpd.html#cli-usage) arguments are also supported.\n\nThe arguments must be specified using the `--\u003carg\u003e=\u003cvalue\u003e` (`-\u003carg\u003e=\u003cvalue\u003e`) convention, as opposed to `--\u003carg\u003e \u003cvalue` (`-\u003carg\u003e \u003cvalue`) to avoid parsing errors.\n\n### Notes about the `checkstyle` hook\n\nThe default configuration used is [sun_checks.xml](https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/sun_checks.xml).\n\nTo specify a custom one, simply pass the argument to the hook:\n\n```yaml\n    - id: checkstyle\n      args: [\"-c\", \"my_checks.xml\"]\n```\n\nOther [CLI](https://checkstyle.org/cmdline.html) arguments are also supported.\n\nOther configurations [part of the distribution](https://github.com/checkstyle/checkstyle/tree/master/src/main/resources) can be used like:\n\n```yaml\n    - id: checkstyle\n      args: [\"-c\", \"/google_checks.xml\"]\n```\n\n## Author\n\n\u003e GitHub [@gherynos](https://github.com/gherynos)\n\n## License\n\npre-commit-java is licensed under the [GPLv3](https://github.com/gherynos/pre-commit-java/blob/master/LICENSE) license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgherynos%2Fpre-commit-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgherynos%2Fpre-commit-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgherynos%2Fpre-commit-java/lists"}