-
Notifications
You must be signed in to change notification settings - Fork 1
🍻 Show Git Metadata in the tech debt report #39
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
Conversation
Updated `build.gradle.kts` to include JGit as a new dependency for version control operations.
Introduced two new optional fields, `lastModified` and `author`, in `TechDebtItem` for tracking technical debt metadata. Enhanced source location management by adding the `getSourceLocation` utility function to resolve more precise locations. Refactored processors to leverage this updated logic.
Added comprehensive unit tests for `SourceFileResolver` and `GitParser` to ensure file resolution and parsing behaviors work as expected. Refactored `CommentParserTest` to include setup logic for `CommentParser`.
The sample report was updated after the new git metadata feature.
Updated the README to document the new `enableGitMetadata` option and the ability to collect and visualize Git information like author and last modified date.
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.
Pull request overview
Adds optional Git metadata enrichment to the tech-debt reporting pipeline so the HTML report can display “Last Modified” and “Author” per item, and updates report rendering/formatting to support longer values like file paths.
Changes:
- Extend tech-debt item models to carry optional
lastModifiedandauthormetadata. - Capture more precise source locations from KSP (file path + line) and add Git-based enrichment via JGit (behind a Gradle extension flag).
- Update HTML card layout to render the new fields and wrap long values; add tests and dependency/config wiring.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| techdebt-processor/src/main/kotlin/com/escodro/techdebt/report/TechDebtItem.kt | Adds lastModified/author fields to the processor-side model. |
| techdebt-processor/src/main/kotlin/com/escodro/techdebt/processor/TechDebtSymbolProcessor.kt | Records file path + line as “sourceSet” value for @TechDebt items. |
| techdebt-processor/src/main/kotlin/com/escodro/techdebt/processor/SuppressSymbolProcessor.kt | Records file path + line as “sourceSet” value for suppressed rules. |
| techdebt-processor/src/main/kotlin/com/escodro/techdebt/extension/KSAnnotationExtensions.kt | Introduces getSourceLocation() helper using KSP FileLocation. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/SourceFileResolver.kt | New resolver to map path[:line] to a File on disk. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/GitParser.kt | New JGit-based parser to enrich items with blame metadata. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/GeneratedTechDebtParser.kt | Updates sourceSet normalization heuristics for parsed JSON items. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/model/TechDebtItem.kt | Adds lastModified/author fields to the Gradle-plugin-side model. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/TechDebtPlugin.kt | Wires new enableGitMetadata extension flag into the report task. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/TechDebtExtension.kt | Adds enableGitMetadata Gradle extension property. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/GenerateTechDebtReportTask.kt | Runs Git enrichment when enabled; sorts based on enriched items. |
| techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/report/CardGenerator.kt | Renders “Last Modified”/“Author” and updates value wrapping layout. |
| techdebt-gradle-plugin/build.gradle.kts | Adds JGit dependency. |
| techdebt-gradle-plugin/src/test/kotlin/com/escodro/techdebt/gradle/parser/SourceFileResolverTest.kt | New tests for source file resolution behavior. |
| techdebt-gradle-plugin/src/test/kotlin/com/escodro/techdebt/gradle/parser/GitParserTest.kt | New tests for Git metadata extraction and caching. |
| techdebt-gradle-plugin/src/test/kotlin/com/escodro/techdebt/gradle/parser/CommentParserTest.kt | Adjusts test setup lifecycle for CommentParser. |
| gradle/libs.versions.toml | Adds JGit coordinate/version; updates techdebt version string. |
| samples/sample-jvm/build.gradle.kts | Enables Git metadata in the sample configuration. |
| samples/sample-jvm/assets/report.html | Updates sample report output to include Git metadata + wrapping layout. |
| README.md | Documents the new enableGitMetadata option and feature list entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/GitParser.kt
Show resolved
Hide resolved
techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/report/CardGenerator.kt
Outdated
Show resolved
Hide resolved
techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/model/TechDebtItem.kt
Show resolved
Hide resolved
techdebt-processor/src/main/kotlin/com/escodro/techdebt/report/TechDebtItem.kt
Show resolved
Hide resolved
techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/SourceFileResolver.kt
Outdated
Show resolved
Hide resolved
techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/SourceFileResolver.kt
Show resolved
Hide resolved
...debt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/GenerateTechDebtReportTask.kt
Show resolved
Hide resolved
techdebt-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/GitParser.kt
Outdated
Show resolved
Hide resolved
...-gradle-plugin/src/main/kotlin/com/escodro/techdebt/gradle/parser/GeneratedTechDebtParser.kt
Show resolved
Hide resolved
Introduced `rootProjectDirectory` as a new internal property in `GenerateTechDebtReportTask` to resolve Git metadata. Updated task instantiation logic in `TechDebtPlugin` to set this property.
Added a new test in `GeneratedTechDebtParserTest` to verify proper handling of bare filenames as source sets. Simplified source set resolution logic in `GeneratedTechDebtParser`.
6cf88d9 to
44d8a61
Compare
Added error handling for `GitAPIException` in the `GitParser` to gracefully handle scenarios where Git blame operations fail.
Consolidated duplicate inline styles for `.info-value` elements into the stylesheet for maintainability.
Introduced a new `location` field in `TechDebtItem` to provide precise source mapping. Updated `GitParser`, `CommentParser`, and processors to leverage the new field for consistent handling. Removed redundant inline styles in sample HTML report for maintainability.
Corrected spacing for exception handling in `GitParser` and simplified lambda usage in `CardGenerator` for better readability and maintainability.
Removed the "Symbol" section for suppressed items in `CardGenerator` and updated the sample HTML report to reflect the change, simplifying the output.
Updated `fallbackSearch` to use `it.path.endsWith(path)` for accurate path matching.
Enhanced `GitParserTest` and `CommentParserTest` to validate the `location` field, ensuring accurate source mapping is tested consistently.
Replaced path separators with forward slashes in `GitParser` to ensure consistent path handling. Added unit test to validate this behavior across environments.
…rage Improved `GitParser` to ensure line numbers are validated before processing and adjusted affected test cases to handle scenarios where line numbers are missing. Simplified handling of `sourceSet` parsing. Removed unused sections from the sample HTML report for clarity.
Updated `GitParser` to validate `location` instead of `sourceSet` for line number parsing, adjusted test cases to reflect changes, and enhanced processors to use `getAnnotationLocation`.
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.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces Git metadata support to the tech debt reporting system, allowing the report to display the last modified date and author for each item. It also updates the HTML report layout to include this information and improves the formatting for better readability. Dependency and configuration changes ensure the new feature is enabled and supported.