Skip to content

refactor: drop redundant guards and unused imports flagged by codeql - #1206

Merged
jamcalli merged 2 commits into
developfrom
chore/codeql-redundant-code
Jun 4, 2026
Merged

refactor: drop redundant guards and unused imports flagged by codeql#1206
jamcalli merged 2 commits into
developfrom
chore/codeql-redundant-code

Conversation

@jamcalli

@jamcalli jamcalli commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Description

Related Issues

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement
  • Code refactoring
  • Documentation update
  • Dependency update

Testing Performed

Screenshots

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • My changes work with existing functionality

Summary by CodeRabbit

  • Refactor

    • Improved internal data handling and conditional logic for more consistent behavior.
  • Tests

    • Added mock handlers for external APIs to improve test reliability.
  • Chores

    • Increased test hook timeout to reduce CI flakiness.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: d6d1b56b-059b-4e81-ac55-d5d3c37f6f37

📥 Commits

Reviewing files that changed from the base of the PR and between bd35760 and 1c99c62.

📒 Files selected for processing (2)
  • test/mocks/external-api-handlers.ts
  • vitest.config.ts

Walkthrough

Simplifies several conditional checks in database, Sonarr, and content lookup code, adds two GitHub MSW handlers for tests, and increases Vitest hookTimeout from 10s to 30s.

Changes

Code and test infra updates

Layer / File(s) Summary
Database config JSON serialization
src/services/database/methods/config.ts
JSON column handling in updateConfig now serializes non-null values via JSON.stringify and writes null unchanged.
Sonarr override selections
src/services/sonarr.service.ts
addToSonarr now selects monitorStrategy and seriesType using truthiness-based ternaries for override parameters instead of explicit non-null checks.
Content lookup guard
src/types/content-lookup.types.ts
extractYear uses a shorter early-return guard (!response / non-object) instead of an explicit response === null check.
GitHub MSW handlers for tests
test/mocks/external-api-handlers.ts
Adds GET /repos/:owner/:repo/releases/latest and POST https://api.github.com/markdown MSW handlers and registers them in externalApiHandlers.
Vitest hook timeout increase
vitest.config.ts
Increases test.hookTimeout from 10000 to 30000 and adds a comment about CI beforeAll build slowness.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'refactor: drop redundant guards and unused imports flagged by codeql' accurately describes the main changes across the codebase—simplifying conditionals, removing redundant null checks, and addressing CodeQL findings.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/codeql-redundant-code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jamcalli
jamcalli merged commit 4cb2dcb into develop Jun 4, 2026
10 checks passed
@jamcalli
jamcalli deleted the chore/codeql-redundant-code branch June 4, 2026 21:20
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.

1 participant