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
Create tool for getting DCO sign off emails #34
Conversation
This really needs tests. I'm a ruby newbie so I haven't waded into figuring out how all the spec stuff works yet... |
6ce2d02
to
43d44a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below + add to README.
I haven't been good at writing tests here, but yes you should. With some suggestions below it should be pretty easy. At least add pending
tests for where you'd intend to write them.
org = GitHub::Organization.new(options) | ||
puts org.commits(options).unique_dco_signers_csv | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue for exporting CSV in a generic way, #18.
How about we change this to be called "emails" and output something non-structured, then implement the CSV thing generically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still looking at what it would take to wire in more generic csv support.
lib/github/commits.rb
Outdated
end | ||
|
||
def unique_dco_signers_csv | ||
# Create an association list of all name->email pairs, e.g: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adopt the @var ||= begin
syntax to avoid re-parsing/sorting.
- Create a class
Signer
that represents a single DCO signer with name and multiple emails. - Create a class
Signers
that represents a collection ofSigner
and has a class method that implements the logic here to create it. - Rename this method to
signers
that returnsSigners
. - Do sorting in
Signers.sort!
. - Transform to text elsewhere, e.g.
Signers#to_s
.
This is what this could look like:
signers_list.each do |name, email|
signers[email] ||= Set.new
signers[email] += email
end
or even
signers.add(name, email)
Btw, I had in the past written and used https://github.com/dblock/fue which is a way to dig through commits for emails in another way than DCO. |
After parsing through a lot of this data, the DCO proved to be highest quality source for email addresses. The email address in the commit metadata itself was frequently something like |
@andrross Want to finish this? |
@dblock Yes I will finish this. |
72531b1
to
da041e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Add to README and let's merge?
This tool digs through commit messages and parses out names and email addresses from the `Signed-off-by:` tags, collects all unique email addresses and outputs a CSV of name/email pairs. Signed-off-by: Andrew Ross <andrross@amazon.com>
@dblock This is ready to review again. Added the README section plus another unit test. |
Nice work, welcome to Ruby! |
This tool digs through commit messages and parses out names and email addresses from the
Signed-off-by:
tags, collects all unique email addresses and outputs a CSV of name/email pairs.Example usage:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.