Skip to content

Commit

Permalink
pre-commit docformatter integration
Browse files Browse the repository at this point in the history
This uses a custom docformatter, since upstream repository is currently broken, see:
PyCQA/docformatter#293
  • Loading branch information
biolds committed Jan 8, 2025
1 parent 5323735 commit c05879f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ repos:
hooks:
- id: bandit
exclude: "^(doc/.*|se/test_.*)$"
- repo: https://github.com/biolds/docformatter
rev: v1.7.6-alpha
hooks:
- id: docformatter
9 changes: 3 additions & 6 deletions se/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ def test_views(self):
self._view_request(url, view_cls, params, self.anon_user, anon_expected)

def test_views_no_auth(self):
"""
Test views that require no authentication
"""
"""Test views that require no authentication."""
for url, view_cls, params in (("/opensearch.xml", OpensearchView, {}),):
for anon_search in (True, False):
with self.settings(SOSSE_ANONYMOUS_SEARCH=anon_search):
Expand All @@ -145,9 +143,8 @@ def test_views_no_auth(self):
self._view_request(url, view_cls, params, self.anon_user, 200)

def test_views_no_auth_redirect(self):
"""
Test views that do not redirect to the login page when auth is required
"""
"""Test views that do not redirect to the login page when auth is
required."""
for url, view_cls, params in (
("/atom/?q=page", AtomView, {}),
("/atom/?q=page&cached=1", AtomView, {}),
Expand Down
6 changes: 2 additions & 4 deletions se/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@


def format_url(request, params):
"""
This function takes the current url and replaces query parameters
by new values provided
"""
"""This function takes the current url and replaces query parameters by new
values provided."""
parsed_url = urlparse(request.get_full_path())
query_string = parse_qs(parsed_url.query)
for k, v in query_string.items():
Expand Down
4 changes: 1 addition & 3 deletions sosse/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#
# You should have received a copy of the GNU Affero General Public License along with SOSSE.
# If not, see <https://www.gnu.org/licenses/>.

"""
Django settings for SOSSE project.
"""Django settings for SOSSE project.
Generated by 'django-admin startproject' using Django 2.2.25.
Expand Down
1 change: 0 additions & 1 deletion sosse/sosse_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#
# You should have received a copy of the GNU Affero General Public License along with SOSSE.
# If not, see <https://www.gnu.org/licenses/>.

"""Django's command-line utility for administrative tasks."""

import os
Expand Down
3 changes: 1 addition & 2 deletions sosse/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#
# You should have received a copy of the GNU Affero General Public License along with SOSSE.
# If not, see <https://www.gnu.org/licenses/>.

"""sosse URL Configuration
"""Sosse URL Configuration.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Expand Down
4 changes: 1 addition & 3 deletions sosse/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#
# You should have received a copy of the GNU Affero General Public License along with SOSSE.
# If not, see <https://www.gnu.org/licenses/>.

"""
WSGI config for sosse project.
"""WSGI config for sosse project.
It exposes the WSGI callable as a module-level variable named ``application``.
Expand Down

0 comments on commit c05879f

Please sign in to comment.