forked from OWASP-BLT/BLT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automated pr review (OWASP-BLT#3132)
* added views and templates to collect, analyze and display pr analysis * Formats * pre * merge migrations
- Loading branch information
1 parent
01ce0fb
commit 526b385
Showing
10 changed files
with
311 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 5.1.3 on 2024-12-19 12:10 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("website", "0172_merge_20241218_0505"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="PRAnalysisReport", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("pr_link", models.URLField()), | ||
("issue_link", models.URLField()), | ||
("priority_alignment_score", models.IntegerField()), | ||
("revision_score", models.IntegerField()), | ||
("recommendations", models.TextField()), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Generated by Django 5.1.3 on 2024-12-19 13:05 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("website", "0173_pranalysisreport"), | ||
("website", "0173_remove_company_admin_remove_company_integrations_and_more"), | ||
] | ||
|
||
operations = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
{% include "includes/sidenav.html" %} | ||
<div class="container mx-auto px-4 py-8 mt-10"> | ||
<h1 class="text-3xl font-bold mb-8">Submit Pull Request For Analysis</h1> | ||
{% if request.user.is_superuser %} | ||
<a href="/view-pr-analysis/" class="inline-block"> | ||
<button class="bg-red-500 hover:bg-red-700 text-white font-bold py-3 px-6 rounded focus:outline-none focus:shadow-outline"> | ||
View PR analysis | ||
</button> | ||
</a> | ||
{% endif %} | ||
<form method="post" | ||
action="{% url 'submit-roadmap-pr' %}" | ||
class="bg-white shadow-md rounded px-8 pt-8 pb-8 mb-6"> | ||
{% csrf_token %} | ||
<div class="mb-6"> | ||
<label for="pr-link" class="block text-gray-700 text-2xl font-semibold mb-3">GitHub PR Link</label> | ||
<input type="url" | ||
id="pr-link" | ||
name="pr_link" | ||
placeholder="Enter GitHub PR link" | ||
class="shadow appearance-none border rounded w-full py-3 px-4 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" | ||
required> | ||
</div> | ||
<div class="mb-6"> | ||
<label for="issue-link" | ||
class="block text-gray-700 text-2xl font-semibold mb-3">GitHub Issue Link (Roadmap)</label> | ||
<input type="url" | ||
id="issue-link" | ||
name="issue_link" | ||
placeholder="Enter GitHub issue link" | ||
class="shadow appearance-none border rounded w-full py-3 px-4 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" | ||
required> | ||
</div> | ||
<div class="flex items-center justify-center"> | ||
<button type="submit" | ||
class="bg-red-500 hover:bg-red-700 text-white font-bold py-3 px-6 rounded focus:outline-none focus:shadow-outline"> | ||
Submit | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
{% include "includes/sidenav.html" %} | ||
<title>PR Analysis Reports</title> | ||
<style> | ||
.container { | ||
font-family: Arial, sans-serif; | ||
background-color: #f9f9f9; | ||
padding: 20px; | ||
max-width: 800px; | ||
border-radius: 8px; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
} | ||
h1 { | ||
text-align: center; | ||
color: #333; | ||
margin-bottom: 30px; | ||
} | ||
.report { | ||
background-color: #ffffff; | ||
padding: 15px; | ||
margin-bottom: 20px; | ||
border: 1px solid #ddd; | ||
border-radius: 5px; | ||
} | ||
.report h3 { | ||
color: #555; | ||
font-size: 20px; | ||
margin-bottom: 10px; | ||
} | ||
.report p { | ||
color: #666; | ||
line-height: 1.6; | ||
} | ||
.report a { | ||
color: #007bff; | ||
text-decoration: none; | ||
} | ||
.report a:hover { | ||
text-decoration: underline; | ||
} | ||
.report hr { | ||
border: 0; | ||
height: 1px; | ||
background: #ddd; | ||
margin: 20px 0; | ||
} | ||
.no-reports { | ||
text-align: center; | ||
color: #999; | ||
} | ||
</style> | ||
<div class="container mt-20"> | ||
<h1 class="text-3xl font-bold">PR Analysis Reports</h1> | ||
{% for report in reports %} | ||
<div class="report"> | ||
<h3>PR Analysis</h3> | ||
<p> | ||
<strong>PR Link:</strong> <a href="{{ report.pr_link }}" target="_blank">{{ report.pr_link }}</a> | ||
</p> | ||
<p> | ||
<strong>Issue Link:</strong> <a href="{{ report.issue_link }}" target="_blank">{{ report.issue_link }}</a> | ||
</p> | ||
<p> | ||
<strong>Priority Alignment Score:</strong> {{ report.priority_alignment_score }} | ||
</p> | ||
<p> | ||
<strong>Revision Score:</strong> {{ report.revision_score }} | ||
</p> | ||
<p> | ||
<strong>Recommendations:</strong> | ||
</p> | ||
<p>{{ report.recommendations }}</p> | ||
<p> | ||
<small><em>Created on: {{ report.created_at }}</em></small> | ||
</p> | ||
</div> | ||
<hr> | ||
{% empty %} | ||
<p class="no-reports">No analysis reports available.</p> | ||
{% endfor %} | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters