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

fix(core): fix bug in dependency rules #123

Merged
merged 1 commit into from
Sep 2, 2024
Merged

Conversation

rainerhahnekamp
Copy link
Collaborator

@rainerhahnekamp rainerhahnekamp commented Aug 30, 2024

Each from tag must match one of the to tags of its dependency.
The old implementation forsaw that per to tag, at least one from
has to match.

That meant, that from tags could end up having no match at all.

Example:

Module customer-feature: ['domain:holidays', 'type:feature']
Module shared-ui: ['shared']

Dependency Rules:
{
'domain:*': sameTag,
'type:feature': ['shared']
}

Since shared-ui had only one tag and type:feature had clearance, the dependency worked.

Not it would fail because 'domain:holidays' would also have to have access 'shared'.

TODOs:

  • Ensure that all tests run and are updated
  • Update error messages from ESLint
  • Update CLI where necessary
  • Add detailed explanation in the docs about best practices for tagging
  • Release a 0.17 (bug fix could cause a lot of breaking changes)

Each from tag must match one of the to tags of its dependency.
The old implementation did it the opposite.

It iterated over all to tags and at least one from tag had to
match.

That meant, that from tags could end up having no match at all.

Example:

Module customer-feature: ['domain:holidays', 'type:feature']
Module shared-ui: ['shared']

Dependency Rules:
{
  'domain:*': sameTag,
  'type:feature': ['shared']
}

Since shared-ui had only one tag and type:feature had clearance, the dependency worked.

Not it would fail because 'domain:holidays' would also have to have access 'shared'.
@rainerhahnekamp rainerhahnekamp merged commit 2cf1563 into main Sep 2, 2024
2 checks passed
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.

Help Needed: sheriff.config Rules Not Enforcing as Expected
1 participant