Skip to content

Remove checks code duplication #727

@Ana06

Description

@Ana06

Details

The checks code used in the GUI and the command line has a lot of duplication that difficult maintenance as well as keeping the code between both views consistent. One option to remove the code duplication is to have a checks array with an entry per check with the following information and use it in both views:
(name, info, function, allow_continue)

For example:
("Valid Powershell version", "PowerShell version >= 5", Test-PSVersion, False)

For example:

function Check-PowerShell-Version {
    $psVersion = $PSVersionTable.PSVersion
    if ($psVersion -lt [System.Version]"5.0.0") {
         return "You are using PowerShell version $psVersion. This is an old version and it is not supported"
    }
}

This requires displaying the checks in the UI dynamically, by calculating the offsets instead of hardcoding them. This has the advantage that allows to modify this view more easily.

I have proposed this in both #509 and #707 but @sara-rn decided not to implement it. Creating the issue so that we have it tracked and can be implemented at a later point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💎 enhancementIt is working, but it could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions