mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +01:00
Include author email in JSON and HTML outputs (Fixes #85).
This commit is contained in:
parent
12f8c8a192
commit
bfde70db91
4 changed files with 21 additions and 9 deletions
|
@ -102,6 +102,7 @@ class BlameOutput(Outputable):
|
|||
author_email = self.changes.get_latest_email_by_author(i[0])
|
||||
|
||||
name_xml = "\t\t\t\t\"name\": \"" + i[0] + "\",\n"
|
||||
email_json = "\t\t\t\t\"email\": \"" + author_email + "\",\n"
|
||||
gravatar_xml = "\t\t\t\t\"gravatar\": \"" + gravatar.get_url(author_email) + "\",\n"
|
||||
rows_xml = "\t\t\t\t\"rows\": " + str(i[1].rows) + ",\n"
|
||||
stability_xml = ("\t\t\t\t\"stability\": " + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows,
|
||||
|
@ -109,8 +110,8 @@ class BlameOutput(Outputable):
|
|||
age_xml = ("\t\t\t\t\"age\": " + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + ",\n")
|
||||
percentage_in_comments_xml = ("\t\t\t\t\"percentage_in_comments\": " + "{0:.2f}".format(100.0 * i[1].comments / i[1].rows) +
|
||||
"\n")
|
||||
blame_xml += ("{\n" + name_xml + gravatar_xml + rows_xml + stability_xml + age_xml +
|
||||
percentage_in_comments_xml + "\t\t\t},")
|
||||
blame_xml += ("{\n" + name_xml + email_json + gravatar_xml + rows_xml + stability_xml + age_xml +
|
||||
percentage_in_comments_xml + "\t\t\t},")
|
||||
else:
|
||||
blame_xml = blame_xml[:-1]
|
||||
|
||||
|
@ -139,6 +140,7 @@ class BlameOutput(Outputable):
|
|||
author_email = self.changes.get_latest_email_by_author(i[0])
|
||||
|
||||
name_xml = "\t\t\t\t<name>" + i[0] + "</name>\n"
|
||||
email_xml = "\t\t\t\t<email>" + author_email + "</email>\n"
|
||||
gravatar_xml = "\t\t\t\t<gravatar>" + gravatar.get_url(author_email) + "</gravatar>\n"
|
||||
rows_xml = "\t\t\t\t<rows>" + str(i[1].rows) + "</rows>\n"
|
||||
stability_xml = ("\t\t\t\t<stability>" + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows,
|
||||
|
@ -146,7 +148,7 @@ class BlameOutput(Outputable):
|
|||
age_xml = ("\t\t\t\t<age>" + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + "</age>\n")
|
||||
percentage_in_comments_xml = ("\t\t\t\t<percentage-in-comments>" + "{0:.2f}".format(100.0 * i[1].comments / i[1].rows) +
|
||||
"</percentage-in-comments>\n")
|
||||
blame_xml += ("\t\t\t<author>\n" + name_xml + gravatar_xml + rows_xml + stability_xml + age_xml +
|
||||
percentage_in_comments_xml + "\t\t\t</author>\n")
|
||||
blame_xml += ("\t\t\t<author>\n" + name_xml + email_xml + gravatar_xml + rows_xml + stability_xml +
|
||||
age_xml + percentage_in_comments_xml + "\t\t\t</author>\n")
|
||||
|
||||
print("\t<blame>\n" + message_xml + "\t\t<authors>\n" + blame_xml + "\t\t</authors>\n\t</blame>")
|
||||
|
|
|
@ -108,16 +108,19 @@ class ChangesOutput(Outputable):
|
|||
changes_xml = ""
|
||||
|
||||
for i in sorted(authorinfo_list):
|
||||
author_email = self.changes.get_latest_email_by_author(i)
|
||||
authorinfo = authorinfo_list.get(i)
|
||||
|
||||
percentage = 0 if total_changes == 0 else (authorinfo.insertions + authorinfo.deletions) / total_changes * 100
|
||||
name_xml = "\t\t\t\t\"name\": \"" + i + "\",\n"
|
||||
gravatar_xml = "\t\t\t\t\"gravatar\": \"" + gravatar.get_url(self.changes.get_latest_email_by_author(i)) + "\",\n"
|
||||
email_json = "\t\t\t\t\"email\": \"" + author_email + "\",\n"
|
||||
gravatar_xml = "\t\t\t\t\"gravatar\": \"" + gravatar.get_url(author_email) + "\",\n"
|
||||
commits_xml = "\t\t\t\t\"commits\": " + str(authorinfo.commits) + ",\n"
|
||||
insertions_xml = "\t\t\t\t\"insertions\": " + str(authorinfo.insertions) + ",\n"
|
||||
deletions_xml = "\t\t\t\t\"deletions\": " + str(authorinfo.deletions) + ",\n"
|
||||
percentage_xml = "\t\t\t\t\"percentage_of_changes\": " + "{0:.2f}".format(percentage) + "\n"
|
||||
|
||||
changes_xml += ("{\n" + name_xml + gravatar_xml + commits_xml + insertions_xml +
|
||||
changes_xml += ("{\n" + name_xml + email_json + gravatar_xml + commits_xml + insertions_xml +
|
||||
deletions_xml + percentage_xml + "\t\t\t}")
|
||||
changes_xml += ","
|
||||
else:
|
||||
|
@ -166,17 +169,20 @@ class ChangesOutput(Outputable):
|
|||
changes_xml = ""
|
||||
|
||||
for i in sorted(authorinfo_list):
|
||||
author_email = self.changes.get_latest_email_by_author(i)
|
||||
authorinfo = authorinfo_list.get(i)
|
||||
|
||||
percentage = 0 if total_changes == 0 else (authorinfo.insertions + authorinfo.deletions) / total_changes * 100
|
||||
name_xml = "\t\t\t\t<name>" + i + "</name>\n"
|
||||
gravatar_xml = "\t\t\t\t<gravatar>" + gravatar.get_url(self.changes.get_latest_email_by_author(i)) + "</gravatar>\n"
|
||||
email_xml = "\t\t\t\t<email>" + author_email + "</email>\n"
|
||||
gravatar_xml = "\t\t\t\t<gravatar>" + gravatar.get_url(author_email) + "</gravatar>\n"
|
||||
commits_xml = "\t\t\t\t<commits>" + str(authorinfo.commits) + "</commits>\n"
|
||||
insertions_xml = "\t\t\t\t<insertions>" + str(authorinfo.insertions) + "</insertions>\n"
|
||||
deletions_xml = "\t\t\t\t<deletions>" + str(authorinfo.deletions) + "</deletions>\n"
|
||||
percentage_xml = "\t\t\t\t<percentage-of-changes>" + "{0:.2f}".format(percentage) + "</percentage-of-changes>\n"
|
||||
|
||||
changes_xml += ("\t\t\t<author>\n" + name_xml + gravatar_xml + commits_xml + insertions_xml +
|
||||
deletions_xml + percentage_xml + "\t\t\t</author>\n")
|
||||
changes_xml += ("\t\t\t<author>\n" + name_xml + email_xml + gravatar_xml + commits_xml +
|
||||
insertions_xml + deletions_xml + percentage_xml + "\t\t\t</author>\n")
|
||||
|
||||
print("\t<changes>\n" + message_xml + "\t\t<authors>\n" + changes_xml + "\t\t</authors>\n\t</changes>")
|
||||
else:
|
||||
|
|
|
@ -94,6 +94,7 @@ class ResponsibilitiesOutput(Outputable):
|
|||
|
||||
resp_xml += "{\n"
|
||||
resp_xml += "\t\t\t\t\"name\": \"" + i + "\",\n"
|
||||
resp_xml += "\t\t\t\t\"email\": \"" + author_email + "\",\n"
|
||||
resp_xml += "\t\t\t\t\"gravatar\": \"" + gravatar.get_url(author_email) + "\",\n"
|
||||
resp_xml += "\t\t\t\t\"files\": [\n\t\t\t\t"
|
||||
|
||||
|
@ -124,6 +125,7 @@ class ResponsibilitiesOutput(Outputable):
|
|||
|
||||
resp_xml += "\t\t\t<author>\n"
|
||||
resp_xml += "\t\t\t\t<name>" + i + "</name>\n"
|
||||
resp_xml += "\t\t\t\t<email>" + author_email + "</email>\n"
|
||||
resp_xml += "\t\t\t\t<gravatar>" + gravatar.get_url(author_email) + "</gravatar>\n"
|
||||
resp_xml += "\t\t\t\t<files>\n"
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ class TimelineOutput(Outputable):
|
|||
signs_str = "."
|
||||
|
||||
authors_xml += "{\n\t\t\t\t\t\"name\": \"" + name[0] + "\",\n"
|
||||
authors_xml += "\t\t\t\t\t\"email\": \"" + name[1] + "\",\n"
|
||||
authors_xml += "\t\t\t\t\t\"gravatar\": \"" + gravatar.get_url(name[1]) + "\",\n"
|
||||
authors_xml += "\t\t\t\t\t\"work\": \"" + signs_str + "\"\n\t\t\t\t},"
|
||||
else:
|
||||
|
@ -195,6 +196,7 @@ class TimelineOutput(Outputable):
|
|||
signs_str = "."
|
||||
|
||||
authors_xml += "\t\t\t\t\t<author>\n\t\t\t\t\t\t<name>" + name[0] + "</name>\n"
|
||||
authors_xml += "\t\t\t\t\t\t<email>" + name[1] + "</email>\n"
|
||||
authors_xml += "\t\t\t\t\t\t<gravatar>" + gravatar.get_url(name[1]) + "</gravatar>\n"
|
||||
authors_xml += "\t\t\t\t\t\t<work>" + signs_str + "</work>\n\t\t\t\t\t</author>\n"
|
||||
|
||||
|
|
Loading…
Reference in a new issue