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

Added project architecture sniffer docs #3014

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _data/sidebars/dg_dev_sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,8 @@ entries:
nested:
- title: Architecture Sniffer
url: /docs/dg/dev/sdks/sdk/development-tools/architecture-sniffer.html
- title: Project Architecture Sniffer
url: /docs/dg/dev/sdks/sdk/development-tools/project-architecture-sniffer.html
- title: Code Sniffer
url: /docs/dg/dev/sdks/sdk/development-tools/code-sniffer.html
- title: Performance audit tool- Benchmark
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Project Architecture Sniffer
last_updated: Jan 7, 2024
---
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add description and template


[Project Architecture Sniffer](https://github.com/spryker/project-architecture-sniffer) is a powerful tool designed specifically for Spryker projects. It leverages the capabilities of [PHP Mess Detector](https://phpmd.org) to maintain and enforce architectural standards.

Functionality:

* PHPMD rules tailored to the needs of Spryker projects
* [Architecture Sniffer](https://github.com/spryker/architecture-sniffer) rules for enforcing core-specific conventions
* New rules designed to address challenges unique to Spryker projects

This tool ensures that your project's architecture aligns with Spryker's best practices and guidelines.

## Priority levels
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the context for prio levels

- 1: Сritical
- 2: Major
- 3: Medium

For local environments and CI checks, we recommend at least priority 3.

## Install

Include the sniffer as `require-dev` dependency:

```
composer require --dev spryker/project-architecture-sniffer
```

## Run


Run the sniffer from CLI:
```
vendor/bin/phpmd src/Pyz/ text vendor/spryker/project-architecture-sniffer/src/ruleset.xml --minimumpriority 3
```

For command options, see [Command line options](https://phpmd.org/documentation/index.html).


## Violation baseline

When integrating the sniffer into existing projects, you may reveal violations introduced in the past.

If there're a couple of violations, you can refactor them right away and start using the sniffer moving forward.

With many existing violations, we recommend generating a [violation baseline](https://phpmd.org/documentation/#baseline) and move forward writing violation-free code. Review existing violations and plan refactoring the most critical ones. When you fix a violation from the baseline, make sure to update the baseline.



You can [suppress rules](https://phpmd.org/documentation/suppress-warnings.html) on a case-by-case basis. However we strongly recommend using the baseline because ignoring violations may hide consequential violations.

{% info_block infoBox %}

Spryker demo shops may contain violations when analyzed with the Architecture Sniffer, as the tool includes more project specific rules by default.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are the demo shops related to project level rules?

It is recommended to generate a baseline during the initialization phase of your project development.
This allows you to focus on addressing violations related to project-level integrations.

{% endinfo_block %}
Loading