Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComposerCollector doesn't allow to check exclusion from one of the packages #1434

Open
neontsun opened this issue Jul 15, 2024 · 1 comment

Comments

@neontsun
Copy link

deptrac:
  paths:
    - src/Shared/src
    - src/BoundedContext/Network/src
    - src/BoundedContext/Project/src
    - src/BoundedContext/System/src
  layers:
    - name: Domain
      collectors:
        - type: directory
          value: 'Domain/.*'
    - name: Application
      collectors:
        - type: directory
          value: 'Application/.*'
    - name: Infrastructure
      collectors:
        - type: directory
          value: 'Infrastructure/.*'
    - name: Presentation
      collectors:
        - type: directory
          value: 'Presentation/.*'
    - name: Vendor
      collectors:
        - type: composer
          composerPath: api/composer.json
          composerLockPath: api/composer.lock
          packages:
            - ramsey/uuid
            - symfony/serializer
            - php-ds/php-ds
            - psr/container
            - psr/log
            - psr/simple-cache
            - laravel/framework
            - sebastian/comparator
  ruleset:
    Domain:
    Application:
      - Domain
    Presentation:
      - Domain
      - Application
    Infrastructure:
      - Domain
      - Application
      - Presentation
      - Vendor

In the Vendor layer packages I have the sebastian/comparator package specified, which is ignored by ComposerCollector. My guess is that this package uses autoload/classmap in composer.json instead of psr-4.

SCR-20240715-txgp
@patrickkusebauch
Copy link
Collaborator

Hello,
you are correct, it uses classmap to load the files. It not working is expected documented behavior. Straight from the composer collector documentation:

The composer collector allows you to define dependencies on composer require or require-dev packages that follow PSR-0 or PSR-4 autoloading convention. 

I would suggest using DirectoryCollector over the package's src dir instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants