{"id":19359812,"url":"https://github.com/codacy/codacy-engine-scala-seed","last_synced_at":"2025-06-16T07:04:02.744Z","repository":{"id":36788372,"uuid":"41095148","full_name":"codacy/codacy-engine-scala-seed","owner":"codacy","description":"Helpers to create Codacy engines in Scala","archived":false,"fork":false,"pushed_at":"2024-07-09T11:19:32.000Z","size":1267,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-20T11:43:53.838Z","etag":null,"topics":["analysis","codacy","codacy-engine","docker","engine","engine-scala-seed","review","scala","seed"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-20T12:44:16.000Z","updated_at":"2024-06-11T09:13:27.000Z","dependencies_parsed_at":"2023-01-17T04:48:35.955Z","dependency_job_id":"a671c18e-62d9-4a79-852e-5d2a0fce0215","html_url":"https://github.com/codacy/codacy-engine-scala-seed","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-engine-scala-seed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-engine-scala-seed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-engine-scala-seed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-engine-scala-seed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codacy","download_url":"https://codeload.github.com/codacy/codacy-engine-scala-seed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250425594,"owners_count":21428584,"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":["analysis","codacy","codacy-engine","docker","engine","engine-scala-seed","review","scala","seed"],"created_at":"2024-11-10T07:16:15.529Z","updated_at":"2025-04-23T11:32:56.213Z","avatar_url":"https://github.com/codacy.png","language":"Scala","readme":"# Engine Scala Seed\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bc3a79d1b12649158a1eb4758e872141)](https://www.codacy.com/gh/codacy/codacy-engine-scala-seed?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=codacy/codacy-engine-scala-seed\u0026amp;utm_campaign=Badge_Grade)\n[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/bc3a79d1b12649158a1eb4758e872141)](https://www.codacy.com/gh/codacy/codacy-engine-scala-seed?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=codacy/codacy-engine-scala-seed\u0026utm_campaign=Badge_Coverage)\n[![Build Status](https://circleci.com/gh/codacy/codacy-engine-scala-seed.svg?style=shield\u0026circle-token=:circle-token)](https://circleci.com/gh/codacy/codacy-engine-scala-seed)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.codacy/codacy-engine-scala-seed_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.codacy/codacy-engine-scala-seed_2.12)\n\nFramework to help integration with external analysis tools at Codacy. \nThese tools provide the issues you can see on Codacy after an analysis is completed.\n\nFor more details and examples of tools that use this project, you can check:\n* [PMD](https://github.com/codacy/codacy-pmd)\n* [ESLint](https://github.com/codacy/codacy-eslint)\n* [Pylint](https://github.com/codacy/codacy-pylint)\n\n## Usage\n\nAdd to your SBT dependencies:\n\n```scala\n\"com.codacy\" %% \"codacy-engine-scala-seed\" % \"\u003cVERSION\u003e\"\n```\n\n## Docs\n\n### How to integrate an external analysis tool on Codacy\n\n#### Requirements\n\n* Docker definition with the tool you want to integrate\n* Define the documentation for the patterns provided by the tool\n\n#### Assumptions and Behaviour\n\n* To run the tool we provide the configuration file, `/.codacyrc`, with the language to run and optional parameters a tool might need.\n* The source code to be analysed will be located in `/src`, meaning that when provided in the configuration, the file paths are relative to `/src`.\n\n* **Structure of the .codacyrc file:**\n  * **files:** Files to be analysed (their path is relative to `/src`)\n  * **tools:** Array of tools\n    * **name:** Unique identifier of the tool. This will be provided by the tool in patterns.json file.\n    * **patterns:** Array of patterns that must be checked\n      * **patternId:** Unique identifier of the pattern\n      * **parameters:** Parameters of the pattern\n        * **name:** Unique identifier of the parameter\n        * **value:** Value to be used as parameter value\n\n```json\n{\n  \"files\" : [\"foo/bar/baz.js\", \"foo2/bar/baz.php\"],\n  \"tools\":[\n    {\n      \"name\":\"jshint\",\n      \"patterns\":[\n        {\n          \"patternId\":\"latedef\",\n          \"parameters\":[\n            {\n              \"name\":\"latedef\",\n              \"value\":\"vars\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n```\n\nRegarding the configuration file, the tool should have different behaviours for the following situations:\n* If `/.codacyrc` exists and has files and patterns, use them to run.\n* If `/.codacyrc` exists and only has patterns and no files, use the patterns to invoke the tool for all files from /src\n(files should be searched recursively for all folders in /src).\n* If `/.codacyrc` exists and has only files and no patterns, run only for those files and look \nfor the tool's native configuration file, if the tool supports it.\n* If `/.codacyrc` does not exist or any of its contents (files or patterns) is not available, \nyou should invoke the tool for all files from /src (files should be searched recursively for all folders in /src) \nand check them with the tool's native configuration file, if it is supported and if it exists. Otherwise, run the tool with the default patterns.\n* If `/.codacyrc` fails to be parsed, throw an error.\n\n**Exit codes**\n* The exit codes can be different, depending if the tool invocation is successful or not:\n  * :tada: **0**: The tool executed successfully\n  * :cold_sweat: **1**: An unknown error occurred while running the tool \n  * :alarm_clock: **2**: Execution timeout\n\n**Notes:**\n\n* To run the tool in debug mode, so you can have more detailed logs, you need to 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 variable `TIMEOUT` when invoking the docker, setting it with values like `10 seconds`, `30 minutes` or `2 hours`.\n\n## Setup\n1. Write the docker file that will run the tool.\n   * It must have a binary entry point without any parameters.\n     * Notice that if you decide to use this seed, you can use the [**sbt-native-packager**](https://github.com/sbt/sbt-native-packager) plugin\n     and run `sbt docker:publishLocal` that generates the dockerfile automatically and publishes the docker locally.\n\n2. Write a patterns.json with the configuration of your tool.\n    * This file must be located on /docs/patterns.json.\n      * **name:** Unique identifier of the tool (lower-case letters without spaces)\n      * **version:** Tool version to display in the Codacy UI\n      * **patterns:** The patterns that the tool provides\n          * **patternId:** Unique identifier of the pattern (lower-case letters without spaces)\n          * **level:** Severity level of the issue \n          * **category:** Category of the issue \n          * **parameters:** Parameters received by the pattern\n            * **name:** Unique identifier of the parameter (lower-case letters without spaces)\n            * **default:** Default value of the parameter\n    ```json\n    {\n      \"name\":\"jshint\",\n      \"version\": \"1.2.3\",\n      \"patterns\":[\n        {\n          \"patternId\": \"latedef\",\n          \"category\": \"ErrorProne\",\n          \"parameters\": [\n            {\n              \"name\": \"latedef\",\n              \"default\": \"nofunc\"\n            }\n          ],\n          \"level\": \"Warning\"\n        }\n      ]\n    }\n    ```\n    #### Levels and Categories\n    For level types we have:\n    * Error\n    * Warning\n    * Info\n    \n    For category types we have:\n    * ErrorProne\n    * CodeStyle\n    * Complexity\n    * UnusedCode\n    * Security\n    * Compatibility\n    * Performance\n    * Documentation\n    * BestPractice\n\n3. Write the code to run the tool\nYou don't have to use this seed and you can write the code in any language you want but, you have to invoke the tool according to the configuration.\nAfter you have your results from the tool, you should print them to the standard output in our Result format, one result per line.\n    * The filename should **not** include the prefix \"/src/\". Example: \n        * absolute path: /src/folder/file.js\n        * filename path: folder/file.js\n    ```json\n    {\n      \"filename\":\"codacy/core/test.js\",\n      \"message\":\"found this in your code\",\n      \"patternId\":\"latedef\",\n      \"line\":2\n    }\n    ```\n    * If you are not able to run the analysis for any of the files requested you should return an error for each one of them to the standard output in our Error format.\n    ```json\n    {\n      \"filename\":\"codacy/core/test.js\",\n      \"message\":\"could not parse the file\"\n    }\n    ```\n\n## Tool Documentation\nAt Codacy we strive to provide the best value to our users and, to accomplish that, we document our patterns so that the user can better understand the problem and fix it.\n\nAt this point, your tool has everything it needs to run, but there is one other really important thing that you should do before submitting your docker: the documentation for your tool.\n\nYour files for this section should be placed in /docs/description/.\n\nIn order to provide more details you can create:\n* A single /docs/description/description.json file.\n* A /docs/description/\u003cPATTERN-ID\u003e.md file for each pattern. \nThis documentation should also be generated automatically to avoid having to go through all of the files each time it needs to be updated.\n\nIn the description.json you define the title for the pattern, brief description, time to fix (in minutes), and also a description of the parameters in the following format:    \n```json\n[\n  {\n    \"patternId\": \"latedef\",\n    \"title\": \"Enforce variable def before use\",\n    \"description\": \"Prohibits the use of a variable before it was defined.\",\n    \"parameters\": [\n      {\n        \"name\": \"latedef\",\n        \"description\": \"Declaration order verification. Check all [true] | Do not check functions [nofunc]\"\n      }\n    ],\n    \"timeToFix\": 10\n  }\n]\n```\n\nTo give a more detailed explanation about the issue, you should define the \u003cPATTERN-ID\u003e.md. Example:\n\n```markdown\nFields in interfaces are automatically public static final, and methods are public abstract.\nClasses or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static).\n\nFor historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.\n\nEx:\n\n    public interface Foo {\n        public abstract void bar();         // both abstract and public are ignored by the compiler\n        public static final int X = 0;         // public, static, and final all ignored\n        public static class Bar {}             // public, static ignored\n        public static interface Baz {}         // ditto\n        \n        void foo();                            //this is correct\n    }\n\n    public class Bar {\n        public static interface Baz {} // static ignored\n    }\n\n[Source](http://pmd.sourceforge.net/pmd-5.3.2/pmd-java/rules/java/unusedcode.html#UnusedModifier)\n```\n\nYou should explain the what and why of the issue. Adding an example is always a nice way to help other people understand the problem. For a more thorough explanation you can also add a link at the end referring a more complete source.\n\n## Test\n\nFollow the instructions at [codacy-plugins-test](https://github.com/codacy/codacy-plugins-test/blob/master/README.md#test-definition).\n\n## Dockerizing\n\n**Running the docker**\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\u003cYOUR-DOCKER-NAME\u003e:\u003cYOUR-DOCKER-VERSION\u003e\n```\n\n**Docker restrictions**\n* Docker image size should not exceed 500MB\n* Docker should contain a non-root user named docker with UID/GID 2004\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 in 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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-engine-scala-seed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodacy%2Fcodacy-engine-scala-seed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-engine-scala-seed/lists"}