-
-
Couldn't load subscription status.
- Fork 12.7k
Modify .codeclimate.yml for improved analysis #5893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Updated Code Climate configuration for Go with enhanced settings for engines and ratings.
WalkthroughConfiguration file Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Automated Quality Checks (from CONTRIBUTING minimum standards)
These checks are a best-effort automation and do not replace human review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.codeclimate.yml(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-08T00:38:13.132Z
Learnt from: CR
PR: avelino/awesome-go#0
File: AGENTS.md:0-0
Timestamp: 2025-10-08T00:38:13.132Z
Learning: Applies to **/*.go : Use standard formatting (gofmt) and idiomatic Go style
Applied to files:
.codeclimate.yml
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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 mocksNote: 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.
Updated Code Climate configuration for Go with enhanced settings for engines and ratings.
We want to ensure high quality of the packages. Make sure that you've checked the boxes below before sending a pull request.
Not every repository (project) will require every option, but most projects should. Check the Contribution Guidelines for details.
Please provide some links to your package to ease the review
Pull Request content
Category quality
Note that new categories can be added only when there are 3 packages or more.
Packages added a long time ago might not meet the current guidelines anymore. It would be very helpful if you could check 3-5 packages above and below your submission to ensure that they also still meet the Quality Standards.
Please delete one of the following lines:
Thanks for your PR, you're awesome! 😎
Summary by CodeRabbit