FEAT(CodeChurn): Add method to return lines added and removed per file #299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new method,
get_added_and_removed_lines()
, in theCodeChurn
class that provides the number of lines added and removed per file across commits in a repository. The new method returns a dictionary where each key is the file path, and the value is a tuple(added_lines, removed_lines)
representing the total added and removed lines for that file.Changes made:
get_added_and_removed_lines()
:(added_lines, removed_lines)
as values._initialize()
method to store both added and removed lines for each modified file.get_added_and_removed_lines()
method, ensuring correct results across multiple commits.Impact:
This change enhances the
CodeChurn
metric class by allowing users to directly retrieve detailed information on code churn, specifically the number of lines added and removed for each file.Linked Issue:
This PR is related to and resolves Issue #298, which requested a feature to provide a way to access the number of lines added and removed per file in a commit.