{"id":19359899,"url":"https://github.com/codacy/codacy-metrics-example-tool","last_synced_at":"2025-02-24T12:17:18.364Z","repository":{"id":44167562,"uuid":"225915373","full_name":"codacy/codacy-metrics-example-tool","owner":"codacy","description":"Docker engine example for a codacy metrics tool","archived":false,"fork":false,"pushed_at":"2022-02-11T10:47:56.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-02-16T11:28:01.033Z","etag":null,"topics":["codacy","codacy-tool","docker","engine","example","metrics","tool"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codacy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2019-12-04T16:55:24.000Z","updated_at":"2022-02-11T10:03:59.000Z","dependencies_parsed_at":"2022-09-03T17:51:55.980Z","dependency_job_id":null,"html_url":"https://github.com/codacy/codacy-metrics-example-tool","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-metrics-example-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-metrics-example-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-metrics-example-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-metrics-example-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codacy","download_url":"https://codeload.github.com/codacy/codacy-metrics-example-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240475237,"owners_count":19807292,"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":["codacy","codacy-tool","docker","engine","example","metrics","tool"],"created_at":"2024-11-10T07:16:28.288Z","updated_at":"2025-02-24T12:17:18.345Z","avatar_url":"https://github.com/codacy.png","language":"Shell","readme":"# Codacy Metrics Example Tool\n\nDocker engine example for a codacy metrics tool\n\n## Documentation\n\n### How to integrate an external metrics tool on Codacy\n\nBy creating a docker and writing code to handle the tool invocation and output,\nyou can integrate the tool of your choice on Codacy!\n\n\u003e To know more about dockers, and how to write a docker file please refer to\n\u003e [https://docs.docker.com/reference/builder/](https://docs.docker.com/reference/builder/)\n\nIn this tutorial, we explain how you can integrate a metrics tool of your choice\nin Codacy. You can check the code of an already implemented tool and if you wish\nfork it to start your own. You are free to modify and use it for your own tools.\n\n### Structure\n\n* To run the tool we provide the configuration file, `/.codacyrc`, with the\n  language to run and optional parameters your tool might need.\n* The source code to be analysed will be located in `/src`, meaning that when\n  provided in the configuration, the file paths are relative to `/src`.\n\n#### Structure of `.codacyrc` file\n\n* **files:** Files to be analysed (their path is relative to `/src`)\n* **language:** Language to run the tool\n\nCheck the schema [here](schemas/codacyrc_schema.json).\n\n```json\n{\n  \"files\" : [ \"foo/bar/baz.scala\", \"foo2/bar/baz.scala\" ],\n  \"language\": \"Scala\"\n}\n```\n\n##### General tool behavior\n\n**Exit codes**:\n\n* The exit codes can be different, depending if the tool invocation is\n  successful or not:\n  * **0**: The tool executed successfully :tada:\n  * **1**: An unknown error occurred while running the tool :cold_sweat:\n  * **2**: Execution timeout :alarm_clock:\n\n**Environment variables**:\n\n* To run the tool in debug mode, so you can have more detailed logs, you need to\n  set the environment variable `DEBUG` to `true` when invoking the docker.\n* To configure a different timeout for the tool, you have to set the environment\n  variable `TIMEOUT_SECONDS` when you run the docker image, setting it with values\n  like `10` or `1800` (30 minutes).\n\n#### Output\n\nYou are free to write the code running inside the docker in the language you\nprefer. After you have your results from the tool, you should print them to the\nstandard output in our **Result** format ([schema](schemas/output_schema.json)), one result per line. Example:\n\n```json\n{\n  \"filename\": \"path/to/my/file1.scala\",\n  \"complexity\": 1,\n  \"loc\": 300,\n  \"cloc\": 320,\n  \"nrMethods\": 20,\n  \"nrClasses\": 2,\n  \"lineComplexities\": [\n    {\n      \"line\": 2,\n      \"value\": 3\n    }\n  ]\n}\n```\n\n\u003e The filename should not include the prefix `/src/`, the absolute path\n\u003e `/src/folder/file.js` should be returned as `folder/file.js`.\n\n#### Submit the Docker\n\n**Running the docker**:\n\n```bash\ndocker run -t \\\n--net=none \\\n--privileged=false \\\n--cap-drop=ALL \\\n--user=docker \\\n--rm=true \\\n-v \u003cPATH-TO-FOLDER-WITH-FILES-TO-CHECK\u003e:/src:ro \\\n-v \u003cPATH-TO-CODACYRC\u003e:/.codacyrc:ro \\\n\u003cYOUR-DOCKER-NAME\u003e:\u003cYOUR-DOCKER-VERSION\u003e\n```\n\n**Docker restrictions**:\n\n* Docker image size should not exceed 500MB\n* Docker should contain a non-root user named docker with UID/GID 2004\n* All the source code of the docker must be public\n* The docker base must officially be supported on DockerHub\n* Your docker must be provided in a repository through a public git host (ex:\n  GitHub, Bitbucket, ...)\n\n**Docker submission**:\n\n* To submit the docker you should send an email to support@codacy.com with the\n  link to the git repository with your docker definition.\n* The docker will then be subjected to a review by our team and we will then\n  contact you with more details.\n\n#### Test\n\nFollow the instructions at\n[codacy-plugins-test](https://github.com/codacy/codacy-plugins-test/blob/master/README.md#test-definition).\n\nIf you have any question or suggestion regarding this guide please contact us at\nsupport@codacy.com.\n\n## What is Codacy\n\n[Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors\nyour technical debt, helps you improve your code quality, teaches best practices\nto 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\n  also direct git repositories)\n* Auto-comments on Commits and Pull Requests\n* Integrations with Slack, HipChat, Jira, YouTrack\n* Track issues in Code Style, Security, Error Proneness, Performance, Unused\n  Code and other categories\n\nCodacy also helps keep track of Code Coverage, Code Duplication, and Code\nComplexity.\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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-metrics-example-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodacy%2Fcodacy-metrics-example-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-metrics-example-tool/lists"}