Skip to content

[jsweep] Clean handle_noop_message.cjs#15649

Merged
pelikhan merged 1 commit intomainfrom
jsweep/clean-handle-noop-message-c1f7a44027e8165f
Feb 14, 2026
Merged

[jsweep] Clean handle_noop_message.cjs#15649
pelikhan merged 1 commit intomainfrom
jsweep/clean-handle-noop-message-c1f7a44027e8165f

Conversation

@github-actions
Copy link
Contributor

Summary

Cleaned up handle_noop_message.cjs to use modern JavaScript patterns and remove unnecessary error handling.

Changes Made

Removed Unnecessary Try/Catch Block

  • Before: Lines 57-74 had a try/catch block that just re-threw errors without any control flow logic
  • After: Removed the try/catch wrapper - errors bubble up naturally
  • Why: The catch block only logged the error and re-threw it, adding no value

Modern JavaScript Patterns

  1. Destructuring API responses: const { data } = await github.rest.search.issuesAndPullRequests(...) instead of const searchResult = ... then accessing searchResult.data
  2. Parameter destructuring in filter: filter(({ type }) => type !== "noop") instead of filter(item => item.type !== "noop")
  3. Consistent destructuring: Applied to both search and create operations for consistency

Testing

All tests pass successfully:

✓ handle_noop_message.test.cjs (12 tests) 71ms

Validation Checks Passed

All required validation checks completed successfully:

  • Formatting: npm run format:cjs - All files formatted correctly
  • Linting: npm run lint:cjs - All matched files use Prettier code style
  • Type Checking: npm run typecheck - No type errors
  • Tests: npm run test:js -- handle_noop_message - All 12 tests passed

Code Context

  • Execution context: github-script (actions/github-script)
  • File size: 175 lines (reduced from 180 lines)
  • Test coverage: 12 test cases covering all functionality

Impact

  • No logic changes - all functionality preserved
  • Cleaner, more maintainable code
  • Better alignment with modern JavaScript best practices
  • Reduced file size by 5 lines

AI generated by jsweep - JavaScript Unbloater

  • expires on Feb 16, 2026, 7:30 AM UTC

- Remove unnecessary try/catch that just re-throws errors
- Use destructuring for API responses (data)
- Modernize filter with parameter destructuring ({ type })
- Improve code clarity while maintaining all functionality
@pelikhan pelikhan marked this pull request as ready for review February 14, 2026 07:33
Copilot AI review requested due to automatic review settings February 14, 2026 07:33
@pelikhan
Copy link
Contributor

@copilot format, lint

Copy link
Contributor

Copilot AI commented Feb 14, 2026

@pelikhan I've opened a new pull request, #15650, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors actions/setup/js/handle_noop_message.cjs (a github-script helper) to simplify REST API call handling and adopt more modern JavaScript patterns while keeping behavior the same for no-op run reporting.

Changes:

  • Use response destructuring for GitHub REST API calls (search + create issue).
  • Remove a redundant try/catch around issue creation that only logged and re-threw.
  • Minor modern JS cleanup (parameter destructuring in a filter predicate).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 4c08d6d into main Feb 14, 2026
6 checks passed
@pelikhan pelikhan deleted the jsweep/clean-handle-noop-message-c1f7a44027e8165f branch February 14, 2026 13:27
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.

2 participants

Comments