deptrac icon indicating copy to clipboard operation
deptrac copied to clipboard

Uncovered list

Open stolentine opened this issue 2 years ago • 9 comments

How can i get the list of "uncovered" items?

'''debug:unassigned''' debug displays 8 items and analysis displays uncovered 1000+ items

stolentine avatar Nov 05 '21 17:11 stolentine

@stolentine could you please provide your config file? And also possibly the diverging outputs?

patrickkusebauch avatar Nov 05 '21 18:11 patrickkusebauch

Ooohh... We are in the process of changing the architecture, so the settings are strange in places

paths:
  - ../../app
  - ../../vendor
exclude_files:
  - '#.*test.*#'
  - '#.*Test.*#'
  - '#.*_laravel_idea.*#'
  - '#.*example.*#'
  - '#.*Example.*#'
layers:
  - name: App
    collectors:
      - type: bool
        must:
          - { type: directory, regex: '%currentWorkingDirectory%/app/' }
        must_not:
          - { type: directory, regex: '%currentWorkingDirectory%/app/Legacy' }
          - { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain' }

  - name: Legacy
    collectors:
      - type: bool
        must:
          - { type: directory, regex: '%currentWorkingDirectory%/app/Legacy/.*' }
        must_not:
          - { type: directory, regex: '%currentWorkingDirectory%/app/Legacy/.*/ModuleInterface/.*' }

  - { name: Legacy_ModuleInterface,   collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Legacy/.*/ModuleInterface/.*' } ] }
  - { name: Shared,                   collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain/Shared/.*' } ] }


  - { name: Psr,      collectors: [ { type: directory, regex: '%currentWorkingDirectory%/vendor/psr' } ] }
  - name: Vendor
    collectors:
      - type: bool
        must:
          - type: directory
            regex: '%currentWorkingDirectory%/vendor/'
        must_not:
          - type: directory
            regex: '%currentWorkingDirectory%/vendor/psr/'



  #Module
  - { name: Anticorruption,     collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain/((?!Shared).)*/Anticorruption/.*' } ] }
  - { name: Application,        collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain/((?!Shared).)*/Application/.*' } ] }
  - { name: ModuleInterface,    collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain/((?!Shared).)*/ModuleInterface/.*' } ] }
  - { name: Domain,             collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain/((?!Shared).)*/Domain/.*' } ] }
  - { name: Infrastructure,     collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain/((?!Shared).)*/Infrastructure/.*' } ] }
  - { name: Presentation,       collectors: [ { type: directory, regex: '%currentWorkingDirectory%/app/Subdomain/((?!Shared).)*/Presentation/.*' } ] }

ruleset:
  ModuleInterface:
    - Shared
  Domain:
    - +ModuleInterface
  Application:
    - +Domain
  Anticorruption:
    - ModuleInterface
    - +Application
    - Legacy_ModuleInterface
  Presentation:
    - ModuleInterface
    - Common
    - Vendor #todo
  Infrastructure:
    - +Application
    - Anticorruption
    - Presentation
    - Vendor
    - App

  Shared:
    - Psr
    - Vendor #todo

  #todo
  Legacy:
    - Legacy_ModuleInterface
    - +Vendor
    - Shared
    - +Infrastructure


  #todo
  App:
    - +Vendor
    - Legacy
    - Shared

#########
  Psr:
    - Vendor
  Vendor:
    - Psr
vendor/bin/deptrac debug:unassigned  ./tools/deptrac/depfile_layers.yaml --cache-file=./tools/deptrac/.deptrac.cache 

/app/Subdomain/ApiGateway/todo.php
/app/Subdomain/Core/todo.php
/app/Subdomain/Generic/todo.php
/app/Subdomain/Supporting/todo.php
App\Subdomain\ApiGateway\todo
App\Subdomain\Core\todo
App\Subdomain\Generic\todo
App\Subdomain\Supporting\todo
$ vendor/bin/deptrac analyse ./tools/deptrac/depfile_layers.yaml --cache-file=./tools/deptrac/.deptrac.cache

 9439/9439 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 -------------------- ------ 
  Report                     
 -------------------- ------ 
  Violations           0     
  Skipped violations   0     
  Uncovered            1185  
  Allowed              7898  
  Warnings             0     
  Errors               0     
 -------------------- ------ 

stolentine avatar Nov 05 '21 19:11 stolentine

I guess it is possible that you have 1185 uncovered dependencies on those 4 files and 4 classes in them. That would make sense but it is a lot of dependencies in my mind for just 4 classes. Is this at all plausible? I do not know how big/used the classes are.

patrickkusebauch avatar Nov 05 '21 19:11 patrickkusebauch

You could try to create a dummy layer with just those 4 classes and see if those uncovered dependencies turn into vialiations. If they do, it would be this case. If you have some uncovered dependencies left when debug:unassigned is empty, that would be a concern and quite likely a bug in deptrac.

patrickkusebauch avatar Nov 05 '21 19:11 patrickkusebauch

Sorry, I probably should have removed this, so as not to mislead you. "todo.php" are temporary dummy classes. I removed them and the problem remained only now debug does not display anything

stolentine avatar Nov 05 '21 19:11 stolentine

In that case, the last idea I have is that you are referencing uncovered dependencies to files not in paths. Do you have some examples of the uncovered dependencies?

patrickkusebauch avatar Nov 05 '21 19:11 patrickkusebauch

it looks like the truth. I found this class:

namespace Illuminate\Foundation\Console;

use App\Http\Middleware\PreventRequestsDuringMaintenance;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Foundation\Exceptions\RegisterErrorViewPaths;
use Throwable;

class DownCommand extends Command
{

DownCommand from the vendor for some reason use class "App\Http\Middleware\PreventRequestsDuringMaintenance" which does not exist.

debug:token with an argument of this class has empty output

upd: also generic template in phpDoc:

    /**
     * @return class-string<T>
     */

stolentine avatar Nov 06 '21 12:11 stolentine

Hey. I'm experiencing a similar thing:

 -------------------- ----- 
  Report                    
 -------------------- ----- 
  Violations           0    
  Skipped violations   0    
  Uncovered            305  
  Allowed              178  
  Warnings             0    
  Errors               0    
 -------------------- ----- 

when having empty list with vendor/bin/deptrac debug:unassigned.

What does the "Uncovered" means? Is it related to "unassigned"?

jazithedev avatar Mar 10 '22 07:03 jazithedev

@ktrzos, you can use

$ deptrac --report-uncovered

to see the uncovered dependencies.

pattisahusiwa avatar May 29 '22 02:05 pattisahusiwa

Since there was no update in a while, I assume the existing debug commands and options are enough. I will close this for now.

dbrumann avatar Sep 08 '22 15:09 dbrumann