Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Dependency Tracking with Deptrac
Search
Jan Schädlich
October 13, 2020
Programming
1
530
Dependency Tracking with Deptrac
Jan Schädlich
October 13, 2020
Tweet
Share
More Decks by Jan Schädlich
See All by Jan Schädlich
Demystifying Bundles
jschaedl
1
200
Symfony Notifier Demystified
jschaedl
3
150
Symfony Notifier Demystified
jschaedl
4
380
Symfony Notifier Component
jschaedl
0
350
What's new in Symfony 4.4/5.0
jschaedl
0
270
What's new in Symfony 4.3
jschaedl
0
310
Other Decks in Programming
See All in Programming
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
160
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Macとオーディオ再生 2024/11/02
yusukeito
0
370
みんなでプロポーザルを書いてみた
yuriko1211
0
260
Quine, Polyglot, 良いコード
qnighy
4
640
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
910
as(型アサーション)を書く前にできること
marokanatani
8
2.6k
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Contemporary Test Cases
maaretp
0
130
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Featured
See All Featured
Six Lessons from altMBA
skipperchong
27
3.5k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Teambox: Starting and Learning
jrom
133
8.8k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Scaling GitHub
holman
458
140k
Side Projects
sachag
452
42k
Transcript
Dependency Tracking with Deptrac Jan Schädlich @jschaedl SensioLabs 2020-10-13 |
Symfony User Group Hamburg An Introduction with Examples
Software Architecture
–Ralph Johnson „Architecture is about the important stuff. Whatever that
is.“
Core Admin Customer Driven Driving Hexagonal Architecture Onion Architecture Separation
of Concerns ‣ Separation is achieved by dividing the software into layers ‣ At least one layer for business rules and another for interfaces
None
How to ensure that our code follows the defined architecture?
https://github.com/sensiolabs-de/deptrac Deptrac
Installation
✓ PHAR | https://github.com/sensiolabs-de/deptrac/releases ✓ phive install -g sensiolabs-de/deptrac ✓
composer require --dev sensiolabs-de/deptrac-shim X composer require --dev sensiolabs-de/deptrac
The depfile.yaml
# depfile.yaml paths: - ./src exclude_files: - .*Tests.* - .*Resources.*
- .*DependencyInjection.*
# ... layers: - name: Entity collectors: - type: className
regex: .*\\App\\Entity\\.* ‣ There are also other collector types available.
# ... layers: # ... - name: UseCase collectors: -
type: className regex: .*\\App\\UseCase\\.*
# ... layers: # ... - name: Controller collectors: -
type: className regex: .*\\App\\Controller\\.*
# ... ruleset: Entity: ~ UseCase: - Entity Controller: -
Entity - UseCase The Entity layer must not depend on other layers. The UseCase layer only depends on the Entity layer. The Controller layer can depend on the Entity and the UseCase layer.
Collectors
# directory - name: Controller collectors: - type: directory regex:
./App/Controller/.*
# className - name: Controller collectors: - type: className regex:
.*App\\.*Controller.*
# classNameRegex - name: Controller collectors: - type: classNameRegex regex:
'#.*App\\.*Controller.*#'
# bool - name: Admin collectors: - type: bool must:
- type: className regex: .*\\Admin\\.* must_not: - type: className regex: .*\\AdminBundle\\.*
# method - name: Foo services collectors: - type: method
name: .*foo
# implements - name: Foo collectors: - type: implements name:
'App\SomeInterface'
# extends - name: Foo collectors: - type: extends name:
'App\SomeClass'
# uses - name: Foo collectors: - type: uses name:
'App\SomeTrait'
# inherits - name: Foo collectors: - type: inherits name:
'App\{Interface|Class|Trait}'
Formatters
Console ‣ This is the default formatter.
None
Github Actions ‣ Default formatter in Github Actions environment.
Github Actions
$ deptrac analyze examples/ControllerServiceRepository1.depfile.yml \ -—formatter-graphviz=1 \ --formatter-graphviz-display=1 \ --formatter-graphviz-dump-image=path/to/file.png
\ --formatter-graphviz-dump-dot=path/to/file.dot \ —-formatter-graphviz-dump-html=path/to/file.html Graphviz
$ deptrac analyze examples/ControllerServiceRepository1.depfile.yml \ -—formatter-junit=1 \ —-formatter-junit-dump-xml=./junit-report.xml JUnit
$ deptrac analyze examples/ControllerServiceRepository1.depfile.yml \ -—formatter-xml=1 \ —-formatter-xml-dump-xml=./deptrac-report.xml XML
https://github.com/jschaedl/sfughh-deptrac Demo
More
None
None
# skip_violations skip_violations: App\SomeClass: - App\SomeDependency
None
Thank you! https://speakerdeck.com/jschaedl