Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Excluding Files and Folders

Our analysis lets you fine tune what Code Climate analyzes in your project.

You can specify files or directories that you'd like to exclude from your analysis using in-app configuration, or using the exclude_patterns key in a committed configuration file.

Pattern Format

  • Each entry in a list of exclude_patterns is a "pattern".
  • Patterns can be filenames relative to the project root, or shell-style globs relative to the project root.
  • Patterns can be negated by prefixing them with a !. A negated pattern will include the matched files for analysis, even if they have been excluded by a previous pattern.
  • Patterns should be quoted to ensure your configuration file will be parsed correctly.

Negated Patterns

If your pattern includes quotation marks, include the ! inside of your quotation marks.

  • i.e. "!lib/foundation.js"

Excluding Specific Files and File Types at any Level

To exclude specific files and files types, for example, your .codeclimate.yml would have the following key/values:

## other configuration excluded from example...
exclude_paths:
- "lib/foundation.js"
- "**.rb"

Excluding Tests, Specs and Vendor Directories at any Level

To exclude tests and specs or a vendor directory at any level, for example, your .codeclimate.yml would have the following key/values:

## other configuration excluded from example...
exclude_paths:
- "tests/"
- "spec/"
- "**/vendor/"

Exclude Paths for Specific Plugins

You can also specify exclude paths for specific plugins. These paths will be excluded in addition to the global exclude_patterns.

engines:
  rubocop:
  	enabled: true
    exclude_paths:
    - "vendor/"
   eslint:
   	enabled: true
## other configuration excluded from example...
exclude_paths:
- "tests/"
- "spec/"

Exclude Paths for Specific Plugins

Exclusions at the Plugin-level must be made via committed configuration file.

Impact of adding excludes

While often intentional, it's still worth noting that adding exclusions can (and in many cases likely will) change your maintainability ratings. This is because Code Climate is no longer penalizing you for issues that were detected in (now) excluded files.

Auto-generated file and folder exclusions

If you do not have a .codeclimate.yml yet, Code Climate can generate one for you. This generated codeclimate.yml will have a list of excludes that we think make sense for your project.

We recommend and will attempt to add to your default .codeclimate.yml exclusions for:

  • third party libraries
  • production assets, such as minimized or cross-compiled files
  • automated test suites

Furthermore, engines only run their analysis on files with an appropriate file extension for the language being analyzed (.rb for a Ruby engine, .py for a Python engine, etc). Therefore, in most cases you should not need to specify excludes for files in languages other than your target languages.

I want Code Climate to generate my .codeclimate.yml for me!

If you don't have a .codeclimate.yml yet, you can generate one by using the Code Climate CLI locally (specifically, run codeclimate init on your repository).

Excluding Files and Folders