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

Named rules in sub-scoped peru files cause "Invalid name" errors at sync #242

Open
KevinVdKAverna opened this issue Jul 28, 2023 · 0 comments · May be fixed by #243
Open

Named rules in sub-scoped peru files cause "Invalid name" errors at sync #242

KevinVdKAverna opened this issue Jul 28, 2023 · 0 comments · May be fixed by #243

Comments

@KevinVdKAverna
Copy link

The top-level peru.yaml file contains a module that possesses its own peru file. The peru file of the referenced module contains one or more named rules. These named rules generate "Invalid name" errors when running "peru sync" on the top-level file.

A likely reason for this error is that the name of modules and rules is validated prior to creating the Module and Rule objects. The name of a rule in the sub-level peru file receives a prefix from the parser to indicate its sub-level scope. The dot "." separator in the added prefix causes the validation to fail since rule and module names should not contain dots. For modules this works correctly since the validation of the name is performed prior to adding the prefix, but for named rules this is not the case.

Example:

This example would generate the error: "Invalid name: sub-level.builds".

# Top-level peru file
imports:
  sub-level: import_folder

git module sub-level:
  url: ...
# Sub-level peru file
imports:
  sub-level2|builds: import_folder2

git module sub-level2:
  url: ...

rule builds:
  export: builds
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 a pull request may close this issue.

1 participant