1.5 KiB
1.5 KiB
Rule: Class File Name Must Match Class Label/Name
🚨 Critical
When a class label/name is changed, the class file name must be renamed to match.
This keeps class modules discoverable, prevents stale imports, and avoids long-term naming drift.
The Rule
-
If the primary class identifier changes, rename the file in the same edit set.
- Change triggers include updates to:
- top-level
name: - class key under
classes: - canonical class label used for module naming
- top-level
- Change triggers include updates to:
-
File naming must reflect the canonical class name.
- ✅
DigitalPlatformProfile.yamlfor classDigitalPlatformProfile - ❌
DigitalPlatformV2.yamlfor classDigitalPlatformProfile
- ✅
-
After renaming a file, update all references.
imports:in other class/slot/type files- manifests/indexes/build inputs
- any generated or curated mapping lists that include file paths
-
Keep semantic names versionless.
- Do not preserve old versioned file names when class names are de-versioned.
- Coordinate with
no-version-indicators-in-names-rule.md.
Required Checklist
- File name matches canonical class name
id:andname:are internally consistent- All import paths updated
- Search confirms no stale old file-name references remain
- YAML parses after rename
Example
Before:
# file: DigitalPlatformV2.yaml
name: DigitalPlatformProfile
classes:
DigitalPlatformProfile:
After:
# file: DigitalPlatformProfile.yaml
name: DigitalPlatformProfile
classes:
DigitalPlatformProfile: