Giter Club home page Giter Club logo

deptrac's People

Contributors

clxmstaab avatar d4s6 avatar danielbadura avatar davidbadura avatar dbrumann avatar dependabot[bot] avatar gennadigennadigennadi avatar hugochinchilla avatar jkuchar avatar jschaedl avatar jtaylor100 avatar localheinz avatar lprzybylek avatar maciejkosiarski avatar marcelthole avatar marcosh avatar marvinklemp avatar mdevlamynck avatar mre avatar oldy777 avatar patrickkusebauch avatar rubenrubiob avatar sasezaki avatar slde-flash avatar smoench avatar staabm avatar theofidry avatar timglabisch avatar tomasvotruba avatar xabbuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deptrac's Issues

formatter cli interface

analog zu

--formatter-graphviz --formatter-graphviz-format=dot --formatter-graphviz-path=file.png --formatter-json

Issue with tilde in depfile's exclude_files

I get the following error (on PHP 5.5):

Warning: Invalid argument supplied for foreach() in phar:///path/to/deptrac.phar/src/Command/AnalyzeCommand.php on line 151

which seems to be caused by using the tilde in the exclude_files-section in my depfile.yml:

exclude_files: ~

The same depfile works fine on a system using PHP 7.0.5.

Hide console output for generating AstMap

Right now when running deptrac generates some noise related to generating the AstMap, e.g. for each file being parsed.

It would be nice if this output is hidden by default and then only being displayed when using -v.

Options for Graphviz-Formatter are being ignored

I want to omit generating a dependency graph image by running deptrac with the following options:

php deptrac.phar --formatter-graphviz=0 --formatter-graphviz-display=0

but it will still open image previewer with the dependency graph.

additional configuration required to run 'make build'

make build gave me an error that phar.readonly is "On" in php.ini.
After looking into my php.ini (/etc/php5/cli/php.ini) i noticed
;phar.readonly = On
As you can see its commented, so On seems to be the default behavior as well.
Setting it to Off and uncommenting it solved the issue for me.

Invalid argument in foreach

My deptrac phar is bin/deptrac (executable) and I have the following config:

# .depfile/top_layers.yml

paths:
  - src

exclude_files: ~

layers:
  - name: Domain
    collectors:
      - type: className
        regex: .*\\Domain\\.*

  - name: Application
    collectors:
      - type: className
        regex: .*\\Application\\.*

  - name: Infrastructure
    collectors:
      - type: className
        regex: .*\\Infrastructure\\.*

  - name: Tests
    collectors:
      - type: className
        regex: .*\\Tests\\.*

ruleset:
  Domain: ~

  Application:
    - Domain

  Infrastructure:
    - Application
    - Domain

  Tests:
    - Infrastructure
    - Application
    - Domain

When running bin/deptrac analyze .dotfile/top_layers.yml, I get:

Warning: Invalid argument supplied for foreach() in phar:///path/to/myproject/bin/deptrac/src/Command/AnalyzeCommand.php on line 151

Call Stack:
    0.0007     357264   1. {main}() /path/to/myproject/bin/deptrac:0
    0.0197    1119120   2. require('phar:///path/to/myproject/bin/deptrac/deptrac.php') /path/to/myproject/bin/deptrac:10
    0.0764    3609344   3. Symfony\Component\Console\Application->run() phar:///path/to/myproject/bin/deptrac/deptrac.php:29
    0.0802    3891216   4. Symfony\Component\Console\Application->doRun() phar:///path/to/myproject/bin/deptrac/vendor/symfony/console/Application.php:123
    0.0824    3891216   5. Symfony\Component\Console\Application->doRunCommand() phar:///path/to/myproject/bin/deptrac/vendor/symfony/console/Application.php:192
    0.0828    3891216   6. Symfony\Component\Console\Command\Command->run() phar:///path/to/myproject/bin/deptrac/vendor/symfony/console/Application.php:844
    0.0836    3893664   7. SensioLabs\Deptrac\Command\AnalyzeCommand->execute() phar:///path/to/myproject/bin/deptrac/vendor/symfony/console/Command/Command.php:259
    0.1034    4332464   8. SensioLabs\Deptrac\Command\AnalyzeCommand->collectFiles() phar:///path/to/myproject/bin/deptrac/src/Command/AnalyzeCommand.php:87
    0.1383    5010408   9. array_filter() phar:///path/to/myproject/bin/deptrac/src/Command/AnalyzeCommand.php:158
    0.1717    5045760  10. SensioLabs\Deptrac\Command\AnalyzeCommand->SensioLabs\Deptrac\Command\{closure}() phar:///path/to/myproject/bin/deptrac/src/Command/AnalyzeCommand.php:158

This stack trace appears quite a few time and I still get the graph as a result.

init command vereinfachen

at the moment the dumped depfile (running deptrac init) is not very useful.
some will struggle why foo/vendors doesn't exist.

Add a legend

Would it be possible to add a legend in the generated graph?

Add command to visualize a group

It would be nice to have a command to list all the classes included in a layer, ex:

$ deptrac view Controller

3 class found:
- App\Controller\Ctrl1
- App\Controller\Ctrl2
- App\Controller\Ctrl3

Directory collector

Actually before jumping into a "directory collector" a question comes: why excluding the test(s) folder? I would say everything in src should not depend on what is in tests.

Add a third color

I think it would be nice to add a third color for the links violating the rules.

I personally would put it red... but then requires to change the color of the current red link into another one.

Add support to Symfony 3

deptrac requires all Symfony components in ~2.7. It can be interesting to add Symfony 3 components support.

Also, this library is incompatible with sensiolabs-de/deprecation-detector: it requires nikic/php-parser ~2.0, but deprecation-detector requires nikic/php-parser ^1.3.

Missing layer

Somehow I'm declaring 4 layers, but on the graph I only get 3... I don't see any error on the configuration side (runs fine), how can this be?

Analyze only one specific file against some deptrac configuration / IDE integration

It would be nice if there was a function to analyze only one specific file against some deptrac configuration. It would be a first step to integrate a validator in an IDE.

That would be awesome! Imagine you import some namespaced class and PhpStorm (or another favorite IDE) instantly marking this as an error in your file because it violates your defined architecture.

Sub groups or sublayers

Let's say I have the following tree:

src
  |-- Domain
  |-- Application
  |   \-- Handler
  \ Infrastructure
      |-- Action
      \-- Responder

There's the following layers & ruleset:

layers:
  layers:
  - name: Application
    collectors:
      - type: className
        regex: .*\\Application\\.*

  - name: Domain
    collectors:
      - type: className
        regex: .*\\Domain\\.*

  - name: Infrastructure
    collectors:
      - type: className
        regex: .*\\Infrastructure\\.*

ruleset:
  Application:
    - Domain

  Domain: ~

  Infrastructure:
    - Application
    - Domain

This gives me the following schema:

screen shot 2016-04-30 at 13 34 21

Now I would like to go a step further and specify more advanced rules.

For example, I can break down Application in two:

screen shot 2016-04-30 at 13 36 11

The global rules defined by the first graph are not changing, but inside Application, I'm would like to specify that no Handlers shouldn't depend on `Handlers:

screen shot 2016-04-30 at 13 41 17

But that doesn't affect the rules defined to the parent Application, hence the global view would be:

screen shot 2016-04-30 at 13 40 59

Another cases slightly more complex: I'm breaking down Infrastructure as following:

screen shot 2016-04-30 at 13 44 04

We hence have not 3 sublayers but 6:

  • Actions
  • Responders
  • no Actions & no Responders
  • no Actions = no Actions & no Responders U Responders
  • no Responders = no Actions & no Responders U Actions
  • Actions &Responders`

*: U is union

In Infrastructure, with those sublayers, I would like to define the following rules:

  • Actions can depend on no Actions
  • Responders can depend on no Actions & no Responders

Which gives the following graph:

screen shot 2016-04-30 at 13 58 04

As before, this shouldn't affect the rules defined on the parent layer Infrastructure.

While this is partly doable right now, there is a lot of cons:

  • Very error prone and repetitive: as you cannot defined a layer based on other layers, you wouldn't be able to define no Handlers or no Actions without being repetitive; repetition which may lead to: 1. an error in the regex, hence you get the layer wrongs, 2. missing a sublayer, hence you could think of having Application devided in Handlers and no Handlers but due to a little mistake you have Handlers U no HandlersApplication.
  • Inadequate view: as of now each layer is considered as separate, so instead of having something similar to:

screen shot 2016-04-30 at 13 40 59

You would actually get something like:

screen shot 2016-04-30 at 14 05 35

Collectors configuration

If I understand correctly from the code, Collectors don't have a configuration per se, but rather have access to all the arguments passed to the collector. As a result, they handle those values as they wish without any validation of any kind.

Example:

// src/Collector/ClassNameCollector.php

private function getRegexByConfiguration(array $configuration)
    {
        if (!isset($configuration['regex'])) {
            throw new \LogicException('ClassNameCollector needs the regex configuration.');
        }

        return $configuration['regex'];
    }

Wouldn't it be better to change that and have one configuration per collector? That way we could add a validation step when creating the collector configuration.

Download over HTTPS

Copy/paste the curl command from the doc doesn't work:

$ curl -LS https://get.sensiolabs.de/deptrac.phar -o deptrac.phar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

Cache parsing

I may be wrong when saying that, I didn't run any blackfire profile neither really dig in the code, but I see the Parsing File x each time I run the command, which I guess could be skipped somehow if there was any cache layer.

Add a MethodNameCollector

Deptrac needs a Collector, that watches method names.

Use case:
I don't want, that my WhatEverBundle uses the createQueryBuilder() Method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.