{"id":19359878,"url":"https://github.com/codacy/codacy-clang-tidy","last_synced_at":"2025-04-23T11:33:00.211Z","repository":{"id":46723502,"uuid":"237006453","full_name":"codacy/codacy-clang-tidy","owner":"codacy","description":"Codacy's reporter for clang-tidy","archived":false,"fork":false,"pushed_at":"2023-12-13T10:26:25.000Z","size":634,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-20T11:43:52.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codacy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-01-29T14:48:41.000Z","updated_at":"2024-08-02T17:26:51.000Z","dependencies_parsed_at":"2023-12-12T18:58:20.272Z","dependency_job_id":null,"html_url":"https://github.com/codacy/codacy-clang-tidy","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-clang-tidy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-clang-tidy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-clang-tidy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-clang-tidy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codacy","download_url":"https://codeload.github.com/codacy/codacy-clang-tidy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250425613,"owners_count":21428588,"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":[],"created_at":"2024-11-10T07:16:25.840Z","updated_at":"2025-04-23T11:32:59.039Z","avatar_url":"https://github.com/codacy.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Codacy Badge](https://api.codacy.com/project/badge/Grade/925c0ee779c34261b7d1c2935ca95ae5)](https://www.codacy.com/gh/codacy/codacy-clang-tidy?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=codacy/codacy-clang-tidy\u0026utm_campaign=Badge_Grade)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/925c0ee779c34261b7d1c2935ca95ae5)](https://www.codacy.com/gh/codacy/codacy-clang-tidy?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=codacy/codacy-clang-tidy\u0026utm_campaign=Badge_Coverage)\n\n# codacy-clang-tidy\n\nA standalone tool that converts [Clang-Tidy](https://clang.llvm.org/extra/clang-tidy/)\ndiagnostics to Codacy's format.\n\nIt allows running Clang-Tidy either locally or as part of your CI process and then integrating the results into your Codacy workflow. This way, Codacy will present the results coming from Clang-Tidy alongside all the other code quality information in the dashboards.\n\n## Usage\n\n### Requirements\n\nTo get your Clang-Tidy results into Codacy you'll need to:\n\n-   [Enable Clang-Tidy](https://docs.codacy.com/repositories-configure/configuring-code-patterns/) and configure the corresponding code patterns on your repository **Code patterns** page\n-   Enable the setting **Run analysis through build server** on your repository **Settings**, tab **General**, **Repository analysis**\n-   Obtain a [project API token](https://docs.codacy.com/codacy-api/api-tokens/#project-api-tokens)\n-   Download [codacy-clang-tidy](https://github.com/codacy/codacy-clang-tidy/releases)\n\n### Sending the results to Codacy\n\nSending the results of running Clang-Tidy to Codacy involves the steps below, which you can automate in your CI build process:\n\n1.  Run Clang-Tidy\n2.  Convert the Clang-Tidy output to a format that the Codacy API accepts\n3.  Send the results to Codacy\n4.  Finally, signal that Codacy can use the sent results and start a new analysis\n\n\u003e When the option **“Run analysis through build server”** is enabled, the Codacy analysis will not start until you call the endpoint `/2.0/commit/{commitUuid}/resultsFinal` signalling that Codacy can use the sent results and start a new analysis.\n\nWith script:\n\n```bash\nexport PROJECT_TOKEN=\"YOUR-TOKEN\"\nexport COMMIT=\"COMMIT-UUID\"\nexport CODACY_URL=\"CODACY-INSTALLATION-URL\" # if not defined https://api.codacy.com will be used\nexport CODACY_CLANG_TIDY_VERSION=0.2.3 # if not defined, latest will be used\n\nclang-tidy \"\u003cclang-tidy-configs\u003e\" | \\\n./\u003ccodacy-clang-tidy-path\u003e/scripts/send-results.sh # requires a codacy-clang-tidy-\"\u003cversion\u003e\" in the current directory\n```\n\nWithout script (step-by-step):\n\n```bash\nexport PROJECT_TOKEN=\"YOUR-TOKEN\"\nexport COMMIT=\"COMMIT-UUID\"\n\n# 1. Run Clang-Tidy\nclang-tidy \"\u003cclang-tidy-configs\u003e\" | \\\n# 2. Convert the Clang-Tidy output to a format that the Codacy API accepts\n./codacy-clang-tidy-\"\u003cversion\u003e\" | \\\n# 3. Send the results to Codacy\ncurl -XPOST -L -H \"project-token: $PROJECT_TOKEN\" \\\n    -H \"Content-type: application/json\" -d @- \\\n    \"https://api.codacy.com/2.0/commit/$COMMIT/issuesRemoteResults\"\n\n# 4. Signal that Codacy can use the sent results and start a new analysis\ncurl -XPOST -L -H \"project-token: $PROJECT_TOKEN\" \\\n\t-H \"Content-type: application/json\" \\\n\t\"https://api.codacy.com/2.0/commit/$COMMIT/resultsFinal\"\n```\n\nFor self-hosted installations:\n\n```bash\nexport PROJECT_TOKEN=\"YOUR-TOKEN\"\nexport COMMIT=\"COMMIT-UUID\"\nexport CODACY_URL=\"CODACY-INSTALLATION-URL\"\n\n# 1. Run Clang-Tidy\nclang-tidy \"\u003cclang-tidy-configs\u003e\" | \\\n# 2. Convert the Clang-Tidy output to a format that the Codacy API accepts\n./codacy-clang-tidy-\"\u003cversion\u003e\" | \\\n# 3. Send the results to Codacy\ncurl -XPOST -L -H \"project-token: $PROJECT_TOKEN\" \\\n    -H \"Content-type: application/json\" -d @- \\\n    \"$CODACY_URL/2.0/commit/$COMMIT/issuesRemoteResults\"\n\n# 4. Signal that Codacy can use the sent results and start a new analysis\ncurl -XPOST -L -H \"project-token: $PROJECT_TOKEN\" \\\n\t-H \"Content-type: application/json\" \\\n\t\"$CODACY_URL/2.0/commit/$COMMIT/resultsFinal\"\n```\n\n## Command line flags\n\n`codacy-clang-tidy` accepts as command line arguments:\n\n-   `--encoding \u003cENCODING\u003e` or `-e \u003cENCODING\u003e` - encoding to use when parsing the input (default: `UTF-8`). The encoding should be one of the possible [Java Charsets](https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html#java.nio.charset.Charset).\n    Example: \n\n    ```bash\n    ./codacy-clang-tidy-\"\u003cversion\u003e\" --encoding LATIN1\n    ```\n\n## Building\n\n##### Compile\n\n`sbt compile`\n\n##### Format\n\n`sbt \";scalafmt;test:scalafmt;sbt:scalafmt\"`\n\n##### Tests\n\n`sbt test`\n\n##### Build native image (requires docker)\n\n`sbt \"nativeImage\"`\n\n##### Build fat-jar\n\n`sbt assembly`\n\n##### Update documentation\n\nIf you want to change versions before generating the docs you can do it by\nchanging the `llvmVersion` value in `doc-generator/src/main/scala/Main.scala`\n\n`sbt doc-generator/run`\n\n## Troubleshooting\n\n### `java.nio.charset.MalformedInputException: Input length = 1` while calling codacy-clang-tidy\n\nClang-Tidy may return a different encoding as output than the default used by codacy-clang-tidy. You can specify the encoding to use on codacy-clang-tidy:\n\n```bash\n./codacy-clang-tidy-\"\u003cversion\u003e\" --encoding \u003cENCODING\u003e\n```\n\n## What is Codacy?\n\n[Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.\n\n### Among Codacy’s features:\n\n-   Identify new Static Analysis issues\n-   Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)\n-   Auto-comments on Commits and Pull Requests\n-   Integrations with Slack, HipChat, Jira, YouTrack\n-   Track issues Code Style, Security, Error Proneness, Performance, Unused Code and other categories\n\nCodacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.\n\nCodacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.\n\n### Free for Open Source\n\nCodacy is free for Open Source projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-clang-tidy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodacy%2Fcodacy-clang-tidy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-clang-tidy/lists"}