stm32pio icon indicating copy to clipboard operation
stm32pio copied to clipboard

Let CLI tools describe their validators themselves

Open ussserrr opened this issue 4 years ago • 0 comments

Currently, validation process of some tool is described completely separately of its class (PlatformIO and CubeMX, Java can be treated as a part of CubeMX actually):

return ToolsValidationResults(
    Tool(name=param,
         command=config.get('app', param),
         runner=runner,
         required=required,
         logger=logger).validate()
    for param, runner, required in [
        ('platformio_cmd', platformio_runner, True),
        ('cubemx_cmd', cubemx_runner, True),
        ('java_cmd', java_runner, False)
    ])

We can define some IVerifiable interface that a tool should implement by having a tool.validator attribute which in turn absorbs all related logic. In such configuration, adding a new tool will automatically register it in the virtual "pool" of verifiable instruments.

ussserrr avatar Oct 06 '21 12:10 ussserrr