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

Fix Issue Number: 24 - Git Siblings #208

Closed
wants to merge 3 commits into from

Conversation

tanmaysharma2001
Copy link
Contributor

Fix for the Issue Number 24 in the Cam Repo.

Problem Description:
For each .java class, let's count the number of other .java classes which it was updated together with, in the Git history.

Solution Description:

  • Use the git log command with --name-only and --pretty=format: options to list committed files per commit.
  • Filter the output for .java files.
  • For each .java file, track the commits it appears in.
  • Calculate the number of times each .java file is committed with other .java files.
  • Output the result for each file, showing its "siblings".

@yegor256
Copy link
Owner

@tanmaysharma2001 looks like a very good start, thanks! Now, please, try to run make clean install and then make test lint, in order to check that the code doesn't break anything. Then, please, create a unit test for this script, similar to the tests we already have for other scripts.

Also, if it's a "step", we should name it like all other steps: XXX-name.sh, where XXX is a number.

@tanmaysharma2001
Copy link
Contributor Author

Hi @yegor256 thanks a lot. I have fixed one the 1 test where my script was failing. Although, i had few problems with installing make clean install, which includes installing dependencies. I'm working on that. Meanwhile I request you to approve the PR so that it can run the tests again. Also i have written the unit test for the script too.

Also I wanted to ask about the step number. I didn't quite understand where should i name it cause other steps are named according to their purposes. For example: aggregate-join.sh.

Sorry if i misunderstood anything. Thanks.

@yegor256
Copy link
Owner

@tanmaysharma2001 this should be a metric, not a "step". Put your file into the metrics/ directory and that's it.

@tanmaysharma2001
Copy link
Contributor Author

Done @yegor256 Thanks a lot.

repo=$1

# List all Java files in the repo history
git -C "${repo}/" log --name-only --pretty=format: | grep '\.java$' | sort | uniq > "${repo}/all_java_files.txt"
Copy link
Owner

Choose a reason for hiding this comment

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

@tanmaysharma2001 this script will be called for each .java file in each repository. I believe, it will take a lot of time, if we rebuild this .txt file on each cycle. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood, i will try to find a workaround.

} >> "${repo}/siblings_count.txt"
done < "${repo}/all_java_files.txt"

echo "Analysis complete. Check siblings_count.txt for results."
Copy link
Owner

Choose a reason for hiding this comment

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

@tanmaysharma2001 check how other files in the metrics/ directory work. They are supposed to output their data in a certain format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood.

@tanmaysharma2001 tanmaysharma2001 closed this by deleting the head repository Apr 9, 2024
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.

None yet

2 participants