• Stars
    star
    35
  • Rank 688,921 (Top 15 %)
  • Language
    Scala
  • Created over 7 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Codacy tool for Scalameta

Codacy Badge Build Status

Codacy scala.meta

This is the codacy engine for scala static code analysis build on top of scala.meta. Check the Docs section for more information.

Developing

implementing a new Pattern:

It 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. To create a testfile add it to the resources under docs/tests/ You can take a look at the already implemented tests in our base plugin

Next we implement the actual code. A pattern must currently reside in the package codacy.patterns and implement the codacy.base.Pattern interface. Which means it must implement the 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. A 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

Sometimes 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. The rules are:

  1. it needs to be a case class

  2. all arguments need to define defaults

  3. json readers and writers must exist for the argument types. (Currently that means primitive types and scala.util.matching.Regex)

Additional 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. For a full example check out the existing patterns

Quasiquotes:

https://github.com/scalameta/scalameta/blob/master/notes/quasiquotes.md

Tool Integration:

https://docs.codacy.com/related-tools/tool-developer-guide/

Testing with "sbt console":

import scala.meta._

val code = """ .... """

val tree = code.parse[Source]

codacy.patterns.Custom_Scala_ElseIf(tree)

//To see the tree structure:

tree.show[Structure]

Usage

You can create the docker by doing:

sbt docker:publishLocal

The docker is ran with the following command:

docker run -it -v $srcDir:/src  <DOCKER_NAME>:<DOCKER_VERSION>

Docs

Tool Developer Guide

Tool Developer Guide - Using Scala

Test

We use the codacy-plugins-test to test our external tools integration. You can follow the instructions there to make sure your tool is working as expected.

What is Codacy?

Codacy 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.

Among Codacy’s features:

  • Identify new Static Analysis issues
  • Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
  • Auto-comments on Commits and Pull Requests
  • Integrations with Slack, HipChat, Jira, YouTrack
  • Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories

Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.

Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.

Free for Open Source

Codacy is free for Open Source projects.

More Repositories

1

tools-for-code-review-engineers

A list of tools to improve the git workflow for code review engineers.
656
star
2

codacy-coverage-reporter

Multi-language coverage reporter for Codacy
Scala
124
star
3

git-version

Git versioning used in Codacy
Crystal
121
star
4

codacy-analysis-cli

Command line interface to execute Codacy code analysis locally
Scala
88
star
5

helm-ssm

Injects values from AWS SSM parameters on the values.yaml file
Go
64
star
6

codacy-coverage-reporter-action

GitHub Action for the codacy-coverage-reporter
53
star
7

codacy-analysis-cli-action

GitHub Action for the codacy-analysis-cli
52
star
8

docs

Codacy documentation
Python
18
star
9

sbt-codacy-coverage

Sbt plugin for uploading Scala code coverage to Codacy https://www.codacy.com
Scala
18
star
10

codacy-pylint

Pylint tool for Codacy
Python
15
star
11

ruby-codacy-coverage

DEPRECATED Post coverage results to Codacy
Ruby
13
star
12

codacy-eslint

Codacy tool for Eslint
TypeScript
12
star
13

chart

Codacy Helm chart and self-hosted infrastructure quickstart
Makefile
12
star
14

bitbucket-scala-client

Simple Bitbucket Scala Client
Scala
10
star
15

codacy-bandit

Bandit Python Tool for Codacy
Scala
8
star
16

codacy-api-scala

Scala wrapper for the Codacy API
Scala
6
star
17

codacy-plugins-test

Testing interface for external docker tools
Scala
6
star
18

codacy-sonar-csharp

Docker engine for SonarC# code analyzer
C#
6
star
19

csharp-codacy-coverage

DEPRECATED C# coverage reporter for Codacy
C#
6
star
20

codacy-codesniffer

Codacy tool for PHP Codesniffer
Scala
6
star
21

codacy-rubocop

Codacy Tool for Rubocop
Ruby
5
star
22

codacy-phpmd

PHP Mess Detector Tool for Codacy
Scala
5
star
23

codacy-checkstyle

Codacy Tool for Checkstyle
Scala
4
star
24

codacy-stylelint

Codacy Tool for Stylelint
Scala
4
star
25

codacy-metrics-scala-seed

Simple framework to help integrate metrics tools in Codacy
Scala
3
star
26

qa-frontend-challenge

TypeScript
3
star
27

codacy-sqlint

Codacy Tool for Sqlint
Scala
3
star
28

codacy-meta

Meta repository about general issues and plannings for Codacy OSS projects.
3
star
29

codacy-engine-scala-seed

Helpers to create Codacy engines in Scala
Scala
3
star
30

ytool

A simple tool to set values in yaml files preserving format and comments.
Python
3
star
31

codacy-gorevive

Codacy Tool for Golang Revive
Go
3
star
32

pulse-user-docs

HTML
3
star
33

base

Codacy Docker Base
Makefile
3
star
34

codacy-github-graphql

Library with Apollo compiled queries and models for GitHub API V4
Scala
3
star
35

codacy-metrics-sonar-csharp

Docker engine for metrics support on SonarC# code analyzer
C#
3
star
36

codacy-detekt

Codacy Tool for Detekt
Scala
3
star
37

akka-typed

Akka typed actors sample
Scala
2
star
38

api-tools

Docker with all the API tools used at Codacy
Makefile
2
star
39

codacy-brakeman

Codacy Tool for Brakeman
Scala
2
star
40

codacy-scalastyle

Scalastyle Scala Tool for Codacy
Scala
2
star
41

codacy-orbs

Codacy CircleCI Orbs
Shell
2
star
42

codacy-duplication-flay

Codacy Duplication tool for Flay
Ruby
2
star
43

codacy-engine-golang-seed

Go
2
star
44

Unity.Project

C#
2
star
45

codacy-pmd

PMD Tool for Codacy
Java
2
star
46

codacy-clang-tidy

Codacy's reporter for clang-tidy
Scala
2
star
47

codacy-usage-report

Go
2
star
48

helm-poll

An Helm plugin to poll for a release status.
Go
2
star
49

codacy-plugins-api

A dependency free api for Codacy Tools
Scala
2
star
50

codacy-engine-typescript-seed

Library to write Codacy tools in Typescript
TypeScript
2
star
51

pulse-event-cli

Command line interface to push events to the pulse service
Go
1
star
52

codacy-findbugs

Codacy Tool for Findbugs
Scala
1
star
53

codacy-prospector

Codacy Tool for Prospector
Python
1
star
54

codacy-meta-repo

Shell
1
star
55

codacy-people-csv

Script to download people in your Codacy organization
Scala
1
star
56

ci-base

Base docker image used by Codacy in Continuous Integration environments such as CircleCI.
Makefile
1
star
57

codacy-duplication-pmdcpd

Codacy Duplication Tool for PMD
Scala
1
star
58

env4config

Load Environment variables first as default with Typesafe Config
Scala
1
star
59

codacy-checkov

Codacy tool for Checkov
SuperCollider
1
star
60

About

Codacy - Ship high-quality code on more than 40 programming languages.
1
star
61

codacy-engine-csharp-seed

Helpers to create Codacy engines in C#
C#
1
star
62

codacy-public-template

1
star
63

ssm2eb

A simple tool to get ssm parameters to an .ebextensions file
Python
1
star
64

codacy-metrics-scalastyle

Scala
1
star
65

codacy-api-typescript

Typescript wrapper for the Codacy API
TypeScript
1
star
66

codacy-macros

Scala and Play Framework macros
Scala
1
star
67

codacy-eslint-legacy

Codacy Tool for ESLint (Legacy Version)
TypeScript
1
star
68

codacy-hadolint

Codacy Docker container for Hadolint tool
Scala
1
star
69

codacy-tailor

Tailor Swift Tool for Codacy
Swift
1
star
70

codacy-metrics-cloc

Cloc docker wrapper for Codacy integration
Scala
1
star
71

ci-aws

Docker image with awscli installed
Python
1
star
72

codacy-tsqllint

Codacy tool for TSQLLint
C#
1
star
73

codacy-aligncheck

Codacy Tool for Aligncheck
Scala
1
star
74

codacy-metrics-pmd

Java
1
star
75

elasticsearch-curator

Elasticsearch curator docker image
Dockerfile
1
star
76

codacy-roslyn

Codacy tool for Unity Roslyn Analyzers
Scala
1
star
77

codacy-duplication-scala-seed

Library to integrate duplication tools in Codacy
Scala
1
star
78

ssmeb

Go
1
star