Repository Report Maker¶
osa_tool.operations.analysis.repository_report.report_maker
¶
AbstractReportGenerator
¶
Bases: ABC
body_first_part()
¶
Generates the first part of the body content for the repository report.
This includes the repository name with a hyperlink, owner information with a hyperlink, and the repository creation date. The data is presented as a bulleted list.
Returns:
| Name | Type | Description |
|---|---|---|
ListFlowable |
ListFlowable
|
A ListFlowable object containing a bulleted list of repository details. |
build_pdf()
¶
Generates and builds the PDF report for the repository analysis.
This method initializes the PDF document, adds the header, body content (first and second parts),
and then generates the PDF file. The draw_images_and_tables method is used to draw images and tables
on the first page of the document.
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If there is an error during the PDF creation process. |
draw_images_and_tables(canvas_obj, doc)
¶
Draws images, a QR code, lines, and tables on the given PDF canvas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
canvas_obj
|
Canvas
|
The PDF canvas object to draw on |
required |
doc
|
SimpleDocTemplate
|
The PDF document that is being generated. This parameter is not used directly but is required by the ReportLab framework for page rendering. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
generate_qr_code()
¶
Generates a QR code for the given URL and saves it as an image file.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The file path of the generated QR code image. |
header()
¶
Generates the header section for the repository analysis report.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
A list of Paragraph elements representing the header content. |
table_builder(data, w_first_col, w_second_col, coloring=False)
staticmethod
¶
Builds a styled table with customizable column widths and optional row coloring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
List
|
The table data, where the first row is treated as a header. |
required |
w_first_col
|
int
|
The width of the first column. |
required |
w_second_col
|
int
|
The width of the second column. |
required |
coloring
|
bool
|
If True, applies conditional row coloring based on the values in the second column. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
Table |
Table
|
A formatted table with applied styles. |
table_generator()
¶
Generates two tables containing repository statistics and presence of key elements.
The first table includes basic repository statistics, and the second table shows the presence of important elements such as README, License, Documentation, etc.
Returns:
| Type | Description |
|---|---|
tuple[Table, Table]
|
tuple[Table, Table]: A tuple containing two Table objects. |
ReportGenerator
¶
Bases: AbstractReportGenerator
body_second_part()
¶
Generates the second part of the report, which contains the analysis of the repository.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list[Flowable]
|
A list of Paragraph objects for the PDF report. |
WhatHasBeenDoneReportGenerator
¶
Bases: AbstractReportGenerator
body_second_part()
¶
Generates the second part of the report, which contains the steps for improving repository taken by the OSA.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list[Flowable]
|
A list of Paragraph objects for the PDF report. |
run()
¶
Build the OSA work summary PDF and return a structured result with events.
This mirrors the contract used by other operations so that: - callers receive a dict with "result" and "events" - each generated report is tracked as an OperationEvent