qossmic / deptrac

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

DX: misleading error messages #1432

Open staabm opened 3 weeks ago

staabm commented 3 weeks ago

using a invalid configuration like (note names: instead of value:)

  layers:
    - name: SuperGlobal
      collectors:
        - type: superglobal
          names:
            - _POST
            - _GET
            - _REQUEST

leads to a error like

$ composer deptrac
> vendor/bin/deptrac analyze --config-file=app/bridge/deptrac.yaml --report-uncovered --fail-on-uncovered
   1/272 [>---------------------------]   0%

 [ERROR] Analysis finished with an Exception.

         Invalid collector definition.

         SuperglobalCollector needs the names configuration.

the above config was valid in deptrac 1.x and I think the error message made sense at that time. since deptrac 2.x requires a value: config attribute, I think the error message is no longer fitting:

SuperglobalCollector needs the names configuration.


I had a similar experience with

    - name: Controller
      collectors:
        - type: classLike
          regex: .*Controller.*(?<!ActionController)

which worked in deptrac 1.x but leads to this misleading error on deptrac 2.x:

$ composer deptrac
> vendor/bin/deptrac analyze --config-file=app/bridge/deptrac.yaml --report-uncovered --fail-on-uncovered

 [ERROR] Analysis finished with an Exception.

         Invalid collector definition.

         Collector "classLike" needs the regex configuration.