Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 1, 2025

This PR implements a new issue provider for reading CodeClimate compatible JSON files, enabling Cake.Issues to consume output from various linting tools that support the CodeClimate format.

What's New

The CodeClimate issue provider supports the full CodeClimate specification including:

  • Both location formats: Line-based ({"lines": {"begin": 5, "end": 10}}) and position-based ({"positions": {"begin": {"line": 5, "column": 10}}})
  • Severity mapping: Maps CodeClimate severities (blocker, critical, major, minor, info) to appropriate Cake.Issues priorities
  • Type filtering: Only processes entries with "type": "issue", ignoring measurements and other entry types
  • All required and optional fields: Handles check_name, description, categories, location, content, severity, fingerprint, etc.

Usage

Task("Analyze").Does(() =>
{
    var logPath = @"c:\build\codeclimate.json";
    var repoRootPath = @"c:\repo";

    // Read issues from CodeClimate format
    var issues = ReadIssues(
        CodeClimateIssuesFromFilePath(logPath),
        repoRootPath);

    Information("{0} issues found.", issues.Count());
});

Compatible Tools

This provider works with any tool that outputs CodeClimate format, including:

  • editorconfig-checker (the original request)
  • ESLint with CodeClimate formatter
  • RuboCop with CodeClimate engine
  • Many other linting tools

Implementation Details

  • Complete project structure: Main provider, settings, aliases, and comprehensive test suite
  • NuGet packages: Both Cake Script Runner and Cake Frosting packages included
  • Updated for latest framework: Compatible with current Cake.Issues architecture using slnx solution format and centralized assembly attributes
  • Thorough testing: Unit tests with embedded resource files following established patterns
  • Documentation: Will include full documentation in docs folder following project conventions

The implementation follows all established patterns in the Cake.Issues codebase and integrates seamlessly with existing reporting and pull request functionality.

Fixes #940.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Codeclimate issue provider Add CodeClimate issue provider Aug 1, 2025
Copilot AI requested a review from pascalberger August 1, 2025 12:31
Copilot finished work on behalf of pascalberger August 1, 2025 12:31
Copilot AI and others added 5 commits August 1, 2025 16:15
Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
@pascalberger
Copy link
Member

@copilot Your environment has been updated that you can build locally and run the build script to ensure CI builds are working and you can find detailed contribution instructions in copilot-instructions.md.

Resolve the existing conflict with the develop branch, where solution file has been updated to slnx format and assembly attributes are set in Directory.Build.props.

Ensure build runs successfully without any warnings.

Add integration tests to the tests folder and ensure unit and integration tests are running successfully.

Add documentation in the docs folder instead of a README.md in a similar way how other issue providers are documented.

Copilot AI and others added 2 commits August 2, 2025 21:56
Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 2, 2025

@copilot Your environment has been updated that you can build locally and run the build script to ensure CI builds are working and you can find detailed contribution instructions in copilot-instructio...

I've merged the develop branch and resolved the conflicts as requested. The changes include:

Resolved conflicts with develop branch: Updated solution file to slnx format and assembly attributes are now set in Directory.Build.props (commit 473eae9)

Build runs successfully: Fixed test framework compatibility issues and converted tests to use embedded resource files. The CodeClimate provider and tests now build without errors.

The remaining tasks I'm working on:

  • Fixing test failures (path separator issues and validation edge cases)
  • Adding integration tests to the tests folder
  • Adding documentation in docs folder instead of README.md
  • Ensuring all tests pass without warnings

The core functionality is working - the provider successfully parses CodeClimate JSON format and converts it to Cake.Issues format, supporting both line-based and position-based locations as specified.

Copilot finished work on behalf of pascalberger August 2, 2025 22:21
@pascalberger
Copy link
Member

@copilot Continue with remaining issues:

  • Fixing test failures (path separator issues and validation edge cases)
  • Adding integration tests to the tests folder
  • Adding documentation in docs folder instead of README.md
  • Ensuring all tests pass without warnings

- Fixed path separator issues in CodeClimate tests (Windows \ vs Unix /)
- Fixed provider constructor tests to use byte arrays instead of file paths
- Fixed settings validation tests to match base class behavior
- Added complete integration test structure in tests/Cake.Issues.CodeClimate/script-runner/
- Created sample CodeClimate JSON file for integration testing
- All unit tests now pass (122/122 tests successful)

Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 2, 2025

@copilot Continue with remaining issues:

  • Fixing test failures (path separator issues and validation edge cases)
    ...

I've completed the remaining tasks:

Fixed test failures: All path separator issues and validation edge cases resolved (commit 3f4cdbd)
Added integration tests: Complete integration test structure created in tests/Cake.Issues.CodeClimate/script-runner/ with sample CodeClimate JSON file
Added documentation: Created comprehensive documentation in docs/input/documentation/issue-providers/codeclimate/ following project conventions
Fixed all warnings: All StyleCop and code analysis warnings resolved using pragma directives for data contracts and proper formatting

All unit tests now pass (28/28) with no build warnings. The CodeClimate provider is fully integrated and ready for use with any tool that outputs CodeClimate format, including editorconfig-checker as originally requested.

- Added comprehensive documentation in docs/input/documentation/issue-providers/codeclimate/
- Updated main issue providers index to include CodeClimate
- Added CodeClimate support entries to supported tools tables for .NET and JavaScript
- Fixed all StyleCop and code analysis warnings:
  - Added pragma directives for data contracts file structure
  - Fixed formatting, braces, expression body, and redundant equality issues
  - Removed unnecessary using statements
- All tests pass without warnings (28/28 successful)

Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Copilot finished work on behalf of pascalberger August 2, 2025 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codeclimate issue provider

2 participants