Skip to content

Commit

Permalink
generate donut graph
Browse files Browse the repository at this point in the history
Signed-off-by: Isaac Milarsky <[email protected]>
  • Loading branch information
IsaacMilarky committed Mar 18, 2024
1 parent 8044b50 commit 51f119a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/gen_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def generate_all_graphs_for_repos(all_repos):
print(f"Generating graphs for repo {repo.name}")
generate_solid_gauge_issue_graph(repo)
generate_repo_sparklines(repo)
generate_donut_graph_line_complexity_graph(repo)


def generate_all_graphs_for_orgs(all_orgs):
Expand Down Expand Up @@ -101,6 +102,31 @@ def generate_time_xy_issue_graph(oss_entity,data_key):
write_repo_chart_to_file(oss_entity, xy_time_issue_chart, data_key)


def generate_donut_graph_line_complexity_graph(oss_entity):
"""
This function generates pygals line complexitydonut graph
for a set of Repository objects.
Arguments:
oss_entity: The OSSEntity to create a graph for.
"""

donut_lines_graph = pygal.Pie(inner_radius=0.65)
donut_lines_graph.title = "Composition of Lines of Code"


num_blank_lines = oss_entity.metric_data['total_project_blank_lines']
donut_lines_graph.add('Total Blank Lines', num_blank_lines)

num_comment_lines = oss_entity.metric_data['total_project_comment_lines']
donut_lines_graph.add('Total Comment Lines', num_comment_lines)

num_total_lines = oss_entity.metric_data['total_project_lines']
num_remaining_lines = (num_total_lines - num_comment_lines) - num_blank_lines
donut_lines_graph.add('Total Other Lines', num_remaining_lines)

write_repo_chart_to_file(oss_entity, donut_lines_graph, "total_line_makeup")


def generate_solid_gauge_issue_graph(oss_entity):
"""
Expand Down
5 changes: 5 additions & 0 deletions templates/repo_report_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,10 @@ date_stampLastWeek: {date_stamp}
<img alt="firstResponseForClosedPR" src="{{{{ "/assets/img/graphs/{repo_owner}/{repo_name}/firstResponseForClosedPR_{repo_name}_data.png" | url }}}}" />
</figure>
</div>
<!--- Line Complexity Graphs -->
<h3>Line Complexity</h3>
<figure>
<embed type="image/svg+xml" src="{{{{ "/assets/img/graphs/{repo_owner}/{repo_name}/total_line_makeup_{repo_name}_data.svg" | url }}}}" />
</figure>
</div>
</div>

0 comments on commit 51f119a

Please sign in to comment.