Nesting Configuration Rules in Pattern Patrol
Pattern Patrol allows nested configuration rules, meaning directoriesRule
and fileRule
can be recursively applied within their own structure. This provides flexibility to enforce rules at different levels of your project.
How Nesting Works
The directoriesRule
and fileRule
can be nested inside another directoriesRule
. This allows for fine-grained control over different sections of the codebase.
✅ Example Use Cases:
- Applying different directory structures within different modules.
- Enforcing file naming conventions only for specific subdirectories.
- Defining different validation rules for different parts of the project.
Example: Nested Configuration for a Modular Project
{
"directoriesRule": {
"pattern": "MODULAR",
"basePackage": "com.myapp",
"directoriesRule": {
"pattern": "LAYERED",
"fileRule": {
"naming": "ENDS_WITH",
"namingArg": "Service"
}
}
}
}