kaka
kaka

Reputation: 183

How to exclude files or folders not being included in the gitlab code quality scanning json file to reduce the code quality issues

how we can exclude files or folders not being include in gitlab code quality scanning json file.

actually when we run code quality, we are getting some quality issues but those are not relates to issues. those are related to some files like karma.conf.js and etc.. I need to exclude those files not being included in code quality artifact json file. So we can reduce the code quality issues within the report.

Please suggest how we can exclude files from json file.

gitlab.yaml:

stages:

- build

- test

- deploy

include:

- template: Code-Quality.gitlab-ci.yml

code_quality:

stage: test

tags:

   - linux

   - dind 

artifacts:

  paths: [gl-code-quality-report.json]

  exclude:

      - karma.conf.js

Upvotes: 2

Views: 4844

Answers (1)

Adam Marshall
Adam Marshall

Reputation: 7669

You can add a .codeclimate.yml file at the root of your project to enable or disable plugins and exclude files or directories from scanning. Here's the example in the docs:

---
version: "2"
plugins:
  csslint:
    enabled: true
  coffeelint:
    enabled: true
  duplication:
    enabled: true
    config:
      languages:
        - ruby
        - javascript
        - python
        - php
  eslint:
    enabled: true
    channel: __ESLINT_CHANNEL__
  fixme:
    enabled: true
  rubocop:
    enabled: true
exclude_patterns:
  - config/
  - db/
  - dist/
  - features/
  - "**/node_modules/"
  - script/
  - "**/spec/"
  - "**/test/"
  - "**/tests/"
  - Tests/
  - "**/vendor/"
  - "**/*_test.go"
  - "**/*.d.ts"
  - "**/*.min.js"
  - "**/*.min.css"
  - "**/__tests__/"
  - "**/__mocks__/"

The exclude_patterns at the bottom is what you're looking for. This should tell Code Climate not to run its tests on these files or directories.

Upvotes: 4

Related Questions