Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d7c5e9f
merge main
SFJohnson24 Jun 10, 2026
fcf7fe8
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jun 15, 2026
ecc45ab
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jun 15, 2026
e963a40
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jun 15, 2026
7d9c521
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jun 19, 2026
b38668f
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jun 29, 2026
bfbb777
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 1, 2026
b5695eb
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 2, 2026
ce51a06
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 7, 2026
8369da5
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 7, 2026
007e0bd
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 10, 2026
7a673a0
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 13, 2026
0774220
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 14, 2026
63e2585
fixes
SFJohnson24 Jul 15, 2026
0979ea7
fixes through 833
SFJohnson24 Jul 15, 2026
545d073
832
SFJohnson24 Jul 15, 2026
c43ec3a
sort yaml
SFJohnson24 Jul 15, 2026
a8961cb
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 16, 2026
68f5d19
merge main
SFJohnson24 Jul 16, 2026
019a0c1
sort rules
SFJohnson24 Jul 16, 2026
332a2e7
prettier format
SFJohnson24 Jul 17, 2026
d8b68e0
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 17, 2026
59aa178
Merge branch 'main' into fixes
SFJohnson24 Jul 17, 2026
557dbb3
workflow reworks
SFJohnson24 Jul 20, 2026
7724824
rules sort then format
SFJohnson24 Jul 20, 2026
b73b0d5
permissions and logs
SFJohnson24 Jul 20, 2026
d64080d
update sort yaml
SFJohnson24 Jul 20, 2026
4956634
sort rework
SFJohnson24 Jul 20, 2026
e9f918c
new sort
SFJohnson24 Jul 20, 2026
1859384
chore: normalize line endings to LF
SFJohnson24 Jul 20, 2026
d70d063
formatting
SFJohnson24 Jul 20, 2026
653173b
data, schema, sorting
SFJohnson24 Jul 24, 2026
5a6942c
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 27, 2026
b304bde
Merge branch 'main' of https://github.com/cdisc-org/cdisc-open-rules
SFJohnson24 Jul 28, 2026
fb1450d
Merge branch 'main' into fixes
SFJohnson24 Jul 28, 2026
fc919f2
current progress
SFJohnson24 Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Explicitly force LF for files
*.csv text eol=lf

# Force LF line endings for text files, regardless of local core.autocrlf
* text=auto eol=lf

*.yml text eol=lf
*.yaml text eol=lf
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1-rule-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ body:
attributes:
label: Test Data
description: "If reporting a bug, attach your test data files here (CSV, Excel, etc.). You can drag and drop multiple files directly into this field."
placeholder: Drag and drop files here, or describe the test data inline.
placeholder: Drag and drop files here, or describe the test data inline.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
blank_issues_enabled: false
blank_issues_enabled: false
35 changes: 35 additions & 0 deletions .github/workflows/auto-format-yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto-format Rule YAML
on:
workflow_dispatch: {}
jobs:
format-yaml:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install ruamel.yaml

- name: Sort rule.yml files
run: python scripts/sort_yaml.py

- uses: actions/setup-node@v4
- name: Run Prettier to format rule.yml files
run: |
npm i prettier
npx prettier "Published/**/rule.yml" "Unpublished/**/rule.yml" --write

- name: Commit and push formatting fixes
run: |
git config user.name github-actions
git config user.email github-actions@cdisc.org
git add Published Unpublished
git diff-index --quiet HEAD || git commit -m "chore: sort and format rule.yml files"
git push
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ jobs:
- name: Push
if: steps.newdirs.outputs.HAS_NEW_DIRS == 'true'
run: |
git push
git push
2 changes: 1 addition & 1 deletion .github/workflows/submodule_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
body: |
Automated update of the `engine` submodule to the latest commit on `cdisc-rules-engine/main`.
branch: auto/update-engine-submodule
base: main
base: main
4 changes: 2 additions & 2 deletions .github/workflows/validate-rule-contributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Validate Rule Contributions
on:
pull_request:
paths:
- 'Unpublished/**'
- "Unpublished/**"
types: [opened, synchronize, reopened]
workflow_dispatch: {}

Expand All @@ -27,7 +27,7 @@ jobs:
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: "3.12"

- name: Install engine dependencies
run: |
Expand Down
129 changes: 104 additions & 25 deletions .github/workflows/validate-yaml-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,27 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install ruamel.yaml

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Prettier
run: npm install -g prettier

- name: Detect changed rule.yml files
id: changed-files
run: |
Expand All @@ -39,47 +49,116 @@ jobs:
echo "has_files=true" >> $GITHUB_OUTPUT
echo "$FILES" > /tmp/changed_rule_files.txt
fi
- name: Check YAML sorting and formatting
id: format-check

- name: Check YAML sorting
id: sort-check
if: steps.changed-files.outputs.has_files == 'true'
run: |
FILES=$(cat /tmp/changed_rule_files.txt | tr '\n' ' ')
python scripts/sort_yaml.py --check $FILES
mapfile -t FILES < /tmp/changed_rule_files.txt
python scripts/sort_yaml.py --check "${FILES[@]}" 2> /tmp/sort_stderr.txt
continue-on-error: true
- name: Post format check result to PR

- name: Check Prettier formatting
id: prettier-check
if: steps.changed-files.outputs.has_files == 'true'
run: |
: > /tmp/prettier_unformatted.txt
while read -r f; do
[ -z "$f" ] && continue
if ! prettier --check "$f" > /dev/null 2>&1; then
echo " $f" >> /tmp/prettier_unformatted.txt
fi
done < /tmp/changed_rule_files.txt
if [ -s /tmp/prettier_unformatted.txt ]; then
echo "passed=false" >> $GITHUB_OUTPUT
else
echo "passed=true" >> $GITHUB_OUTPUT
fi

- name: Post result to PR
if: always() && github.event_name == 'pull_request' && steps.changed-files.outputs.has_files == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const outcome = '${{ steps.format-check.outcome }}';
const fs = require('fs');

function truncatedList(path, maxChars = 3000) {
let raw = '';
try { raw = fs.readFileSync(path, 'utf8'); } catch (e) { return ''; }
const lines = raw.split('\n').filter(l => l.trim().length > 0);
let out = [];
let total = 0;
for (const line of lines) {
if (total + line.length > maxChars) {
out.push(`...and ${lines.length - out.length} more`);
break;
}
out.push(line);
total += line.length + 1;
}
return out.join('\n');
}

const sortOk = '${{ steps.sort-check.outcome }}' === 'success';
const prettierOk = '${{ steps.prettier-check.outputs.passed }}' === 'true';
const marker = '<!-- yaml-format-check -->';
let body = marker + '\n';
if (outcome === 'success') {

if (sortOk && prettierOk) {
body += '## \u2705 YAML Format Check Passed\n\nAll changed `rule.yml` files are correctly sorted and formatted.';
} else {
body += '## \u274c YAML Format Check Failed\n\n';
body += 'One or more `rule.yml` files are not correctly sorted/formatted alphabetically by key.\n\n';
body += 'Run the following command locally to fix them:\n\n```bash\npython scripts/sort_yaml.py\n```\n\nThen commit and push.';
if (!sortOk) {
const sortList = truncatedList('/tmp/sort_stderr.txt');
body += '**Sorting issue** — one or more `rule.yml` files are not sorted alphabetically by key.\n\n';
body += 'Run the following command locally to fix them:\n\n```bash\npython scripts/sort_yaml.py\n```\n\n';
if (sortList) body += '<details><summary>Details</summary>\n\n```\n' + sortList + '\n```\n</details>\n\n';
}
if (!prettierOk) {
const prettierList = truncatedList('/tmp/prettier_unformatted.txt');
body += '**Formatting issue** — the following files are not formatted with Prettier:\n\n';
body += '```\n' + prettierList + '\n```\n\n';
body += 'Install the [Prettier VS Code extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and enable "Format On Save", then re-save these files and push.\n\n';
body += 'Alternatively, trigger the **Auto-format Rule YAML** workflow to fix them automatically.';
}
}
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: existing.id, body,
});
} else {
await github.rest.issues.createComment({

if (body.length > 60000) {
body = body.slice(0, 60000) + '\n\n...(comment truncated — see workflow run logs for full details)';
}

core.info(`Comment body length: ${body.length}`);
core.info(`Issue number: ${context.issue.number}`);

try {
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: context.issue.number, body,
issue_number: context.issue.number,
});
core.info(`Found ${comments.length} existing comments on this PR.`);
const existing = comments.find(c => c.user.type === 'Bot' && c.body.includes(marker));
if (existing) {
core.info(`Updating existing comment id ${existing.id}`);
const res = await github.rest.issues.updateComment({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: existing.id, body,
});
core.info(`Updated comment: ${res.data.html_url}`);
} else {
core.info('No existing marker comment found — creating a new one.');
const res = await github.rest.issues.createComment({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: context.issue.number, body,
});
core.info(`Created comment: ${res.data.html_url}`);
}
} catch (err) {
core.setFailed(`Failed to post PR comment: ${err.message}`);
}
- name: Fail if format check failed
if: steps.format-check.outcome == 'failure'

- name: Fail if any check failed
if: steps.sort-check.outcome == 'failure' || steps.prettier-check.outputs.passed == 'false'
run: |
echo "YAML format check failed. Run 'python scripts/sort_yaml.py' to fix."
echo "YAML sort and/or Prettier format check failed. See PR comment for details."
exit 1
10 changes: 5 additions & 5 deletions .github/workflows/validate-yaml-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Validate YAML against Schema
on:
pull_request:
paths:
- 'Published/**/rule.yml'
- 'Unpublished/**/rule.yml'
- "Published/**/rule.yml"
- "Unpublished/**/rule.yml"
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
Expand All @@ -14,7 +14,7 @@ on:
(e.g. "Published/CORE-000001/rule.yml"). Leave blank to validate
all changed rule files detected from the last commit.
required: false
default: ''
default: ""

# Only one run per PR branch at a time; cancel superseded runs.
concurrency:
Expand All @@ -32,7 +32,7 @@ jobs:
env:
# draft/2020-12 schema — switch to rule-merged if you need $defs inlined
SCHEMA_URL: >-
https://raw.githubusercontent.com/cdisc-org/cdisc-rules-engine/refs/heads/main/resources/schema/rule-merged/CORE-base.json
https://raw.githubusercontent.com/cdisc-org/cdisc-rules-engine/refs/heads/main/resources/schema/rule-merged/CORE-base.json

steps:
# -----------------------------------------------------------------------
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
python-version: "3.12"

# -----------------------------------------------------------------------
# 3. Install validation dependencies
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ repos:
- repo: local
hooks:
- id: sort-yaml-rules
name: Sort and format rule YAML files
name: Sort rule YAML files
language: python
entry: python scripts/sort_yaml.py --check
entry: python scripts/sort_yaml.py --no-format
types: [yaml]
files: ".*/rule\\.yml$"
additional_dependencies: [ruamel.yaml]
Expand Down
16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"endOfLine": "lf",
"overrides": [
{
"files": ["*.yml", "*.yaml"],
"options": {
"printWidth": 100,
"tabWidth": 2
}
}
]
}
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"recommendations": [
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"GrapeCity.gc-excelviewer",
"mechatroner.rainbow-csv",
"emeraldwalk.runonsave"
]
}
}
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extensions.autoUpdate": true,
"yaml.schemas": {
"https://raw.githubusercontent.com/cdisc-org/cdisc-rules-engine/refs/heads/main/resources/schema/rule-merged/CORE-base.json": "rule.yml"
},
Expand All @@ -10,5 +11,10 @@
"cmd": "${workspaceFolder}/venv/bin/python ${workspaceFolder}/scripts/sort_yaml.py ${file}"
}
]
}
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"yaml.format.enable": false
}
Loading
Loading