Skip to content

Use placeholder for missing Rule ID in YAML export file names - #301

Open
hachi-008 wants to merge 2 commits into
cdisc-org:mainfrom
hachi-008:fix/yaml-export-missing-rule-id
Open

hachi-008 wants to merge 2 commits into
cdisc-org:mainfrom
hachi-008:fix/yaml-export-missing-rule-id

Conversation

@hachi-008

Copy link
Copy Markdown

Fixes #216

Export rules YAML names each file <Rule ID>.<id>.yml. When a rule has no Rule ID, the prefix is empty ([].join(",") === ""), so the file name starts with a dot and macOS hides the file.

Changes

  • Move the file name logic into src/utils/ruleFileName.ts.
  • When the Rule ID is empty or missing, use NO_RULE_ID as the prefix, so the file becomes NO_RULE_ID.<id>.yml.
  • Rules that have a Rule ID keep their current file names.

Testing

  • Added src/utils/ruleFileName.test.ts with 5 tests. If the placeholder is removed, the 3 tests for a missing Rule ID fail with .3f2a9c1e-7b4d-4c1a-9e2f-0a1b2c3d4e5f.yml.
  • tsc --noEmit passes, and ESLint passes for the changed files.
  • src/App.test.tsx already fails on main because Jest does not transform the ESM build of react-monaco-editor. This PR does not change that.

NO_RULE_ID is a suggestion, and I'm happy to change it to a name you prefer.

The "Build and Deploy Preview" check uses repository secrets, so it is expected to fail for a pull request from a fork.

Exported rules are named `<RuleID>.<id>.yml`. The Rule ID field is
always an array, so a rule without one produced `[].join(",") === ""`
and a file name starting with ".", which macOS hides.

`ruleFileName` falls back to `NO_RULE_ID` when the identifier is
empty. Includes unit tests.
Use `ruleFileName` when adding rules to the zip, so a rule without a
Rule ID is saved as `NO_RULE_ID.<id>.yml` instead of a hidden file.

Fixes cdisc-org#216

This branch has not been deployed

No deployments
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.

Export Rules as YAML MacOS filename issue

1 participant