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

Add contribution_utils to license_utils for more complete unit testing #271

Merged
merged 17 commits into from
Jul 28, 2023

Conversation

netsettler
Copy link
Collaborator

@netsettler netsettler commented Jul 27, 2023

This is a layered PR adding changes to allow checking of contributors.

  • See in particular the change to qa_checkers.py adding ContributionsChecker.validate(), which will check that a CONTRIBUTORS.json file exists and summarizes who's contributed to the repo. This will allow us to make sure contributions come from employees, or to check that other contributions are made by people agreeing to our contribution policy.

@coveralls
Copy link

coveralls commented Jul 27, 2023

Pull Request Test Coverage Report for Build 5694652740

  • 631 of 653 (96.63%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.3%) to 77.248%

Changes Missing Coverage Covered Lines Changed/Added Lines %
dcicutils/contribution_utils.py 316 338 93.49%
Totals Coverage Status
Change from base Build 5590491337: 1.3%
Covered Lines: 8084
Relevant Lines: 10465

💛 - Coveralls

@netsettler netsettler changed the base branch from master to kmp_license_utils July 28, 2023 17:31
Comment on lines +97 to +104
"Koray K\u0131rl\u0131": {
"emails": [
"KorayKirli@users.noreply.github.com",
"koray_kirli@hms.harvard.edu"
],
"names": [
"Koray K\u0131rl\u0131"
]
Copy link
Member

Choose a reason for hiding this comment

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

Looks like something that may need correcting in encoding?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, I think it's safer this way. It will output correctly. It can be read by the default python reader and it will display as real unicode if you print it out in a regular file or on the terminal.

Comment on lines +39 to +48
"name": actor.name,
"email": actor.email,
}

@classmethod
def json_for_commit(cls, commit: git.Commit) -> Dict:
return {
'commit': commit.hexsha,
'date': commit.committed_datetime.isoformat(),
'author': cls.json_for_actor(commit.author),
Copy link
Member

Choose a reason for hiding this comment

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

Mixed use of single/double quotes here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I can look at that. It's a losing battle, though. So many complex constraints.

Comment on lines +328 to +330
# excluded_fork_contributors_by_name = (self.excluded_contributions.contributors_by_name
# if self.excluded_contributions
# else {})
Copy link
Member

Choose a reason for hiding this comment

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

Commented out intentionally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was something I was experimenting with. I only need email but I should take in the _by_name data and convert it to _by_email because the _by_name data is more compact and more intelligible. I'll work on that later.

Comment on lines +364 to +366
n = 0
for commit in reversed(list(git_repo.iter_commits())):
n += 1
Copy link
Member

Choose a reason for hiding this comment

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

Does this have real use? Maybe rename if so... It looks unused granted I don't have my syntax highlighting

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the counter? i was using it for some debugging. it's not used in the core part, yeah.

@netsettler netsettler merged commit 8c767ff into kmp_license_utils Jul 28, 2023
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.

3 participants