Skip to content

Commit

Permalink
Fixes by pre-commit: ruff, black, codespell, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
matagus committed Mar 23, 2024
1 parent 0187b3c commit debe137
Show file tree
Hide file tree
Showing 18 changed files with 179 additions and 152 deletions.
2 changes: 0 additions & 2 deletions jira_app/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from django.contrib import admin

# Register your models here.
4 changes: 2 additions & 2 deletions jira_app/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class JiraAppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'jira_app'
default_auto_field = "django.db.models.BigAutoField"
name = "jira_app"
2 changes: 0 additions & 2 deletions jira_app/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from django.db import models

# Create your models here.
2 changes: 1 addition & 1 deletion jira_app/templates/jira_app/issues/children_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tr>
<th>Key</th>
<th>Type</th>
<th style="width: 50%;">Sumary</th>
<th style="width: 50%;">Summary</th>
<th>Status</th>
<th>Assignee</th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion jira_app/templates/jira_app/issues/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<thead>
<tr>
<th>Type</th>
<th style="width: 50%;">Sumary</th>
<th style="width: 50%;">Summary</th>
<th>Status</th>
<th>Assignee</th>
<th>Updated</th>
Expand Down
2 changes: 1 addition & 1 deletion jira_app/templates/jira_app/issues/partial_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<tr>
<th>Key</th>
<th>Type</th>
<th style="width: 50%;">Sumary</th>
<th style="width: 50%;">Summary</th>
<th>Status</th>
<th>Assignee</th>
<th>Updated</th>
Expand Down
4 changes: 2 additions & 2 deletions jira_app/templates/jira_app/projects/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h2 class="text-lg">Releases</h2>
<thead>
<tr>
<th>Name</th>
<th>Completition</th>
<th>Progress</th>
<th>Start Date</th>
<th>Release Date</th>
<th>Released</th>
Expand All @@ -65,7 +65,7 @@ <h2 class="text-lg">Releases</h2>
</td>
<td style="width: 40%;">
<progress class="progress progress--success" value="{{ release.resolved }}" max="{{ release.count }}" title="{{ release.progress }}%">{{ release.progress }}%</progress>
{{ release.progress }}% ({{ release.resolved }} of {{ release.count }})
{{ release.progress }}% ({{ release.resolved }} of {{ release.count }})
</td>
<td style="width: 10%;">
{{ release.startDate }}
Expand Down
32 changes: 14 additions & 18 deletions jira_app/templatetags/jira_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,35 @@

@register.filter
def natural_day(value):
if (value is None) or (value == ''):
return ''
if (value is None) or (value == ""):
return ""

dt = datetime.fromisoformat(value.split('.')[0])
dt = datetime.fromisoformat(value.split(".")[0])
return naturalday(dt)


@register.filter
def to_status_class(category):
return dict(
done='tag--success',
new='tag--primary',
indeterminate='tag--info'
).get(category, 'tag--white')
return dict(done="tag--success", new="tag--primary", indeterminate="tag--info").get(category, "tag--white")


@register.filter
def to_issue_type_class(type_name):
type_name_lower = type_name.lower()

if 'back' in type_name_lower:
return 'tag--link'
elif 'front' in type_name_lower:
return 'tag--black'
elif 'ux' in type_name_lower:
return 'tag--warning'
if "back" in type_name_lower:
return "tag--link"
elif "front" in type_name_lower:
return "tag--black"
elif "ux" in type_name_lower:
return "tag--warning"
else:
return 'tag--info'
return "tag--info"


@register.filter
def to_sprint_state_class(state):
return dict(
closed='tag--black',
active='tag--success',
).get(state, 'tag--white')
closed="tag--black",
active="tag--success",
).get(state, "tag--white")
2 changes: 0 additions & 2 deletions jira_app/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from django.test import TestCase

# Create your tests here.
71 changes: 55 additions & 16 deletions jira_app/urls.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
from django.urls import path

from jira_app.views import (AccountDetailView, AccountListView, IssueListView,
IssueDetailView, ProjectDetailView, SprintListView, ReleaseListView,
BoardListView, BoardDetailView, CommentListView, HistoryListView, ChildIssueListView)
from jira_app.views import (
AccountDetailView,
AccountListView,
IssueListView,
IssueDetailView,
ProjectDetailView,
SprintListView,
ReleaseListView,
BoardListView,
BoardDetailView,
CommentListView,
HistoryListView,
ChildIssueListView,
)


app_name = 'jira_app'
app_name = "jira_app"

urlpatterns = [
path('', AccountListView.as_view(), name='account-list'),
path('accounts/<slug:account_key>/', AccountDetailView.as_view(), name='account-detail'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/', ProjectDetailView.as_view(), name='project-detail'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/sprints/', SprintListView.as_view(), name='sprint-list'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/releases/', ReleaseListView.as_view(), name='release-list'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/boards/', BoardListView.as_view(), name='board-list'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/boards/<int:board_id>/', BoardDetailView.as_view(), name='board-detail'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/issues/', IssueListView.as_view(), name='issue-list'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/children/', ChildIssueListView.as_view(), name='children-list'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/', IssueDetailView.as_view(), name='issue-detail'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/comments/', CommentListView.as_view(), name='comment-list'),
path('accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/history/', HistoryListView.as_view(), name='history-list'),
path("", AccountListView.as_view(), name="account-list"),
path("accounts/<slug:account_key>/", AccountDetailView.as_view(), name="account-detail"),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/", ProjectDetailView.as_view(), name="project-detail"
),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/sprints/", SprintListView.as_view(), name="sprint-list"
),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/releases/",
ReleaseListView.as_view(),
name="release-list",
),
path("accounts/<slug:account_key>/projects/<slug:project_key>/boards/", BoardListView.as_view(), name="board-list"),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/boards/<int:board_id>/",
BoardDetailView.as_view(),
name="board-detail",
),
path("accounts/<slug:account_key>/projects/<slug:project_key>/issues/", IssueListView.as_view(), name="issue-list"),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/children/",
ChildIssueListView.as_view(),
name="children-list",
),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/",
IssueDetailView.as_view(),
name="issue-detail",
),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/comments/",
CommentListView.as_view(),
name="comment-list",
),
path(
"accounts/<slug:account_key>/projects/<slug:project_key>/issues/<slug:issue_key>/history/",
HistoryListView.as_view(),
name="history-list",
),
]
Loading

0 comments on commit debe137

Please sign in to comment.