Skip to content

Commit

Permalink
Make doc strings PEP8 compliant
Browse files Browse the repository at this point in the history
According to PEP8, doc strings should be 72 characters wide at most.
They now are.
  • Loading branch information
Simon-1-1 committed Aug 10, 2022
1 parent 3d7dd5f commit b957269
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- run: poetry run isort --check-only --diff .

- run: poetry run flake8
- run: poetry run flake8 --max-doc-length 72

- run: poetry run mypy --strict .

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ run:

lint:
${BLACK} --check --diff --color .
${FLAKE8}
${FLAKE8} --max-doc-length 72
${ISORT} --color --check-only --diff .
${MYPY} --strict .

Expand Down
13 changes: 8 additions & 5 deletions reviewcheck/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""
A script to show you what threads in GitLab you've forgotten to respond to.
A script to show you what threads in GitLab you've forgotten to respond
to.
You have to configure the script before running it by running reviewcheck --configure
You have to configure the script before running it by running
reviewcheck --configure.
"""
import json
import logging
Expand Down Expand Up @@ -35,7 +37,8 @@
def download_gitlab_data(
get_data: Tuple[str, int, str],
) -> Tuple[List[Dict[str, Any]], int]:
# This is how to create a reusable connection pool with python requests.
# This is how to create a reusable connection pool with python
# requests.
with requests.Session() as session:
session.mount(
"https://",
Expand Down Expand Up @@ -331,8 +334,8 @@ def show_reviews(config: Dict[str, Any]) -> None:
console.print(mr_info_header)

for comment in discussion_data:
# When minimal view is requsted, only show threads where a response is
# required
# When minimal view is requsted, only show threads where a
# response is required.
if hide_replied_discussions:
if comment["notes"][-1]["author"]["username"] == user:
continue
Expand Down
6 changes: 3 additions & 3 deletions reviewcheck/common/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class RCException(Exception):
"""
Base exception to inherit from when creating custom exceptions and to use directly
when it's not necessary to differentiate excepitons. It is caught in main and will
print the message in the exceptions.
Base exception to inherit from when creating custom exceptions and
to use directly when it's not necessary to differentiate excepitons.
It is caught in main and will print the message in the exceptions.
"""
12 changes: 7 additions & 5 deletions reviewcheck/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def __init__(self, reconfigure: bool):
self.reconfigure = reconfigure

def setup_configuration(self) -> None:
# Only attempt to write the configuration file if it does not already exist
# Only attempt to write the configuration file if it does not
# already exist.
if self.reconfigure or not Constants.CONFIG_PATH.exists():
Constants.CONFIG_PATH.parent.mkdir(parents=True, exist_ok=True)

Expand Down Expand Up @@ -48,11 +49,12 @@ def setup_configuration(self) -> None:

def get_configuration(self) -> Optional[Dict[str, Any]]:
"""
Reads the configuration file into a dictionary. If the configuration file does
not exist, queries the user for information and writes it.
Reads the configuration file into a dictionary. If the
configuration file does not exist, queries the user for
information and writes it.
:return: A dict containing the contents of the configuration file, or None if
the file does not exist.
:return: A dict containing the contents of the configuration
file, or None if the file does not exist.
"""

self.setup_configuration()
Expand Down
10 changes: 6 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ class TestConfig(TestCase):
@mock.patch("builtins.input")
def test_setup_configuration(self, mock_input: mock.MagicMock) -> None:
"""
Verifies that the interactive configuration setup works as expected.
Verifies that the interactive configuration setup works as
expected.
"""

# The setup_configuration method reads input from the user five times in a row:
# The setup_configuration method reads input from the user five
# times in a row:
# token, username, api url, jira url, and finally project IDs
mock_input.side_effect = [
"very_secret",
Expand Down Expand Up @@ -57,8 +59,8 @@ def test_setup_configuration(self, mock_input: mock.MagicMock) -> None:

def test_setup_configuration_without_reconfigure(self) -> None:
"""
Verifies that the configuration setup does not alter anything if the file
already exists.
Verifies that the configuration setup does not alter anything if
the file already exists.
"""

with tempfile.TemporaryDirectory(
Expand Down

0 comments on commit b957269

Please sign in to comment.