deptrac
deptrac copied to clipboard
Uncovered list
How can i get the list of "uncovered" items?
'''debug:unassigned''' debug displays 8 items and analysis displays uncovered 1000+ items
@stolentine could you please provide your config file? And also possibly the diverging outputs?
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
-------------------- ------
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.
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
.
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
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?
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>
*/
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"?
@ktrzos, you can use
$ deptrac --report-uncovered
to see the uncovered dependencies.
Since there was no update in a while, I assume the existing debug commands and options are enough. I will close this for now.