Skip to content

Conversation

@fernandosantos-br
Copy link
Collaborator

@fernandosantos-br fernandosantos-br commented Jul 11, 2025

CodeQL instalation improvement, calculate optimal workers number and output project name

Copilot AI review requested due to automatic review settings July 11, 2025 16:24

This comment was marked as outdated.

This comment was marked as outdated.

Copy link

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 adds a new SystemResourceManager to detect available memory and calculate an adaptive worker count for CodeQL analysis, integrates manual and adaptive worker settings into the use case and CLI, and updates tests to cover the new behaviors.

  • Introduce SystemResourceManager to measure system memory and compute optimal worker count.
  • Wire adaptive/manual max_workers into CodeQLAnalysisUseCase and expose via CLI.
  • Update and simplify tests for system resource management and monorepo filtering.

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_system_resource_manager.py New tests for memory detection and worker calculation
tests/test_codeql_analysis.py Refactored CodeQL installation mocking, simplified monorepo filter test
src/codeql_wrapper/infrastructure/system_resource_manager.py New class for memory and worker calculation
src/codeql_wrapper/domain/use_cases/codeql_analysis_use_case.py Integrated adaptive/manual max_workers, updated executor settings
src/codeql_wrapper/domain/entities/codeql_analysis.py Added max_workers field to analysis request entity
src/codeql_wrapper/cli.py Added --max-workers CLI option
pyproject.toml Added psutil and its typing dependency
Comments suppressed due to low confidence (2)

tests/test_codeql_analysis.py:893

  • The variable request is not defined in this test, causing a NameError. You should create or import a valid CodeQLAnalysisRequest instance before using request.repository_path.
                    for p in request.repository_path.iterdir()

tests/test_codeql_analysis.py:878

  • mock_iterdir isn’t configured to return the mocked directories, so iterdir() won’t yield your mock_hidden_dir and mock_regular_dir. Add mock_iterdir.return_value = [mock_hidden_dir, mock_regular_dir] before running the list comprehension.
            ) as mock_exists, patch("pathlib.Path.is_dir") as mock_is_dir:

@fernandosantos-br fernandosantos-br changed the title CodeQL instalation improvement and calculate optimal workers number CodeQL instalation improvement, calculate optimal workers number and output project name Jul 12, 2025
@fernandosantos-br fernandosantos-br merged commit a584f40 into main Jul 14, 2025
7 checks passed
@fernandosantos-br fernandosantos-br deleted the develop-bug-fix-codeql-instalation branch July 14, 2025 16:33
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.

4 participants