Skip to content

Commit

Permalink
Exchange Sanity to Coherence
Browse files Browse the repository at this point in the history
  • Loading branch information
fbrodrigorezino committed Dec 4, 2021
1 parent 42808b3 commit 1ecbf30
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Hexagonal Sanity Check
# Hexagonal Coherence Check

This project checks if the dependency flow between the layers of the Hexagonal architecture defined
for this project was respected.

### How to install

It can be easily installed via pip: `pip install hexagonal-sanity-check`
It can be easily installed via pip: `pip install hexagonal-py`

### How to configure your project

Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[tool.poetry]
name = "hexagonal-sanity-check"
version = "0.0.21"
description = """Hexagonal Sanity Check"""
name = "hexagonal-coherence-check"
version = "0.0.22"
description = """Hexagonal Coherence Check"""
readme = 'README.md'
authors = ["rfrezino <rodrigofrezino@gmail.com>"]
packages = [{ include = "hexagonal", from = "src"}]
keywords = ["hexagonal architecture", "onion architecture", "enforce rules"]
exclude = ["src/hexagonal/sanity_check_hexagonal_config.py"]
keywords = ["hexagonal architecture", "onion architecture", "enforce rules", "coherence check"]
exclude = ["src/hexagonal/hexagonal_project_config.py"]

[tool.poetry.dependencies]
python = "^3.7"
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/hexagonal/infrastructure/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

from hexagonal.domain.hexagonal_error import HexagonalError
from hexagonal.hexagonal_config import hexagonal_config
from hexagonal.use_cases.check_project_sanity_usecase import CheckProjectSanityUseCase, HexagonalCheckResponse
from hexagonal.use_cases.check_project_coherence_usecase import CheckProjectCoherenceUseCase, HexagonalCheckResponse
from hexagonal.use_cases.generate_diagram_usecase import GenerateDiagramUseCase


@click.group(help='Options for Hexagonal Sanity Check')
@click.group(help='Options for Hexagonal Coherence Check')
def cli():
pass

Expand Down Expand Up @@ -43,7 +43,7 @@ def _build_response_message() -> str:
try:
_process_cli_arguments(source_path=source_path, hexagonal_config_file=hexagonal_config_file)

checker = CheckProjectSanityUseCase(hexagonal_config=hexagonal_config, source_folder=source_path)
checker = CheckProjectCoherenceUseCase(hexagonal_config=hexagonal_config, source_folder=source_path)
response = checker.check()
_print_check_response(response)
except Exception as error:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class HexagonalCheckResponse:
hexagonal_project: HexagonalProject


class CheckProjectSanityUseCase:
class CheckProjectCoherenceUseCase:
_source_folder_full_path: str
_source_folder: str
_hexagonal_config: HexagonalConfig
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/infrastructure/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_cli_bootstrap_should_return_true(self):
# This tests check the consistency of this on project
runner = CliRunner()
result = runner.invoke(check, ['--source_path', get_project_path() + '/src/hexagonal',
'--hexagonal_config_file', 'sanity_check_hexagonal_config.py'])
'--hexagonal_config_file', 'hexagonal_project_config.py'])

expected_msg = 'Hexagonal Architecture: Checked a project with 4 hexagonal layers, ' \
'25 python files and found 0 errors.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

from hexagonal.domain.hexagonal_layer import HexagonalLayer
from hexagonal.hexagonal_config import HexagonalConfig
from hexagonal.services.hexagonal_composition import HexagonalComposition
from hexagonal.use_cases.check_project_sanity_usecase import CheckProjectSanityUseCase
from hexagonal.use_cases.check_project_coherence_usecase import CheckProjectCoherenceUseCase
from tests.integration_tests.utils.utils import get_sample_wrong_test_project_path, get_sample_correct_test_project_path


class HexagonalSanityCheckUnitTest(TestCase):
class HexagonalCoherenceCheckUnitTest(TestCase):

def test_check_when_project_has_wrong_dependencies_import_return_errors(self):
expected_project_full_path = get_sample_wrong_test_project_path()
Expand All @@ -18,7 +17,7 @@ def test_check_when_project_has_wrong_dependencies_import_return_errors(self):
hexagonal_config.add_inner_layer(HexagonalLayer(name='services', directories=['/services']))
hexagonal_config.add_inner_layer(HexagonalLayer(name='domain', directories=['/domain']))

usecase = CheckProjectSanityUseCase(hexagonal_config=hexagonal_config,
usecase = CheckProjectCoherenceUseCase(hexagonal_config=hexagonal_config,
source_folder=expected_project_full_path)
response = usecase.check()

Expand All @@ -41,7 +40,7 @@ def test_check_when_project_has_right_dependencies_import_return_no_errors(self)
hexagonal_config.add_inner_layer(HexagonalLayer(name='services', directories=['/services']))
hexagonal_config.add_inner_layer(HexagonalLayer(name='domain', directories=['/domain']))

usecase = CheckProjectSanityUseCase(hexagonal_config=hexagonal_config, source_folder=expected_project_full_path)
usecase = CheckProjectCoherenceUseCase(hexagonal_config=hexagonal_config, source_folder=expected_project_full_path)
response = usecase.check()

self.assertEqual(11, len(response.python_files))
Expand Down

0 comments on commit 1ecbf30

Please sign in to comment.