qossmic / deptrac

Keep your architecture clean.
https://qossmic.github.io/deptrac
MIT License
2.59k stars 136 forks source link

Warning: Undefined array key "internal_tag" in DependsOnInternalToken.php #1428

Closed staabm closed 3 weeks ago

staabm commented 3 weeks ago

I have just upgraded a project from deptrac 1.x to 2.0.1.

my migrated config looks like:

imports:
    - deptrac.baseline.yaml

parameters:
    analyser:
        types:
            - class # default
            - use # default
            - file # detect entry scripts like cronjobs
    paths:
        - erp/
        - nagios/
        - orderimport/

    layers:
        -   name: EntryScripts
            collectors:
                -   type: directory
                    value: /(erp|nagios|orderimport)/([^\\/]+)\.php$
        -   name: Integration
            collectors:
                -   type: directory
                    value: .*(\\|/)integration(\\|/).*
        -   name: Service
            collectors:
                -   type: directory
                    value: .*(\\|/)service(\\|/).*
        -   name: ViewModel
            collectors:
                -   type: directory
                    value: .*(\\|/)viewmodel(\\|/).*
        -   name: Model
            collectors:
                -   type: classLike
                    value: .*(\\Model\\|_Model_(?!Mapper)).*
        -   name: Mapper
            collectors:
                -   type: classLike
                    value: .*_Mapper_.*
                -   type: classLike
                    value: .*Mapper
        -   name: Vendor
            collectors:
                -   type: directory
                    value: .*(\\|/)vendor(\\|/).*

    ruleset:
        EntryScripts:
            - Model
            - ViewModel
            - Service
        ViewModel:
            - Model
        Model:
            - ViewModel
        Mapper:
            - Model
        Integration:
            - Vendor
            - Model
        Service:
            - Mapper
            - Integration
            - ViewModel
            - Model

when running deptrac with

$ composer deptrac
> vendor/bin/deptrac analyze --config-file=application/Rocket/deptrac.yaml
 180/256 [===================>--------]  70%

 -------------------- ------
  Report
 -------------------- ------
  Violations           0
  Skipped violations   153
  Uncovered            763
  Allowed              1023
  Warnings             0
  Errors               0
 -------------------- ------

 256/256 [============================] 100%> vendor/bin/deptrac analyze --config-file=scripts/deptrac.yaml
 107/118 [=========================>--]  90%

Warning: Undefined array key "internal_tag" in C:\dvl\Workspace\php-clxproductnet\vendor\qossmic\deptrac\src\Core\Analyser\EventHandler\DependsOnInternalToken.php on line 21

I get a PHP Warning

Warning: Undefined array key "internal_tag" in C:\dvl\Workspace\php-clxproductnet\vendor\qossmic\deptrac\src\Core\Analyser\EventHandler\DependsOnInternalToken.php on line 21

not sure whether its a bug in deptrac or in my config

staabm commented 3 weeks ago

just found https://github.com/qossmic/deptrac/issues/1418#issuecomment-2136698261 which fixes the warning

gennadigennadigennadi commented 3 weeks ago

The Config you are using is older right? Because the change to the current yaml syntax happend before my time an I thought that there had been a decent deprecation phase?!

staabm commented 3 weeks ago

The Config you are using is older right?

right - we are long time deptrac users and the config was created years ago - since I fixed my config, I am fine with closing.