Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add pydocstyle #47

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

py_sources = common/ daemons/ domain/ gateways/ handlers/ tests/ usecases/ utils/
pydocstyle_sources = common/ daemons/ domain/ gateways/ usecases/ utils/
py_sources = $(pydocstyle_sources) handlers/ tests/
pytest_flags = -p no:warnings --cov=. --cov-report=html --cov-report=term --cov-report=xml --cov-fail-under=90
mypy_flags = --warn-unused-configs --disallow-incomplete-defs --no-implicit-optional --warn-redundant-casts --warn-unused-ignores

Expand All @@ -17,12 +18,16 @@ mypy:
flake8:
flake8 $(py_sources)

.PHONY: pydocstyle
pydocstyle:
pydocstyle $(pydocstyle_sources)

.PHONY: isort-check
isort-check:
isort --ac --check-only $(py_sources)

.PHONY: check
check: flake8 isort-check mypy
check: flake8 pydocstyle isort-check mypy

.PHONY: yapf
yapf:
Expand Down
22 changes: 22 additions & 0 deletions common/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,46 @@


class Environment(Enum):
"""List of possible environments"""

PROD = 'PROD'
DEV = 'DEV'
TEST = 'TEST'

@property
def is_prod(self) -> bool:
"""Check if current value is prod

:return: if is prod or not
:rtype: bool
"""
return self is self.PROD

@property
def is_dev(self) -> bool:
"""Check if current value is dev

:return: if is dev or not
:rtype: bool
"""
return self is self.DEV

@property
def is_test(self) -> bool:
"""Check if current value is test

:return: if is test or not
:rtype: bool
"""
return self is self.TEST

@classmethod
def default(cls) -> 'Environment':
"""Return default environment

:return: dev environment
:rtype: :py:class:`common.configuration.Environment`
"""
return cls.DEV


Expand Down
46 changes: 31 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Faker = "^8.4.0"
factory-boy = "^3.2.0"
fakeredis = "^1.5.1"
pytest-aiohttp = "^0.3.0"
pydocstyle = "^6.1.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ omit =
[flake8]
max-line-length = 119

[pydocstyle]
inherit = false
convention = google
add_ignore = D104, D100, D400, D107, D415

[yapf]
based_on_style = pep8
spaces_before_comment = 2
Expand Down