mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +01:00
Avoid hyphen characters ("-") in JSON properties.
Using that character is obviously a bad idea, as it is reserved for substraction in most programming languages; making output a hassle to parse.
This commit is contained in:
parent
9b3a5b674e
commit
4d6ecd3123
4 changed files with 6 additions and 6 deletions
|
@ -107,7 +107,7 @@ class BlameOutput(Outputable):
|
|||
stability_xml = ("\t\t\t\t\"stability\": " + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows,
|
||||
self.changes)) + ",\n")
|
||||
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) +
|
||||
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},")
|
||||
|
|
|
@ -115,7 +115,7 @@ class ChangesOutput(Outputable):
|
|||
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"
|
||||
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 +
|
||||
deletions_xml + percentage_xml + "\t\t\t}")
|
||||
|
|
|
@ -103,7 +103,7 @@ class MetricsOutput(Outputable):
|
|||
if self.metrics.eloc:
|
||||
for i in sorted(set([(j, i) for (i, j) in self.metrics.eloc.items()]), reverse=True):
|
||||
eloc_xml += "{\n\t\t\t\t\"type\": \"estimated-lines-of-code\",\n"
|
||||
eloc_xml += "\t\t\t\t\"file-name\": \"" + i[1] + "\",\n"
|
||||
eloc_xml += "\t\t\t\t\"file_name\": \"" + i[1] + "\",\n"
|
||||
eloc_xml += "\t\t\t\t\"value\": " + str(i[0]) + "\n"
|
||||
eloc_xml += "\t\t\t},"
|
||||
else:
|
||||
|
@ -113,7 +113,7 @@ class MetricsOutput(Outputable):
|
|||
if self.metrics.cyclomatic_complexity:
|
||||
for i in sorted(set([(j, i) for (i, j) in self.metrics.cyclomatic_complexity.items()]), reverse=True):
|
||||
eloc_xml += "{\n\t\t\t\t\"type\": \"cyclomatic-complexity\",\n"
|
||||
eloc_xml += "\t\t\t\t\"file-name\": \"" + i[1] + "\",\n"
|
||||
eloc_xml += "\t\t\t\t\"file_name\": \"" + i[1] + "\",\n"
|
||||
eloc_xml += "\t\t\t\t\"value\": " + str(i[0]) + "\n"
|
||||
eloc_xml += "\t\t\t},"
|
||||
else:
|
||||
|
@ -123,7 +123,7 @@ class MetricsOutput(Outputable):
|
|||
if self.metrics.cyclomatic_complexity_density:
|
||||
for i in sorted(set([(j, i) for (i, j) in self.metrics.cyclomatic_complexity_density.items()]), reverse=True):
|
||||
eloc_xml += "{\n\t\t\t\t\"type\": \"cyclomatic-complexity-density\",\n"
|
||||
eloc_xml += "\t\t\t\t\"file-name\": \"" + i[1] + "\",\n"
|
||||
eloc_xml += "\t\t\t\t\"file_name\": \"" + i[1] + "\",\n"
|
||||
eloc_xml += "\t\t\t\t\"value\": {0:.3f} \"\n".format(i[0])
|
||||
eloc_xml += "\t\t\t},"
|
||||
else:
|
||||
|
|
|
@ -136,7 +136,7 @@ class TimelineOutput(Outputable):
|
|||
if self.changes.get_commits():
|
||||
message_xml = "\t\t\t\"message\": \"" + _(TIMELINE_INFO_TEXT) + "\",\n"
|
||||
timeline_xml = ""
|
||||
periods_xml = "\t\t\t\"period-length\": \"{0}\",\n".format("week" if self.useweeks else "month")
|
||||
periods_xml = "\t\t\t\"period_length\": \"{0}\",\n".format("week" if self.useweeks else "month")
|
||||
periods_xml += "\t\t\t\"periods\": [\n\t\t\t"
|
||||
|
||||
timeline_data = timeline.TimelineData(self.changes, self.useweeks)
|
||||
|
|
Loading…
Reference in a new issue