Skip to content
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

Code churn per file #17

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

NewMountain
Copy link

Changes internal data structure of files to track the lines added/removed per line in files and a command line argument to optionally pretty-print the result.

Leverages the test suite added in PR 15.

This PR will satisfy issues 16 and 13

* Minor tweaks to Formatting
* Added a section about contribution
* Added section about how to test
* Added a few words about present and future organization
* Left all existing code in place
* Created two new functions to make more modular and easier to test
* Moved a few lines of existing code into those two new functions
Updated internal calculations to track both lines added and removed while matching the original contribution and churn calculations

Additionally, file change counts were manually reviewed to ensure their correctness.
* Refactored existing code to track line add and line removal
* Made sure the code remained true to original churn and contributions counts
@NewMountain NewMountain mentioned this pull request Nov 6, 2021

def get_loc(commit, dir, files, contribution, churn, exdir):
# git show automatically excludes binary file changes
command = 'git show --format= --unified=0 --no-prefix ' + commit
if len(exdir) > 1:
# https://stackoverflow.com/a/21079437
command += ' -- . ":(exclude,icase)'+exdir+'"'
results = get_proc_out(command, dir).splitlines()
results = get_commit_results(command, dir)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NewMountain I guess this method definition is missing..

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, I also get this error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I missed this 🤦 . Let me get this sorted out and update.

@NewMountain
Copy link
Author

@vvaishakh1 @olleharstedt . Forgot a function. Added that in. Everything passes on my end. I apologize for the confusion.

import argparse
import datetime
import os
import shlex
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently shlex is not used in the project anywhere

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.

4 participants