Skip to content

Conversation

@igorescodro
Copy link
Owner

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.

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.
@igorescodro igorescodro changed the title Show Git Metadata in the tech debt report 🍻 Show Git Metadata in the tech debt report Feb 7, 2026
@igorescodro igorescodro requested a review from Copilot February 7, 2026 15:11
Copy link
Contributor

Copilot AI left a 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 lastModified and author metadata.
  • 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.

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`.
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.
@igorescodro igorescodro marked this pull request as ready for review February 7, 2026 15:59
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`.
Copy link
Contributor

Copilot AI left a 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.

@igorescodro igorescodro merged commit 31ebb7e into main Feb 8, 2026
10 checks passed
@igorescodro igorescodro deleted the feature/git-info branch February 8, 2026 00:27
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.

1 participant