Skip to content

[jsweep] Clean check_stop_time.cjs#12764

Closed
github-actions[bot] wants to merge 1 commit intomainfrom
jsweep-check-stop-time-clean-38471289f97b0bf5
Closed

[jsweep] Clean check_stop_time.cjs#12764
github-actions[bot] wants to merge 1 commit intomainfrom
jsweep-check-stop-time-clean-38471289f97b0bf5

Conversation

@github-actions
Copy link
Contributor

Summary

Cleaned and improved check_stop_time.cjs by adding comprehensive JSDoc type annotations, extracting validation logic, and modernizing the code with ES6+ features. Also significantly improved the test file readability by removing comma operator abuse.

Changes

Main File (check_stop_time.cjs)

  • Added JSDoc type annotations for all functions (isValidDate, main)
  • Extracted validation logic to isValidDate helper function for better code organization
  • Used destructuring for environment variables (GH_AW_STOP_TIME, GH_AW_WORKFLOW_NAME)
  • Improved clarity by replacing !isNaN(stopTimeDate.getTime()) with semantic isValidDate(stopTimeDate) call
  • Type-safe - File already had @ts-check enabled, now with comprehensive JSDoc annotations

Test File (check_stop_time.test.cjs)

  • Removed comma operator abuse - Improved from 101 lines to 153 lines for better readability
  • Proper statement separation - Each statement on its own line
  • Clearer mock values - Replaced !1 with false for better clarity
  • Maintained all 5 test cases - No change in test coverage

Context

  • Execution context: github-script (uses core, github, context globals)
  • Lines: 42 → 50 (8 lines added due to helper function extraction and JSDoc comments)
  • Test coverage: 5 test cases (unchanged)

Validation Results

All validation checks passed before creating this PR:

Formatting: npm run format:cjs
Linting: npm run lint:cjs
Type checking: npm run typecheck
Tests: npm run test:js -- check_stop_time

Test Files  1 passed (1)
     Tests  5 passed (5)
  Duration  165ms

Labels

  • unbloat - Code cleanup and modernization
  • automation - Automated workflow improvement

AI generated by jsweep - JavaScript Unbloater

- Added JSDoc type annotations for all functions (isValidDate, main)
- Extracted date validation logic to isValidDate helper function
- Used destructuring for environment variables (GH_AW_STOP_TIME, GH_AW_WORKFLOW_NAME)
- Removed comma operator abuse from test file
- Improved test file readability with proper statement separation

All validation checks passed:
- Formatting: npm run format:cjs ✓
- Linting: npm run lint:cjs ✓
- Type checking: npm run typecheck ✓
- Tests: npm run test:js ✓

Test coverage: All existing 5 test cases passing
Context: github-script
Lines: 42 → 50 (helper function extraction improves maintainability)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant