Skip to content

Codacy configuration file

Codacy supports configuring certain advanced features through a configuration file:

  • Ignoring files globally, for certain categories (duplication or metrics) or for a specific tool

    The category metrics refers to the information you find under File details such as Size, Structure and Complexity.

  • Configuring a specific repository directory on which to start the analysis

  • Adding custom extensions to languages, keeping in mind that some tools might not work out of the box with those extensions

Note

  • If a Codacy configuration file exists in your repository, the Ignored Files settings in the Codacy UI don't apply.
  • To disable a tool you must use the Code Patterns page instead.

To use a Codacy configuration file:

  1. Create a text file with the name .codacy.yml or .codacy.yaml on the root of your repository.

  2. Add your settings to the configuration file based on the example template below.

    Important

    The configuration file must start with a line containing a triple dash (---).

    ---
    engines:
      rubocop:
        exclude_paths:
          - config/engines.yml
        base_sub_dir: test/baseDir
      duplication:
        exclude_paths:
          - config/engines.yml
      metric:
        exclude_paths:
          - config/engines.yml
    languages:
      css:
        extensions:
          - '-css.resource'
    exclude_paths:
      - '.bundle/**'
      - 'spec/**/*'
      - 'benchmarks/**/*'
      - '**.min.js'
      - '**/tests/**'
    
  3. Optionally, validate the syntax of your configuration file with the Codacy Analysis CLI by running the following command in the same folder as the Codacy configuration file:

    codacy-analysis-cli validate-configuration --directory `pwd`
    

Syntax for excluding files

To ignore files, you must use the following Java glob syntax to define one or more exclude_paths patterns:

Pattern Ignored files
\*\*.extension All files with the same extension across all your repository
test/\* All files in the root of test
test/\*\* All files and directories inside test
test/\*\*/\* All files inside sub-directories of test
\*\*/\*.resource All .resource files in all directories and sub-directories

Which tools can be configured and which name should I use?

You can configure all tools supported by Codacy using the configuration file.

The following are the tool names that must be used in the Codacy configuration file:

ameba
bandit
brakeman
bundleraudit
checkstyle
codacy-scalameta-pro
codenarc
coffeelint
cppcheck
credo
csslint
detekt
eslint
findbugs
findbugssec
flawfinder
golint
govet
hadolint
jacksonlinter
jshint
nsp
phpcs
phpmd
pmd-legacy
pmd
prospector
psscriptanalyzer
pylint
pylintpython3
remark-int
rubocop
scalastyle
scsslint
shellcheck
sonarscharp
spotbugs
SQLint
stylelint
swiftlint
tailor
tslint
tsqllint

If you have questions about the Codacy configuration file please contact us at support@codacy.com.

Feedback

Did this page help you?

Thank you for the feedback!

We're sorry to hear that. Please let us know what we can improve.

If you have a question, please contact support@codacy.com.

Last modified January 7, 2021