Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
version: 2
engines:
golint:
enabled: true
config:
min_confidence: 0.8 # Ignore very low-confidence style warnings

gofmt:
enabled: true
config:
simplify: true # Automatically check for code simplifications

govet:
enabled: true
config:
check_shadowing: true # Detect variable shadowing for cleaner logic

duplication:
enabled: true
config:
languages:
- go
go:
threshold: 40 # Minimum token threshold before flagging duplication

ratings:
paths:
- "**.go"
- "**/*.go"

exclude_paths:
- "vendor/**" # Ignore dependencies
- "testdata/**" # Ignore test data
- "mocks/**" # Ignore generated mocks
Comment on lines +1 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Configuration format is incompatible with CodeClimate v2 API.

CodeClimate v2 uses checks and plugins sections, along with exclude_patterns at the root level, not the engines block. Additionally, exclusions should use exclude_patterns key, not exclude_paths.

The file declares version: 2 but uses the v1 API structure, which will likely cause CodeClimate to reject this configuration.

Apply this diff to align with CodeClimate v2 API:

- version: 2
+ version: "2"
- engines:
-   golint:
-     enabled: true
-     config:
-       min_confidence: 0.8   # Ignore very low-confidence style warnings
-
-   gofmt:
-     enabled: true
-     config:
-       simplify: true        # Automatically check for code simplifications
-
-   govet:
-     enabled: true
-     config:
-       check_shadowing: true # Detect variable shadowing for cleaner logic
-
-   duplication:
-     enabled: true
-     config:
-       languages:
-         go:
-           threshold: 40     # Minimum token threshold before flagging duplication
-
- ratings:
-   paths:
-     - "**/*.go"
-
- exclude_paths:
-   - "vendor/**"             # Ignore dependencies
-   - "testdata/**"           # Ignore test data
-   - "mocks/**"              # Ignore generated mocks
+ checks:
+   # Built-in maintainability checks enabled by default
+   similar-code:
+     enabled: true
+     config:
+       threshold: 40         # Go-specific duplication threshold
+   identical-code:
+     enabled: true
+
+ plugins:
+   golangci-lint:            # Modern Go linting solution
+     enabled: true
+
+ exclude_patterns:
+   - "vendor/"               # Ignore dependencies
+   - "**/testdata/"          # Ignore test data
+   - "**/mocks/"             # Ignore generated mocks

Note: golint is available as a CodeClimate plugin, and govet is also available, but consider using golangci-lint (shown in the diff) for comprehensive Go linting.






---

🌐 Web query:

```web
CodeClimate v2 configuration format engines checks plugins

💡 Result:

Summary — Code Climate analysis config (version 2)

  • Top-level: version: "2". Main sections: prepare (fetch), checks, plugins, exclude_patterns. [1]
  • checks: configure built-in maintainability checks (all enabled by default). Each check entry: enabled: true|false and optional config: { ... } to tune thresholds. Example:
    checks:
    complex-logic:
    enabled: true
    config:
    threshold: 50. [1]
  • plugins: (previously called engines) enable/disable third‑party/analyzer plugins and choose channels/versions. Each plugin entry supports enabled: true|false, channel: (stable default), and config: { ... }. Example:
    plugins:
    eslint:
    enabled: true
    channel: "eslint-6" . [1]
  • exclude_patterns: glob/regex patterns to exclude files/directories from analysis; if no file is committed Code Climate uses built-in defaults (node_modules, test directories, vendor, etc.). Exclusions can be global or plugin‑level (not per-check). [1][2]
  • Notes: version 2 replaced older syntax — engines → plugins, exclude_paths → exclude_patterns, ratings deprecated; include .codeclimate.yml (or .json) at repo root. [1]

Sources:
[1] Code Climate — Advanced configuration (analysis config structure, checks, plugins).
[2] Code Climate — Excluding files and folders (default exclude patterns).


🌐 Web query:

CodeClimate exclude_patterns exclude_paths v2 configuration

💡 Result:

Short answer

  • In Code Climate config version: "2" use the top-level key exclude_patterns (not the old exclude_paths). Patterns are shell-style globs (relative to repo root), may be quoted, and may be negated with a leading "!".
  • You can also set exclude_patterns under a specific plugin to exclude paths only for that plugin (these are applied in addition to the global excludes).

Example (.codeclimate.yml):
version: "2"
exclude_patterns:

  • "tests/"
  • "**/vendor/"
  • "!lib/keep_this.rb"
    plugins:
    rubocop:
    enabled: true
    exclude_patterns:
    • "vendor/"

Sources

  • Code Climate — Advanced configuration (notes that exclude_paths was renamed to exclude_patterns in v2). [1]
  • Code Climate — Excluding files and folders (pattern format, negation, plugin-level excludes, examples). [2]

🌐 Web query:

CodeClimate golint gofmt govet v2 supported engines

💡 Result:

Yes — Code Climate's engines include gofmt, golint, and govet (they are official Go engines). Note: the golint plugin is marked deprecated/unmaintained in the docs. [1][2][3][4]

Sources:

  • Code Climate engines list. [1]
  • golint engine docs (deprecated). [2]
  • gofmt engine docs. [3]
  • govet engine docs. [4]

Configuration format is incompatible with CodeClimate v2 API.

CodeClimate v2 uses checks and plugins sections, along with exclude_patterns at the root level. The file declares version: 2 but uses engines (v1 format) and exclude_paths (v1 key). In v2, engines were renamed to plugins and exclude_paths was renamed to exclude_patterns, so this configuration will not work as intended.

Additionally, the golint plugin is marked deprecated/unmaintained, so consider replacing it with golangci-lint for comprehensive Go linting.

Update the configuration structure to use plugins and exclude_patterns as shown in the original review comment's diff.

🤖 Prompt for AI Agents
In .codeclimate.yml around lines 1 to 32, the config uses the v1 keys `engines`
and `exclude_paths` which are incompatible with CodeClimate v2; update the file
to use `plugins` (replace each engine with the corresponding plugin entry,
replacing deprecated golint with golangci-lint) and rename `exclude_paths` to
`exclude_patterns` at the root, and ensure the new structure includes
appropriate plugin configs and any threshold/settings previously present so
CodeClimate v2 recognizes and runs the Go checks.

Loading