Repository navigation
Fix/sonarcloud quality gate issues - #4657
Merged
Merged
Conversation
- Enhanced error logging in `api.py` to use `LOG.exception` for better traceability. - Simplified the `get_line_style` function in `ansi_output.py` by removing redundant regex patterns. - Refactored the `run_scenarios_parallel` function in `worker.py` to improve readability and maintainability by extracting helper functions for prerun steps and future result processing. - Consolidated variable writing logic in `ansible.py` to a dedicated method for better organization. - Updated schema validation logic in `schema_v3.py` to improve clarity and maintainability. These changes aim to enhance code quality and maintainability across the project.
…r handling - Modified assertions in `test_click_command_ex_with_immediate_exit_failure` to check for exceptions with `exc_info=False` in non-debug mode. - Updated `test_click_command_ex_with_immediate_exit_failure_debug_mode` to assert exceptions with `exc_info=True` in debug mode. - Adjusted `test_click_command_ex_failure_no_context` to verify non-debug behavior with exceptions instead of errors. These changes enhance the accuracy of error handling tests in the click command functionality.
- Introduced `_group_command_parts` method to logically group command parts before wrapping. - Added `_wrap_lines` method to handle line wrapping and indentation, improving readability. - Simplified the logic for constructing command lines, ensuring better handling of flags and values. These changes improve the clarity and maintainability of command output formatting.
- Added tests to ensure that drivers and verifiers log exceptions when they fail to initialize. - Implemented `_BrokenDriver` and `_BrokenVerifier` classes to simulate failures and verify logging behavior. - Updated assertions to confirm that the appropriate exceptions are logged and that the system behaves as expected when encountering plugin failures. These changes improve the robustness of error handling in the testing framework.
- Updated instances of `config` to `config_data` across multiple modules for improved clarity and consistency. - Adjusted related logic in classes such as `Config`, `Platforms`, `Scenario`, and various dependencies to reflect the new attribute name. - Ensured that all references in tests were also updated to maintain functionality. These changes enhance code readability and maintainability by providing a clearer distinction between configuration data and other attributes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses several SonarQube issues and includes small refactors to reduce complexity while preserving existing behavior.
Fixes
ansi_output.py-
format_scenario_recap→_format_recap_line(),_count_states()-
BorderedStream.write→_write_single_line(),_write_wrapped_line(),_split_to_width()-
print_matrix→_get_subcommand(),_resolve_playbook_path(),_format_matrix_action()click_cfg.pycast("CliOption", ...)arounddataclasses.replace()calls to explicitly declare the return type.driver/base.pyreturnfromreset()and added# noqa: B027to suppress Ruff's empty-method warning.config.pyself.configtoself.config_datato avoid a field-name collision with the class name. Updated all references across ~30 files.Verification