Code Patterns

As a wise man once said, "You can't please everyone", and that is true for code patterns. But don't you worry! You can fully customize Codacy to match your expectations.

A Code Pattern is an algorithm that Codacy uses to detect issues in your project.

 

1. Pattern details and filters


 

Each pattern has a title and a short description. To see a detailed explanation you can click on Show Details in the top right corner (mouse over the pattern and the Show Details option will appear):

 


 

The pattern explanation shows more detail about the issues it can detect and how to fix them.

You can filter the patterns by category using the side menu:

 


The issues detected by Codacy belong to 8 different categories:

Code Style - Code formatting and syntax problems. Ex: variable name style, enforce the use of brackets and quotation marks

Error Prone - Code that may hide bugs and language keywords that should be used with caution. Ex: == in Javascript or Option.get in Scala

Code Complexity - Highly complex methods and classes that should be refactored

Performance - Code that could have performance problems

Compatibility - Used mainly for frontend code, detects compatibility problems across different browser versions

Unused Code - Unused variables and methods, code that can't be reached

Security - Security problems

Documentation - Detects methods and classes that do not have the correct comment annotations

 

2. Configure your project patterns


 

To configure the patterns used to analyse your project simply click on the checkbox on the left of the title:

 


 

When you change the enabled patterns you can reanalyse your project. To do that, just enter the latest commit from your list on the Commit view and click to reanalyse

 

 

4. Where What? Account vs Project Patterns


We already have selected a collection of patterns so that you get the most satisfying experience out of the box. But, in case you want to customize the patterns you use, you can do so by Account or by Project.

Account Patterns

Here you can choose the patterns you like, for all the languages available on our website. These are the default patterns that new projects will use. Account Settings -> Default Patterns

 


Account Patterns

Project Patterns

Here you can specify the patterns you want to use on each project. This selection of patterns is not affected when you change your account patterns. Code patterns on the Project view


Project Patterns

  

5. I already have my tool configuration


If you have configuration files for your static analysis tool of choice, you can add it to your repository (and Codacy will pick it up automatically).

Supported Configuration files

Codacy currently supports configuration files for several tools. If you add your configuration file to your repository, Codacy will pick it up and use it.

The known file names for each tool are the following:

 

 

Tool name Language Files detected Other info
CSSLint CSS .csslintrc  
Checkstyle Java checkstyle.xml  
Findbugs Java findbugs.xml, findbugs-includes.xml, findbugs-excludes.xml  
PMD Apex, Java, Javascript, JSP, XML and Velocity ruleset.xml, apex-ruleset.xml  
ESLint JavaScript .eslintrc.yaml, .eslintrc.yml, .eslintrc.json, .eslintrc, .eslintrc.js Plugins 
JSHint JavaScript .jshintrc  
PHP CodeSniffer PHP  phpcs.xml, phpcs.xml.dist  
PHPMD PHP  codesize.xml  
Bandit  Python  bandit.yml   
Pylint Python pylintrc, .pylintrc  Plugins 
Prospector Python .landscape.yml, .landscape.yaml, landscape.yml, landscape.yaml,
.prospector.yml, .prospector.yaml, prospector.yml ,prospector.yaml
 
Brakeman Ruby  config/brakeman.yml  
Rubocop Ruby  .rubocop.yml, rubocop.yml   
ScalaStyle Scala  scalastyle_config.xml, scalastyle-config.xml   
SCSSLint SASS  .scss-lint.yml   
Tailor Swift   .tailor.yml  
TSLint TypeScript   tslint.json  
Hadolint Docker Dockerfile  
Stylelint LESS, SASS, CSS .stylelintrc, stylelint.config.js, .stylelintrc.json, .stylelintrc.yaml, .stylelintrc.js  
Have more questions? Submit a request

0 Comments

Article is closed for comments.