breaking: remove unused fields from FileMetrics - #108
Conversation
Drop lineComplexities, nrMethods, nrClasses, cloc — unused anywhere in this repo. LineComplexity case class removed too since it only backed lineComplexities.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
Although the code quality is technically up to standards according to Codacy, this PR introduces significant breaking changes to the 'codacy-plugins-api' library. Removing fields from the 'FileMetrics' case class and deleting 'LineComplexity' breaks binary compatibility, source compatibility (specifically pattern matching), and JSON serialization for any downstream services or plugins. These issues should prevent merging unless a breaking release is intended. A deprecation strategy is recommended over total removal to maintain stability for external consumers.
About this PR
- This is a breaking change for any external consumers of the 'codacy-plugins-api' library. Removing these fields will likely break integration with external plugins or tools that rely on the stable API contract of this package.
Test suggestions
- Verify that existing code using FileMetrics with the remaining fields (filename, complexity, loc) still compiles and functions.
- Ensure serialization/deserialization of FileMetrics works correctly with the reduced field set.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that existing code using FileMetrics with the remaining fields (filename, complexity, loc) still compiles and functions.
2. Ensure serialization/deserialization of FileMetrics works correctly with the reduced field set.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| lineComplexities: Set[LineComplexity] = Set.empty) | ||
|
|
||
| case class LineComplexity(line: Int, value: Int) | ||
| case class FileMetrics(filename: String, complexity: Option[Int] = None, loc: Option[Int] = None) |
There was a problem hiding this comment.
🔴 HIGH RISK
Removing fields from the 'FileMetrics' case class and deleting the 'LineComplexity' class are breaking changes for source and binary compatibility. Any consumer performing pattern matching on 'FileMetrics' or referencing 'LineComplexity' will fail to compile. Furthermore, this change modifies the serialized JSON structure, which can break integrations that rely on the presence of these keys. Consider restoring the removed fields and marking them with the '@deprecated' annotation, providing default values (e.g., None or Set.empty) to maintain backward compatibility.
Summary
lineComplexities,nrMethods,nrClasses,clocfromFileMetrics— none referenced anywhere in this repo.LineComplexitycase class too, since it only backedlineComplexities.Test plan
sbt codacy-plugins-apiJVM/compilesbt codacy-plugins-apiJVM/test