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 authored and plaos committed Aug 23, 2022
1 parent 9abbd8a commit c4a3f71
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[flake8]
ignore = E123,W503,E722
max-line-length = 88
max-doc-length = 72
8 changes: 5 additions & 3 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 @@ -276,7 +278,7 @@ def show_reviews(config: Dict[str, Any]) -> None:

for comment in discussion_data:
# When minimal view is requsted, only show threads where a
# response is required
# 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 c4a3f71

Please sign in to comment.