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

feat: adds 'ancestor' matcher #961

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

sverweij
Copy link
Owner

@sverweij sverweij commented Oct 27, 2024

Description

  • adds an ancestor matcher

Motivation and Context

It's probably possible to do this with regular expressions and group matching, but so far I haven't found a simple way to do that.

How Has This Been Tested?

  • green ci
  • additional automated integration tests
  • additional automated unit tests
  • self-run (added a no-ancestors rule to our own .dependency-cruiser.mjs)

Screenshots

You can now do things like this:

// in the `forbidden` section of a dependency-cruiser config:
{
  name: "no-ancestor",
  comment: "don't allow importing from folders above the current one",
  severity: "error",
  from: {},
  to: { "ancestor": true }
}

Which, when run as part of a validation, would yield errors on every dependency that goes folders up in stead of down:

sample-ancestor

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation only change
  • Refactor (non-breaking change which fixes an issue without changing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • 📖

    • My change doesn't require a documentation update, or ...
    • it does and I have updated it
  • ⚖️

    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

@sverweij sverweij force-pushed the feature/adds-ancestor-matcher branch from 9b9ea4d to befba72 Compare November 24, 2024 13:54
Copy link

codeclimate bot commented Nov 24, 2024

Code Climate has analyzed commit befba72 and detected 0 issues on this pull request.

View more on Code Climate.

Copy link

sonarcloud bot commented Nov 24, 2024

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