Skip to content

Commit d6efbc3

Browse files
committed
👷 change how we compute the migration progress
Issue: CLDSRV-860
1 parent 3bf3610 commit d6efbc3

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.github/scripts/count-async-functions.mjs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,21 @@ for (const sourceFile of project.getSourceFiles()) {
6767
}
6868
}
6969

70-
const migrationPercent = totalFunctions > 0
70+
const asyncFunctionPercent = totalFunctions > 0
7171
? ((asyncFunctions / totalFunctions) * 100).toFixed(1)
7272
: '0.0';
7373

74+
const migrationPercent = (asyncFunctions + callbackFunctions) > 0
75+
? ((asyncFunctions / (asyncFunctions + callbackFunctions)) * 100).toFixed(1)
76+
: '0.0';
77+
7478
console.log('=== Async/Await Migration Progress ===');
7579
console.log(`Total functions: ${totalFunctions}`);
76-
console.log(`Async functions: ${asyncFunctions} (${migrationPercent}%)`);
80+
console.log(`Async functions: ${asyncFunctions} (${asyncFunctionPercent}%)`);
7781
console.log(`Callback functions: ${callbackFunctions}`);
7882
console.log(`Remaining .then(): ${thenChains}`);
7983
console.log('');
80-
console.log(`Migration: ${asyncFunctions}/${totalFunctions} functions (${migrationPercent}%)`);
84+
console.log(`Migration (trend): ${asyncFunctions}/${asyncFunctions + callbackFunctions} (${migrationPercent}%)`);
8185

8286
if (process.env.GITHUB_STEP_SUMMARY) {
8387
const { appendFileSync } = await import('node:fs');
@@ -87,9 +91,10 @@ if (process.env.GITHUB_STEP_SUMMARY) {
8791
`| Metric | Count |`,
8892
`|--------|-------|`,
8993
`| Total functions | ${totalFunctions} |`,
90-
`| Async functions | ${asyncFunctions} (${migrationPercent}%) |`,
94+
`| Async functions | ${asyncFunctions} (${asyncFunctionPercent}%) |`,
9195
`| Callback-style functions | ${callbackFunctions} |`,
9296
`| Remaining \`.then()\` chains | ${thenChains} |`,
97+
`| Migration trend (async / (async + callback)) | ${asyncFunctions}/${asyncFunctions + callbackFunctions} (${migrationPercent}%) |`,
9398
'',
9499
].join('\n'));
95100
}

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
run: pip install flake8
100100
- name: Lint Javascript (strict, excluding async migration rules)
101101
run: |
102-
yarn run --silent lint --max-warnings 0 --rule "promise/prefer-await-to-then: off" --rule "n/callback-return: off"
102+
yarn run --silent lint -- --max-warnings 0 --rule "promise/prefer-await-to-then: off" --rule "n/callback-return: off"
103103
- name: Lint Markdown
104104
run: yarn run --silent lint_md
105105
- name: Lint python

0 commit comments

Comments
 (0)