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

Feature request: graph showing only the dependent modules #632

Closed
El-Chiang opened this issue Jul 7, 2022 · 5 comments · Fixed by #635
Closed

Feature request: graph showing only the dependent modules #632

El-Chiang opened this issue Jul 7, 2022 · 5 comments · Fixed by #635
Labels
enhancement this will make dependency-cruiser sweeter

Comments

@El-Chiang
Copy link

This tool is a great idea! Inspired by it, I added a job to the ci pipeline to analyze the impact (dependants) of each PR. However, our team works on a giant web application, if I show all the dependencies, this graph will be very large and not conducive to checking. So, is there a way only to show the dependants?

Context

Let me give you an example to describe the problem I am facing:

  • There is an A->B->E and C->D->E dependency
  • In this PR, I have modified the E
  • Now, I want to find all the modules that depend on D, i.e. A ~ D.

Currently, I configure reachable rule and output to err-report to solve my need, but I also want to show their dpendency path through the graph, not only html report.

Possible Solution

Is it possible to provide a reaches CLI option to filter out all dependants (like reachable rule)

@sverweij sverweij added the enhancement this will make dependency-cruiser sweeter label Jul 7, 2022
@sverweij
Copy link
Owner

sverweij commented Jul 7, 2022

Hi @El-Chiang there's currently no reaches or reachable filter option in the CLI or the API. Besides being a good idea for pull request context I think it'll fulfil a more general need as well - in #469 there was a request for something similar.

What CI do you use?

related work

For PR's I currently use the --focus option to highlight changed files and all modules they depend on and that depend on them.

@El-Chiang
Copy link
Author

El-Chiang commented Jul 8, 2022

In the CI, it gets all the diff files at every PR and executes the depcruise command to analyze all the modules that depend on these diff files, and finally generates a report.

I thought about using the --focus option before, but in my case, I actually only focus on all the modules that depend on them. And if I have multiple files that need to be focused on, I have to execute this command in a loop.

@sverweij
Copy link
Owner

Hi @El-Chiang - I've made a stab at a --reaches filter (works both in the depcruise and depcruise-fmt command line and in the API) - see the linked PR above.

The beta [email protected] on npm (just published) contains this feature. The feature will probably land in the next regular release (expected this Monday).

In any case I'm curious whether it helps in your use-case. If you have any feedback it'll be very welcome!

@sverweij
Copy link
Owner

@El-Chiang FYI - the regular release ([email protected]) with the reaches filter has just landed on npm. As said earlier: feedback is very welcome.

@El-Chiang
Copy link
Author

Thanks @sverweij! This works great for me 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement this will make dependency-cruiser sweeter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants