{"id":14986073,"url":"https://github.com/saveourtool/benedikt","last_synced_at":"2025-04-11T21:31:13.771Z","repository":{"id":58299891,"uuid":"530130446","full_name":"saveourtool/benedikt","owner":"saveourtool","description":"A GitHub Action to check your code with diKTat","archived":false,"fork":false,"pushed_at":"2023-12-25T08:24:02.000Z","size":186,"stargazers_count":10,"open_issues_count":6,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T18:45:26.782Z","etag":null,"topics":["diktat","github-actions","reporting","testing"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saveourtool.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-08-29T08:26:48.000Z","updated_at":"2023-12-19T08:14:18.000Z","dependencies_parsed_at":"2023-12-25T09:49:31.308Z","dependency_job_id":null,"html_url":"https://github.com/saveourtool/benedikt","commit_stats":{"total_commits":66,"total_committers":2,"mean_commits":33.0,"dds":"0.40909090909090906","last_synced_commit":"c4c0efe46e6857505186c82c9e5beeb0412bc6ce"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveourtool%2Fbenedikt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveourtool%2Fbenedikt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveourtool%2Fbenedikt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saveourtool%2Fbenedikt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saveourtool","download_url":"https://codeload.github.com/saveourtool/benedikt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482924,"owners_count":21111401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["diktat","github-actions","reporting","testing"],"created_at":"2024-09-24T14:12:17.141Z","updated_at":"2025-04-11T21:31:13.368Z","avatar_url":"https://github.com/saveourtool.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"= A _GitHub Action_ to check your code with https://github.com/saveourtool/diktat[_diKTat_]\n:toc:\n:imagesdir: docs/images\n:tip-caption: pass:[\u0026#128161;]\n\n[.float-group]\n--\n[.left]\nimage::https://img.shields.io/badge/License-MIT-yellow.svg[License: MIT,link=\"https://opensource.org/licenses/MIT\"]\n\n[.left]\nimage::https://badgen.net/github/release/saveourtool/benedikt/latest?color=green[GitHub release,link=https://github.com/saveourtool/benedikt/releases/latest]\n\n[.left]\nimage::https://badgen.net/badge/icon/Ubuntu?icon=terminal\u0026label\u0026color=green[Ubuntu Linux]\n\n[.left]\nimage::https://badgen.net/badge/icon/macOS?icon=apple\u0026label\u0026color=green[macOS]\n\n[.left]\nimage::https://badgen.net/badge/icon/Windows?icon=windows\u0026label\u0026color=green[Windows]\n--\n\n[TIP]\n====\nAn always updated version of this document is available\nlink:https://saveourtool.github.io/benedikt/ebook.pdf[here] as a PDF e-book.\n====\n\n== Features\n\n* Customizable `diktat-analysis.yml` xref:#config[location]. You can use the\nrule set configuration with an alternate name or at a non-default location.\n\n* Customizable JVM xref:#java-setup[vendor and version]. You can run _diKTat_\nusing a default JVM, or you can set up your own one.\n\n* Customizable xref:#reporter[reporter] (_SARIF_ or _Checkstyle_ XML).\n\n* Allows multiple xref:#input-paths[input paths]. If you have a multi-module\nproject and only wish to check certain directories or modules, you can configure\nthe action accordingly.\n\n* The summary page contains statistic about detected errors:\n+\nimage::check-summary.png[diKTat Check summary]\n\n== Usage\n\nIn the simplest scenario, the action can be used without input parameters; you\njust need to check out your code first, using\nhttps://github.com/marketplace/actions/checkout[`actions/checkout`]:\n\n[source,yaml]\n----\njobs:\n  diktat_check:\n    name: 'diKTat Check'\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n\n      - uses: saveourtool/benedikt@v2\n----\n\n== Configuration\n\n[#config]\n=== `config`: custom configuration file\n\n* Default: `diktat-analysis.yml`\n* Required: **no**\n\nYou can override the name or the path of your YAML configuration file using the\n`config` input parameter, e. g.:\n\n[source,yaml]\n----\n      - uses: saveourtool/benedikt@v2\n        with:\n          config: path/to/diktat-analysis-custom.yml\n----\n\n[#reporter]\n=== `reporter`: requesting a type of reporter\n\nIf you wish, you can report errors in a different format.\n\n* Default: `sarif`\n* Required: **no**\n* Possible values: any of the following.\n\n** `sarif`: report errors in the\nhttps://github.com/microsoft/sarif-tutorials/blob/main/docs/1-Introduction.md#what-is-sarif[_SARIF_]\nformat. The output file will be named `report.sarif` and automatically uploaded\nto _GitHub_ using the https://github.com/github/codeql-action/tree/v2/upload-sarif[`upload-sarif`]\naction. This will enable the check results to be shown as annotations in the\npull request:\n+\nimage::sarif-reporting-pr.png[diKTat SARIF reporting (Pull Request)]\n+\nas well as in the _Code scanning alerts_ section of your repository:\n+\nimage::sarif-reporting-code-scanning-alerts.png[diKTat SARIF reporting (Code scanning alerts)]\n\n** `checkstyle`: this is the reporter of choice if you ever encounter issues\nwith the `sarif` reporter. Errors are reported in the\nhttps://github.com/checkstyle/checkstyle[_Checkstyle-XML_] format to the file\nnamed `checkstyle-report.xml`. The report is then consumed by the\nhttps://github.com/reviewdog/reviewdog[`reviewdog`] tool and uploaded to\n_GitHub_, resulting in code annotations similar to those produced by the `sarif`\nreporter:\n+\nimage::checkstyle-xml-reporting.png[Checkstyle-XML reporting assisted by reviewdog]\n\n[#input-paths]\n=== `input-paths`: custom source sets\n\n* Default: none\n* Required: **no**\n\nOne or more patterns which indicate the files or directories to check. Use a\nmultiline string to specify multiple inputs.\n\n* If an input is a path to a file, it is passed to _diKTat_ as-is:\n+\n[source,yaml]\n----\n      - uses: saveourtool/benedikt@v2\n        with:\n          input-paths: |\n            path/to/file.kt\n----\n\n* If an input is a path to a directory, the directory is recursively traversed,\nand all `\\*.kt` and `*.kts` files are passed to _diKTat_.\n+\n[source,yaml]\n----\n      - uses: saveourtool/benedikt@v2\n        with:\n          input-paths: |\n            src/main/kotlin\n            src/test/kotlin\n----\n* If an input is an https://ant.apache.org/manual/dirtasks.html#patterns[_Ant_-style\npath pattern] (such as `\\\\**/*.kt`), _diKTat_ expands it into the list of files\nthat match the path pattern. Path patterns may be negated, e. g.:\n`!src/\\**/*Test.kt` or `!src/\\**/generated/**`.\n+\n[source,yaml]\n----\n      - uses: saveourtool/benedikt@v2\n        with:\n          input-paths: |\n            **/*.kt\n            **/*.kts\n            !**/generated/**\n----\n\nIf this input parameter is not specified, this is equivalent to setting it to\n`.`, meaning _diKTat_ will check all `\\*.kt` and `*.kts` files in the project\ndirectory unless configured otherwise.\n\n[#java-setup]\n=== `java-distribution` and `java-version`: running _diKTat_ using a custom JVM\n\nIt's possible to run _diKTat_ with a custom JVM using the\nhttps://github.com/actions/setup-java[`actions/setup-java`] action. The\nfollowing input parameters may be specified:\n\n* `java-distribution`: the Java distribution, see the\nhttps://github.com/actions/setup-java/blob/main/README.md#supported-distributions[list\nof supported distributions].\n\n** Default: `temurin`\n** Required: **no**\n\n* `java-version`: the Java version to set up. Takes a whole or semver Java\nversion. See https://github.com/actions/setup-java/blob/main/README.md#supported-version-syntax[examples\nof supported syntax].\n\n** Default: none\n** Required: **no**\n\n[NOTE]\nSetting just the `java-distribution` property in order to use a custom\nJDK is not sufficient: you'll need to set **both** `java-distribution` **and**\n`java-version`:\n\n[source,yaml]\n----\n      - uses: saveourtool/benedikt@v2\n        with:\n          java-distribution: 'temurin'\n          java-version: 17\n----\n\n=== `fail-on-error`: suppressing lint errors\n\n* Default: `true`\n* Required: **no**\n\nIf `false`, the errors are still reported, but the step completes successfully.\nIf `true` (the default), then lint errors reported by _diKTat_ are considered\nfatal (i.e. the current step terminates with a failure):\n\n[source,yaml]\n----\n      - uses: saveourtool/benedikt@v2\n        with:\n          fail-on-error: true\n----\n\n[NOTE]\n\nThis flag only affects the case when _diKTat_ exits with code **1**. Higher\nlink:https://diktat.saveourtool.com/diktat-cli/#exit-codes[exit\ncodes] are _always_ fatal.\n\n=== `debug`: enabling debug logging\n\n* Default: `false`\n* Required: **no**\n\nDebug logging can be enabled by setting the `debug` input parameter to `true`:\n\n[source,yaml]\n----\n      - uses: saveourtool/benedikt@v2\n        with:\n          debug: true\n----\n\n== Outputs\n\nThe action returns the exit code of the command-line client using the\n`exit-code` output parameter, e. g.:\n\n[source,yaml]\n----\njobs:\n  diktat_check:\n    name: 'diKTat Check'\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n\n      - id: diktat\n        uses: saveourtool/benedikt@v2\n\n      - name: 'Read the exit code of diKTat'\n        if: ${{ always() }}\n        run: echo \"diKTat exited with code ${{ steps.diktat.outputs.exit-code }}\"\n        shell: bash\n----\n\nThe exit codes are documented\nlink:https://diktat.saveourtool.com/diktat-cli/#exit-codes[here].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaveourtool%2Fbenedikt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaveourtool%2Fbenedikt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaveourtool%2Fbenedikt/lists"}