Configuration
The configuration file describes your layers, ruleset and adjusts output formatting.
We suggest you also check out Deptrac's configuration for checking its own architecture as it uses most available options.
Deptrac
The following table shows the available config keys for Deptrac.
Property Path | Input description | Example usage |
---|---|---|
analyser.internal_tag |
Specifies a custom doc block tag which deptrac should use to identify layer-internal
class-like structures. The tag @deptrac-internal will always be used
for this purpose. This option allows an additional tag to be specified, such as
@layer-internal or plain @internal .
|
|
analyser.types |
A list with at least one of the following supported dependency types:
|
|
paths |
List of paths where Deptrac should look for dependencies to be analysed.
Usually, this is where your code is stored, e.g. src/ , or lib/ or
something similar.
|
|
exclude_files | A list of regular expression-patterns to determine which files or directories to exclude, e.g. test files or config | |
formatters.graphviz.groups | Key is the name of the group and values are the layers belonging to that group | |
formatters.graphviz.hidden_layers | List of layers to be excluded from the Graphviz output | |
formatters.codeclimate.severity |
Assigns a severity to each section reported by Deptrac. The following
severity types are supported by codeclimate:
|
|
deptrac.ignore_uncovered_internal_classes |
Whether PHP-internal classes like DateTimeImmutable should count
towards uncovered classes, when they are not part of any layer.
|
|
deptrac.layers | Defines your architectural layers by collecting dependencies using collectors | |
deptrac.ruleset |
Assign communication rules by specifying which layers a layer can
communicate with (if any). If you prepend a layer with + then not
only this layer is allowed, but also all layers it allows.
|
|
deptrac.skip_violations | Define a dictionary of dependencies and their known violations. This violations will be ignored in your pipeline and not trigger a failing return code. |
Imports
If your config file becomes too large, you can split it up into multiple files
that can then be imported in the main file using the imports
section.
This is also useful to separate your baseline from the rest of the
configuration, so it can be regenerated by the baseline
formatter.
Example:
Services
Please see Symfony docs. This allows you to register new services, e.g. custom formatters or collectors.
services:
- class: Internal\Qossmic\Deptrac\IgnoreDependenciesOnContract
tags:
- { name: kernel.event_listener, event: Qossmic\Deptrac\Contract\Analyser\ProcessEvent }
Parameters
Deptrac provides parameters that can be user in your configuration.
%currentWorkingDirectory%
The path Deptrac runs in%projectDirectory%
The path where the configuration is stored.%cache_file%
contains the filename and path for the cache file. Note: This parameter is overwritten by--cache-file=
if it is set.
You can specify your own parameters and reuse them in your configuration:
Example: