aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2019-09-05 18:41:21 -0400
committerGravatar S. Co1 <[email protected]>2019-09-05 18:41:21 -0400
commit4e8f0b7484562d174c6654f67e4991e6d7ebcde5 (patch)
tree8dcaca167e965e17ea4c6d21bedf0d5a157f5833
parentMerge pull request #240 from python-discord/update-contrib (diff)
Fix misconfigured flake8 so docstrings are properly linted
Relint
-rw-r--r--.flake85
-rw-r--r--pydis_site/apps/api/serializers.py3
-rw-r--r--pydis_site/apps/home/tests/test_repodata_helpers.py4
-rw-r--r--pydis_site/apps/home/views/home.py2
-rw-r--r--pydis_site/utils/resources.py12
5 files changed, 14 insertions, 12 deletions
diff --git a/.flake8 b/.flake8
index 4157e507..605bc46e 100644
--- a/.flake8
+++ b/.flake8
@@ -1,14 +1,15 @@
[flake8]
+docstring-convention=all
ignore=
P102,B311,W503,E226,S311,
# Missing Docstrings
- D100,D104,D107,
+ D100,D104,D105,D107,
# Docstring Whitespace
D203,D212,D214,D215,
# Docstring Quotes
D301,D302,
# Docstring Content
- D400,D401,D402,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414
+ D400,D401,D402,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414,D416,D417
per-file-ignores =
**/tests/**:D101,D102,D103,D105,D106,S106
diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py
index 40ca755d..442f6209 100644
--- a/pydis_site/apps/api/serializers.py
+++ b/pydis_site/apps/api/serializers.py
@@ -122,7 +122,8 @@ class InfractionSerializer(ModelSerializer):
class ExpandedInfractionSerializer(InfractionSerializer):
- """A class providing expanded (de-)serialization of `Infraction` instances.
+ """
+ A class providing expanded (de-)serialization of `Infraction` instances.
In addition to the fields of `Infraction` objects themselves, this
serializer also attaches the `user` and `actor` fields when serializing.
diff --git a/pydis_site/apps/home/tests/test_repodata_helpers.py b/pydis_site/apps/home/tests/test_repodata_helpers.py
index df1ffd73..61b8e034 100644
--- a/pydis_site/apps/home/tests/test_repodata_helpers.py
+++ b/pydis_site/apps/home/tests/test_repodata_helpers.py
@@ -11,7 +11,7 @@ from pydis_site.apps.home.views import HomeView
def mocked_requests_get(*args, **kwargs) -> "MockResponse": # noqa
- """A mock version of requests.get, so we don't need to call the API every time we run a test"""
+ """A mock version of requests.get, so we don't need to call the API every time we run a test."""
class MockResponse:
def __init__(self, json_data, status_code):
self.json_data = json_data
@@ -61,7 +61,7 @@ class TestRepositoryMetadataHelpers(TestCase):
@mock.patch('requests.get', side_effect=mocked_requests_get)
def test_refresh_stale_metadata(self, _: mock.MagicMock):
- """Test if the _get_repo_data helper will refresh when the data is stale"""
+ """Test if the _get_repo_data helper will refresh when the data is stale."""
repo_data = RepositoryMetadata(
repo_name="python-discord/site",
description="testrepo",
diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py
index 03873a72..63f25c15 100644
--- a/pydis_site/apps/home/views/home.py
+++ b/pydis_site/apps/home/views/home.py
@@ -106,6 +106,6 @@ class HomeView(View):
return database_repositories
def get(self, request: WSGIRequest) -> HttpResponse:
- """Collect repo data and render the homepage view"""
+ """Collect repo data and render the homepage view."""
repo_data = self._get_repo_data()
return render(request, "home/index.html", {"repo_data": repo_data})
diff --git a/pydis_site/utils/resources.py b/pydis_site/utils/resources.py
index fcf8bd75..fb5faef8 100644
--- a/pydis_site/utils/resources.py
+++ b/pydis_site/utils/resources.py
@@ -9,7 +9,7 @@ import yaml
@dataclass
class URL:
- """A class representing a link to a resource"""
+ """A class representing a link to a resource."""
icon: str
title: str
@@ -17,7 +17,7 @@ class URL:
class Resource:
- """A class representing a resource on the resource page"""
+ """A class representing a resource on the resource page."""
description: str
name: str
@@ -26,7 +26,7 @@ class Resource:
urls: typing.List[URL]
def __repr__(self):
- """Return a representation of the resource"""
+ """Return a representation of the resource."""
return f"<Resource name={self.name}>"
@classmethod
@@ -46,14 +46,14 @@ class Resource:
class Category:
- """A class representing a resource on the resources page"""
+ """A class representing a resource on the resources page."""
resources: typing.List[Resource]
name: str
description: str
def __repr__(self):
- """Return a representation of the category"""
+ """Return a representation of the category."""
return f"<Category name={self.name}>"
@classmethod
@@ -80,7 +80,7 @@ class Category:
def load_categories(order: typing.List[str]) -> typing.List[Category]:
- """Load the categories specified in the order list and return them"""
+ """Load the categories specified in the order list and return them."""
categories = []
for cat in order:
direc = "pydis_site/apps/home/resources/" + cat