From 4e8f0b7484562d174c6654f67e4991e6d7ebcde5 Mon Sep 17 00:00:00 2001 From: "S. Co1" Date: Thu, 5 Sep 2019 18:41:21 -0400 Subject: Fix misconfigured flake8 so docstrings are properly linted Relint --- .flake8 | 5 +++-- pydis_site/apps/api/serializers.py | 3 ++- pydis_site/apps/home/tests/test_repodata_helpers.py | 4 ++-- pydis_site/apps/home/views/home.py | 2 +- pydis_site/utils/resources.py | 12 ++++++------ 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"" @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"" @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 -- cgit v1.2.3