Skip to content

feat: provide catch-all function to process dep rule#246

Open
sdurnov wants to merge 2 commits intosoftarc-consulting:mainfrom
sdurnov:main
Open

feat: provide catch-all function to process dep rule#246
sdurnov wants to merge 2 commits intosoftarc-consulting:mainfrom
sdurnov:main

Conversation

@sdurnov
Copy link
Copy Markdown

@sdurnov sdurnov commented Mar 5, 2026

Here's a very drafty draft, mostly vibe coded.

rn I'm writing sheriff config for my project, and checking if it even works (seems to be working).

After I make sure, I can add few tests if necessary and fix any issues

#245

@sonarqubecloud
Copy link
Copy Markdown

@sdurnov sdurnov marked this pull request as ready for review March 27, 2026 15:39
@sdurnov
Copy link
Copy Markdown
Author

sdurnov commented Mar 27, 2026

fixed stupid AI stuff and added some tests

@rainerhahnekamp rainerhahnekamp self-requested a review March 27, 2026 15:42
@rainerhahnekamp
Copy link
Copy Markdown
Collaborator

@sdurnov thanks. Plan to review it this week.

@sdurnov
Copy link
Copy Markdown
Author

sdurnov commented Apr 7, 2026

@sdurnov thanks. Plan to review it this week.

Hi there, any quick thoughts on this maybe?

Copy link
Copy Markdown
Collaborator

@rainerhahnekamp rainerhahnekamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, just a few minor comments where I think an AI should be able to handle them properly 👍

{
"name": "@softarc/sheriff-core",
"version": "0.19.6",
"version": "0.19.7",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are going to create a separate commit for the minor release. so please revert the package.json (x2) changes.

toTags: string[];
}

// Backward compatible: supports both old signature (from, to as strings)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments are not needed

from: string;
to: string;
} & DependencyCheckContext,
context: { from: string; to: string } & Required<DependencyCheckContext>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to put from and to also in the DependencyCheckContext? I also believe we can do this without Required.

const createMockDependencyCheckContext = (
overrides?: Partial<DependencyCheckContext>,
): DependencyCheckContext => ({
fromModulePath: '' as FsPath,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe without as FsPath in each line but just one big as DependencyCheckContext at the end?

);

describe('fromTags and toTags', () => {
it('should provide fromTags in the context object', () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we need that one.

);
});

it('should provide toTags in the context object', () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we need that one either.

);
});

it('should allow complex cross-domain rules using fromTags and toTags', () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we maybe put this into a describe with the construction of config as a setup function? Each assertion could then be its own test.

I also think that this test should be enough. It is a not complicated feature with different branches which would justify that additional amount of tests.

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.

2 participants