jraska / jraska/modules-graph-assert

Regex validation error

Open
#325 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Kotlin
Stars
640
Forks
35
Avg merge
2d 21h
Merged PRs (30d)
1

Description

I have created example project where you can find not working regex as expected.

I would like to have modules that ends with "Ui" in their name. So there should be allowed to reference/depend from non UI modules to UI but UI module cannot depends another UI module.

For example modules:

  • composeApp
  • libUi
  • testUi
  • another

The composeApp could depends another and all Uis, but libUi can depends composeApp (logically do not need that) but could also depends another.
So i found restrictions that module that ends with Ui could refers just non-ending Ui modules and modules that not ends with Ui could reference all modules.

Non ending modules regex: ^(?!.*Ui$).*$
All modules regex: .*

Ending Ui regex: .*Ui$
Modules that NOT ends with Ui: ^(?!.*Ui$).*$

Regex could be checked https://regex101.com/

There is configuration

moduleGraphAssert {
    configurations += setOf("commonMainImplementation", "commonMainApi")
    maxHeight = 3
    allowed = arrayOf(
        ".*Ui$ -> ^(?!.*Ui$).*$",
        "^(?!.*Ui$).*$  -> .*",
    )
    restricted = arrayOf(
    )
    assertOnAnyBuild = true
}

Build build ends with error:
Failed to notify build listener.

[':composeApp' -> ':shared'] not allowed by any of ['.Ui$ -> ^(?!.Ui$).$', '^(?!.Ui$).$ -> .']
[':shared:libUi' -> ':shared:testUi'] not allowed by any of [':.Ui$ -> ^(?!.Ui$).$', '^(?!.Ui$).$ -> .']

The sample project:
MyApplication.zip

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the attached MyApplication.zip and the shown moduleGraphAssert configuration. Compare the reported composeApp-to-shared and libUi-to-testUi edges with the allowed regex patterns and inspect the plugin entry point that evaluates those rules. Done means the intended non-UI and UI dependency relationships are accepted or rejected correctly without the build-listener error.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.