{"id":19359830,"url":"https://github.com/codacy/codacy-scalameta","last_synced_at":"2025-04-23T11:32:57.919Z","repository":{"id":44617703,"uuid":"61126945","full_name":"codacy/codacy-scalameta","owner":"codacy","description":"Codacy tool for Scalameta","archived":false,"fork":false,"pushed_at":"2023-09-19T16:35:07.000Z","size":258,"stargazers_count":33,"open_issues_count":1,"forks_count":17,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-20T11:43:57.621Z","etag":null,"topics":["analysis","codacy","docker","engine","meta","scala","scala-meta","scalameta","static-analysis","tree"],"latest_commit_sha":null,"homepage":"","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":"2016-06-14T13:54:18.000Z","updated_at":"2025-01-30T15:48:09.000Z","dependencies_parsed_at":"2024-01-05T21:58:18.350Z","dependency_job_id":null,"html_url":"https://github.com/codacy/codacy-scalameta","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-scalameta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-scalameta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-scalameta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codacy%2Fcodacy-scalameta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codacy","download_url":"https://codeload.github.com/codacy/codacy-scalameta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250425601,"owners_count":21428585,"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","docker","engine","meta","scala","scala-meta","scalameta","static-analysis","tree"],"created_at":"2024-11-10T07:16:17.256Z","updated_at":"2025-04-23T11:32:57.355Z","avatar_url":"https://github.com/codacy.png","language":"Scala","readme":"[![Codacy Badge](https://api.codacy.com/project/badge/Grade/72869cd556c54624bcb36058c72d8371)](https://www.codacy.com/gh/codacy/codacy-scalameta?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=codacy/codacy-scalameta\u0026amp;utm_campaign=Badge_Grade)\n[![Build Status](https://circleci.com/gh/codacy/codacy-scalameta.svg?style=shield\u0026circle-token=:circle-token)](https://circleci.com/gh/codacy/codacy-scalameta)\n\n# Codacy scala.meta\n\nThis is the [codacy](https://www.codacy.com/) engine for scala static code analysis build on top of scala.meta.\nCheck the **Docs** section for more information.\n\n## Developing\n\nimplementing a new Pattern:\n\nIt is usually a good idea to start by implementing the test file. It contains issues the new pattern should detect as well as implementations that correct said issues. This defines the constraints of what the pattern should and also should not detect and helps avoid false positives.\nTo create a testfile add it to the resources under docs/tests/\nYou can take a look at the already implemented tests in our [base plugin](https://github.com/codacy/codacy-scalameta/tree/master/patterns-base/src/main/resources/docs/tests)\n\nNext we implement the actual code. A pattern must currently reside in the package ```codacy.patterns```\nand implement the ```codacy.base.Pattern``` interface. Which means it must implement the\n```def apply(tree:Tree):Iterable[Result]```. In most cases the ```collect``` method on trees that scala.meta provides us with is sufficient for that purpose.\nA ```Result``` consist of a ```Message``` (which itself is just a type-wrapped String) and a ```Positionable``` which can currently be implicitly obtained by passing a ```scala.meta.Tree``` or a ```scala.meta.Token```\n\nSometimes one might want to change the behavior of the pattern according to some configuration. Such a configuration has to follow some basic rules and gets passed to the pattern as the only argument in the constructor.\nThe rules are:\n\n1) it needs to be a case class\n\n2) all arguments need to define defaults\n\n3) json readers and writers must exist for the argument types. (Currently that means primitive types and ```scala.util.matching.Regex```)\n\nAdditional steps can be found in the chapter Tool Integration with one exeption: there is no need to explicitly add pattern parameters to patterns defined in ```patterns.json``` since that's already being covered by rule 2 of the configuration rules.\nFor a full example check out the [existing patterns](https://github.com/codacy/codacy-scalameta/tree/master/patterns-base/src/main)\n\n### Quasiquotes:\nhttps://github.com/scalameta/scalameta/blob/master/notes/quasiquotes.md\n\n### Tool Integration:\nhttps://docs.codacy.com/related-tools/tool-developer-guide/\n\n### Testing with \"sbt console\":\n\n```\nimport scala.meta._\n\nval code = \"\"\" .... \"\"\"\n\nval tree = code.parse[Source]\n\ncodacy.patterns.Custom_Scala_ElseIf(tree)\n\n//To see the tree structure:\n\ntree.show[Structure]\n```\n\n## Usage\n\nYou can create the docker by doing:\n\n```\nsbt docker:publishLocal\n```\n\nThe docker is ran with the following command:\n\n```\ndocker run -it -v $srcDir:/src  \u003cDOCKER_NAME\u003e:\u003cDOCKER_VERSION\u003e\n```\n\n## Docs\n\n[Tool Developer Guide](https://support.codacy.com/hc/en-us/articles/207994725-Tool-Developer-Guide)\n\n[Tool Developer Guide - Using Scala](https://support.codacy.com/hc/en-us/articles/207280379-Tool-Developer-Guide-Using-Scala)\n\n## Test\n\nWe use the [codacy-plugins-test](https://github.com/codacy/codacy-plugins-test) to test our external tools integration.\nYou can follow the instructions there to make sure your tool is working as expected.\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-scalameta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodacy%2Fcodacy-scalameta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodacy%2Fcodacy-scalameta/lists"}