Skip to content

Fix #1155: Refactor TaskExecutor to reduce complexity and improve maintainability#1238

Closed
trivikramkalagi91-commits wants to merge 4 commits into
utksh1:mainfrom
trivikramkalagi91-commits:fix/layout-overlap-906-refactor
Closed

Fix #1155: Refactor TaskExecutor to reduce complexity and improve maintainability#1238
trivikramkalagi91-commits wants to merge 4 commits into
utksh1:mainfrom
trivikramkalagi91-commits:fix/layout-overlap-906-refactor

Conversation

@trivikramkalagi91-commits

Copy link
Copy Markdown
Contributor

Description

This PR refactors the TaskExecutor component in backend/secuscan/executor.py to reduce complexity and improve maintainability.

Changes Made

  • Extracted guardrail validation logic into _enforce_guardrails()
  • Extracted Docker network setup logic into _ensure_docker_network()
  • Extracted modular scanner execution into _execute_modular_scanner()
  • Extracted standard scanner execution into _execute_standard_scanner()
  • Improved code readability through better separation of concerns
  • Added type hints and documentation for extracted helper methods
  • Added unit tests covering the new helper methods

This refactor preserves existing functionality while making the execution flow easier to understand, maintain, and test.


Related Issues

Fixes #1155


Type of Change

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

Note: This is primarily a code refactoring/maintenance improvement with no functional changes.


How Has This Been Tested?

Unit Tests

.\venv\Scripts\pytest testing/backend/unit/test_executor.py

Result:

27 passed

Integration Tests

.\venv\Scripts\pytest testing/backend/integration/test_docker_hardening.py

Result:

7 passed, 9 skipped

Manual Verification

  • Verified standard scanner execution flow remains unchanged.
  • Verified modular scanner execution works correctly.
  • Verified task status handling remains unchanged.
  • Verified findings and reports continue to be persisted correctly.
  • Verified no public APIs or database schemas were modified.

Checklist

  • My code follows the code style 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.

@trivikramkalagi91-commits trivikramkalagi91-commits changed the title Fix/layout overlap 906 refactor Fix #1155: Refactor TaskExecutor to reduce complexity and improve maintainability Jun 23, 2026
@trivikramkalagi91-commits trivikramkalagi91-commits force-pushed the fix/layout-overlap-906-refactor branch from cb586f6 to 989ac15 Compare June 23, 2026 10:24
@utksh1 utksh1 added gssoc:invalid Admin validation: invalid for GSSoC scoring level:advanced 55 pts difficulty label for advanced contributor PRs type:refactor Refactor work category bonus label area:backend Backend API, database, or service work and removed gssoc:invalid Admin validation: invalid for GSSoC scoring labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work gssoc:invalid Admin validation: invalid for GSSoC scoring level:advanced 55 pts difficulty label for advanced contributor PRs type:refactor Refactor work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor TaskExecutor in backend/secuscan/executor.py to Reduce Complexity and Improve Maintainability

2 participants