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

Add 'do not follow' option #18

Merged
merged 9 commits into from
Oct 31, 2017
Merged

Conversation

sverweij
Copy link
Owner

@sverweij sverweij commented Oct 28, 2017

Description

Adds a --do-not-follow option. It's like the --exclude option, but instead of excluding the module and all its dependencies, it includes the module - and still leaves out all its dependencies.

Motivation and Context

without --exclude or --do-not-follow 😐

This scans everything under node_modules. Interesting, but not for the current project and a waste of cpu cycles for most purposes. It potentially flags relations from within node_modules to lodash as well (although in theory that could be prevented by tightening the rule a bit as well):
00everything

--exclude node_modules 👎

This does not scan node_modules, but it now does not see the relation to lodash anymore ...
01exclude_node_modules

--do-not-follow node_modules 👍 😄

Do-not-follow combines the best of both worlds. Note that modules dependency-cruiser does not follow any further get a 'folder' shape, so it's clear there might be more information behind it.
02do-not-follow_node_modules

It also helps with making visualisations more compact.

You can use any regular expression to specify you want to show up, but not cruised any further. E.g. the complete dependency tree for dependency cruiser's api (src/main/index.js) looks like this:
04depcruise-everything

... but if you're interested in something more high level, just tell dependency-cruiser so:
05depcruise-abbreviated
(the command for this: depcruise --do-not-follow "report/|validate/|transpile/" -x "node_modules|^[a-z]+$" -T dot src/main/index.js)

How Has This Been Tested?

🔍 Unit tests.

Types of changes

  • 🐣 New feature (non-breaking change which adds functionality)
  • 
    

Checklist:

  • The code I add will be subject to The MIT license, and I'm OK with that.
  • The code I've added is my own original work.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- processes the --do-not-follow (-X) option:
  - if it is specified each dependency matching the passed regex
    is cruised but not followed any further.
  - needed some tweaks in the dot template from e6bf88b
  - updates internal dependencies
  - updates expectancies of existing unit tests to match with the the
    new output attribute
  - adds unit tests to prove the additions work
so it also works on case sensitive file systems
and actually renames the file to something completely different and lowercase only. We're not here to test case sensitivities of various file systems
@sverweij sverweij changed the title Feature/add do not follow option WIP: Feature/add do not follow option Oct 28, 2017
@sverweij sverweij changed the title WIP: Feature/add do not follow option WIP: add do not follow option Oct 30, 2017
@sverweij sverweij changed the title WIP: add do not follow option Add 'do not follow' option Oct 31, 2017
@sverweij sverweij merged commit daf57bc into develop Oct 31, 2017
@sverweij sverweij deleted the feature/add-do-not-follow-option branch October 31, 2017 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant