-
Notifications
You must be signed in to change notification settings - Fork 271
feat: adds 'ancestor' matcher #961
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
base: main
Are you sure you want to change the base?
Conversation
dd5fedb
to
43e5d79
Compare
43e5d79
to
819d9f6
Compare
819d9f6
to
9b9ea4d
Compare
95331ab
to
aae6edd
Compare
9b9ea4d
to
befba72
Compare
3499b9d
to
1d495cf
Compare
1d495cf
to
fcc020a
Compare
fcc020a
to
49910e8
Compare
49910e8
to
7c8c6a5
Compare
d83bb30
to
7c206b0
Compare
1cba0d6
to
4b75ec0
Compare
7c206b0
to
25b0d11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds a new "ancestor" matcher that allows users to flag dependencies where the target module is located in a folder above the source module. The changes include updates to type definitions and schemas, new matcher logic in the validation code, comprehensive tests, and corresponding documentation.
Reviewed Changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
types/restrictions.d.mts | Added the optional "ancestor" property to the to-restrictions. |
tools/schema/restrictions.mjs | Updated the restrictions schema with the "ancestor" property. |
test/validate/matchers.spec.mjs | Added tests for the ancestor matcher behavior. |
test/validate/index.ancestor.spec.mjs | Added integration tests for dependencies using the ancestor rule. |
src/validate/matchers.mjs | Implemented the new matchesAncestor() function and renamed helpers. |
src/validate/match-dependency-rule.mjs | Integrated matchesAncestor into the dependency rule matching. |
src/schema/cruise-result.schema.mjs | Updated output schema to incorporate the "ancestor" property. |
src/schema/configuration.schema.mjs | Updated configuration schema with the new ancestor restriction. |
doc/rules-reference.md | Documented the new ancestor rule. |
.dependency-cruiser.mjs | Added sample rules utilizing the ancestor matcher. |
Files not reviewed (3)
- .dependency-cruiser-known-violations.json: Language not supported
- src/schema/configuration.schema.json: Language not supported
- src/schema/cruise-result.schema.json: Language not supported
25b0d11
to
e86487f
Compare
e86487f
to
b23e08d
Compare
6c3d4b7
to
8c007a7
Compare
0882c28
to
290fe8c
Compare
290fe8c
to
e76e909
Compare
e76e909
to
5857d81
Compare
|
Description
ancestor
matcherMotivation 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?
Screenshots
You can now do things like this:
Which, when run as part of a validation, would yield errors on every dependency that goes folders up in stead of down:
Types of changes
Checklist
📖
⚖️