lib/git/duet/author_mapper.rb in git-duet-0.4.0 vs lib/git/duet/author_mapper.rb in git-duet-0.4.1
- old
+ new
@@ -36,13 +36,11 @@
def lookup_author_email(initials, author, username)
author_email = email_from_lookup(initials, author, username)
return author_email unless author_email.empty?
return email_addresses[initials] if email_addresses[initials]
- if email_template
- return email_from_template(initials, author, username)
- end
+ return email_from_template(initials, author, username) if email_template
return "#{username}@#{email_domain}" if username
author_name_parts = author.split
"#{author_name_parts.first[0, 1].downcase}." \
"#{author_name_parts.last.downcase}@#{email_domain}"
@@ -51,9 +49,11 @@
def email_from_lookup(initials, author, username)
return '' unless @email_lookup
`#{@email_lookup} '#{initials}' '#{author}' '#{username}'`.strip
end
+ # rubocop:disable Lint/UnusedMethodArgument
+ # arguments are used via binding
def email_from_template(initials, author, username)
return ERB.new(email_template).result(binding)
rescue StandardError => e
$stderr.puts("git-duet: email template rendering error: #{e.message}")
raise Git::Duet::ScriptDieError, 8