Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Argument Parsing Logic #2605

Merged
merged 10 commits into from
Aug 5, 2024
Merged

Refactor Argument Parsing Logic #2605

merged 10 commits into from
Aug 5, 2024

Conversation

ddx2tb
Copy link
Contributor

@ddx2tb ddx2tb commented Aug 2, 2024

Overview

This PR introduces a series of refactoring changes to the parse_unspecified_argument_list function in the archinstall module. The main objectives of this refactor are to improve code readability, simplify the control flow, and enhance maintainability.

Key Changes

  1. Moved Precondition Check: The check for the '=' element has been relocated to the beginning of the while loop. This change ensures that the precondition is evaluated before any further processing, which enhances the clarity of the argument parsing logic.

  2. Removed Redundant Else Statement: A redundant else block has been eliminated, streamlining the control flow. This simplification reduces nesting and makes the code easier to follow while maintaining the original functionality.

Benefits

  • Improved Readability: The changes make the code more intuitive and easier to understand for future developers.
  • Enhanced Maintainability: By reducing complexity, the code is now easier to modify and extend in the future.
  • Preserved Functionality: All existing functionality remains intact, ensuring that the behavior of the argument parsing remains consistent.

ddx2tb and others added 9 commits July 25, 2024 13:41
This commit moves the check for the '=' element to the start of the while loop in the `parse_unspecified_argument_list` function. This change improves code readability and ensures that the precondition is evaluated before processing other elements, enhancing the overall flow of the argument parsing logic.
This commit simplifies the control flow in the `parse_unspecified_argument_list` function by removing a redundant 'else' block. The logic is streamlined to improve readability and maintainability while preserving the original functionality. The removal of unnecessary nesting helps clarify the conditions under which elements are processed.
This commit simplifies the control flow in the `parse_unspecified_argument_list` function by removing a redundant 'else' block. The logic is streamlined to improve readability and maintainability while preserving the original functionality. The removal of unnecessary nesting helps clarify the conditions under which elements are processed.
@ddx2tb ddx2tb requested a review from Torxed as a code owner August 2, 2024 16:12
This commit modifies the `parse_unspecified_argument_list` function to filter out unwanted elements from the `unknowns` list instead of using a conditional check with an `if` statement. This change improves code readability and efficiency by utilizing list comprehension to create a new list that excludes elements equal to "=".
Copy link
Member

@Torxed Torxed left a comment

Choose a reason for hiding this comment

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

Appears to work as expected, thank you for the improvement!

@Torxed Torxed merged commit 58d74ea into archlinux:master Aug 5, 2024
6 checks passed
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.

2 participants