Skip to content

Add --exclude to mps-check-orphan-modules and mps-check-orphan-models - #10

Merged
sergej-koscejev merged 1 commit into
mainfrom
orphan-hooks-exclude
Oct 23, 2026
Merged

sergej-koscejev merged 1 commit into
mainfrom
orphan-hooks-exclude

Conversation

@sergej-koscejev

Copy link
Copy Markdown
Member

Closes #9.

mps-check-orphan-modules and mps-check-orphan-models scan the whole repository (pass_filenames: false), so prek's or pre-commit's exclude: has no effect on them. This adds a repeatable --exclude=GLOB option to both, the same as in mps-check-unbuilt-modules and mps-check-empty-model-roots.

  • The glob is .gitignore-style and is matched against the repository-relative path of the module descriptor (orphan-modules) or the model file (orphan-models). A trailing / excludes a subtree.
  • Both hooks now take arguments through main(argv) / parse_args, like the other hooks.
  • Tests for exact-path, subtree and non-matching excludes for each hook.
  • README sections, .pre-commit-hooks.yaml descriptions and CHANGELOG.md updated.

Example:

- id: mps-check-orphan-models
  args:
    - --exclude=code/extensions/celllayout/languages/de.itemis.mps.celllayout/generator/template/main@generator.mps
- id: mps-check-orphan-modules
  args:
    - --exclude=code/extensions/languages/de.itemis.model.merge.test/

Both hooks scan the whole repository, so prek's and pre-commit's exclude:
has no effect on them. A repeatable --exclude=GLOB option, matched against
the repository-relative path of the module descriptor or model file, lets
a project with existing orphans enable the hooks and still catch new ones.

Closes #9
@sergej-koscejev
sergej-koscejev merged commit 3963c27 into main Oct 23, 2026
1 check 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.

Add --exclude to mps-check-orphan-modules and mps-check-orphan-models

1 participant