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
570
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
220
Symfony Notifier Demystified
jschaedl
3
170
Symfony Notifier Demystified
jschaedl
4
410
Symfony Notifier Component
jschaedl
0
370
What's new in Symfony 4.4/5.0
jschaedl
0
300
What's new in Symfony 4.3
jschaedl
0
340
Other Decks in Programming
See All in Programming
監視 やばい
syossan27
12
10k
スモールスタートで始めるためのLambda×モノリス(Lambdalith)
akihisaikeda
2
340
Road to RubyKaigi: Making Tinny Chiptunes with Ruby
makicamel
4
540
Improve my own Ruby
sisshiki1969
0
100
KANNA Android の技術的課題と取り組み
watabee
0
180
The Missing Link in Angular’s Signal Story: Resource API and httpResource
manfredsteyer
PRO
0
140
Optimizing JRuby 10
headius
0
560
The New Developer Workflow: How AI Transforms Ideas into Code
danielsogl
0
100
The Implementations of Advanced LR Parser Algorithm
junk0612
1
1.3k
GitHub Copilot for Azureを使い倒したい
ymd65536
1
310
プロダクトエンジニアのしごと 〜 受託 × 高難度を乗り越えるOptium開発 〜
algoartis
0
150
設計の本質:コード、システム、そして組織へ / The Essence of Design: To Code, Systems, and Organizations
nrslib
10
3.7k
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
71
10k
Why Our Code Smells
bkeepers
PRO
336
57k
Into the Great Unknown - MozCon
thekraken
38
1.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
KATA
mclloyd
29
14k
Rails Girls Zürich Keynote
gr2m
94
13k
Typedesign – Prime Four
hannesfritz
41
2.6k
Designing Experiences People Love
moore
142
24k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
Six Lessons from altMBA
skipperchong
28
3.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.5k
Code Review Best Practice
trishagee
67
18k
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