Codacy Configuration File

Codacy supports configuring certain advanced features through a configuration file.

Currently, you can exclude files using globs and add custom extensions to languages. 

You can ignore files globally, for certain categories (duplication, metrics or coverage) or for a specific tool (e.g.: Rubocop).

To add custom extensions to a language you can also add an entry in this file, but keep in mind that some tools might not work out of the box with those extensions and might need changes.

If you want to disable an engine that needs to be done directly in the Code Patterns page.

The file name must be ".codacy.yaml" or ".codacy.yml" and should be placed in the root of your project.

---
engines:
 rubocop:
   enabled: true
   exclude_paths:
     - config/engines.yml
 duplication:
   enabled: true
   exclude_paths:
     - config/engines.yml
 metrics:
   enabled: true
   exclude_paths:
     - config/engines.yml
 coverage:
   enabled: true
   exclude_paths:
     - config/engines.yml
languages:
  css:
    extensions:
      - '-css.resource'
exclude_paths:
  - .bundle/**
  - spec/**/*
  - benchmarks/**/*
  - '*.min.js'
- '**/tests/**'
 
If you wish to ignore all files with the same extension across all your repository, you should use the following syntax:
 
'**.extension'
 

Please note that if the file exists in the repo and if you have 'exclude paths', the UI ignores, will not apply.

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

 

 

Have more questions? Submit a request

6 Comments

  • 0
    Avatar
    Derek Suzuki

     What is the best way to verify whether the excluded files configuration from .codacy.yaml is actually taking effect?  I've added some patterns, but I see that issues relating to some of the excluded files are still visible.  Can I execute a full re-analysis of the repo to get those out?

  • 0
    Avatar
    Codacy Team

    Hey, to reanalyse your project you just need to enter the latest commit and click to reanalyse. You can see an example on how to do that in our FAQ. Cheers

  • 0
    Avatar
    Derek Suzuki

    Our .codacy.yaml file is currently (at the HEAD of the master branch) as follows:

    exclude_paths:

      - libs/*/test

      - libs/*/tests

      - **/external/**

      - **/vendor/**

     

    We have analyzed some commits (including a manual reanalysis of the latest commit) since then. The following files currently appear in the files tab and have issues associated with them.

    vts/vendor/gopkg.in/yaml.v2/emitterc.go

    libs/iss/tests/issues_test.py

    The first one would seem to match the pattern **/vendor/**, so I would expect it and its issues to be removed from the Codacy project. I guess that to filter the second file I should change “libs/*/tests” to “libs/*/tests/**”.  Am I misunderstanding this?

  • 0
    Avatar
    Ksclarke

    Is there not a way to export a configuration (say from the global account patterns screen) and apply it to a previously existing project (which has it's own patterns config)? It seems like the global setting only works for new projects?

  • 0
    Avatar
    Codacy Team

    Hi Ksclarke, 

    There is no way to export a configuration file, however, if you want to apply new account pattern rules to old projects, that can be done. Just go to your Project -> Code patterns -> select the language and then Reset the patterns. 

    If you have any more questions, please contact us directly on support@codacy.com

  • 0
    Avatar
    Felipe Figueroa

    How should I specify the disabled and enabled engines? They appear in TitleCase in my panel, but the example codacy.yml shows them in lowercase.

    What about, for example "Node Security", "PHP Code Sniffer", "PHP Mess Detector". Should they appear in snake_case?

    The example file doesn't show the specific rules for each engine. Say I want to disable `Avoid static access` for PHP Mess Detector. How or where should that go?

    Why do duplication and metrics appear as engines, if they should be a cross engine setting?

    How do I specify that ESLint should use my .eslint file to enforce rules?

    I'm very confused, but I'd like to have a codacy.yml in the root of the project. It would spread codacy usage among everyone that's currently using my open source project.

Article is closed for comments.