Search code examples
software-qualitycode-climate

CodeClimate Not reading configuration


In my react project the code quality checker CodeClimate, using advanced configuration just stop some silly code quality factors/thresholds like 50 line of code, :

Function `AutocompleteCombobox` has 50 lines of code (exceeds 25 allowed). Consider refactoring.

what I did I create .codeclimate.yml besides my package.json and upload that to the repo (connected with CodeClimate on branch DEV), following documentation.

this is the example of the .yml file:

version: "2"         # required to adjust maintainability checks

checks:
  argument-count:
    enabled: true
    config:
      threshold: 4
  complex-logic:
    enabled: true
    config:
      threshold: 4


The Question is: CodeClimate doesn’t changes the records and metrics based on my configuration file!! I CHANGED THE RECORDS via .yml file; but still not updated on CodeClimate website ?!! the metrics are same as default.

*** TIP: Nothing to do from CodeClimate website settings we stop every condition, nothing apply except default! and I don’t want to delete and re-add the repo's because I'ill lose my tracking records in enhancement.


Solution

  • The problem is simple, the server make file called .codeclimate.json because I edit the configurations via the website, but in my repo I made I file called .codeclimate.yml, when I convert the configuration from .yml to .json I override the one on the server that works perfectly.

    Example for may configuration .codeclimate.json:

        {
          "version": "2",
          "checks": {
            "argument-count": {
              "enabled": false,
              "config": {
                "threshold": 4
              }
            },
            "complex-logic": {
              "enabled": true,
              "config": {
                "threshold": 15
              }
            },
            "file-lines": {
              "enabled": false,
              "config": {
                "threshold": 250
              }
            },
            "method-complexity": {
              "enabled": true,
              "config": {
                "threshold": 15
              }
            },
            "method-count": {
              "enabled": false,
              "config": {
                "threshold": 20
              }
            },
            "method-lines": {
              "enabled": false,
              "config": {
                "threshold": 25
              }
            },
            "nested-control-flow": {
              "enabled": true,
              "config": {
                "threshold": 4
              }
            },
            "return-statements": {
              "enabled": true,
              "config": {
                "threshold": 4
              }
            },
            "similar-code": {
              "enabled": false,
              "config": {
                "threshold": null
              }
            },
            "identical-code": {
              "enabled": true,
              "config": {
                "threshold": null
              }
            }
          },
          "exclude_patterns": [
            "config/",
            "db/",
            "dist/",
            "features/",
            "**/node_modules/",
            "script/",
            "**/spec/",
            "**/test/",
            "**/tests/",
            "Tests/",
            "**/vendor/",
            "**/*_test.go",
            "**/*.d.ts"
          ]
        }
    

    If you face the same issue probably the configuration is duplicated on CodeClimate, you need to use one file only.

    enter image description here