Skip to content

Potentially problematic config parameter extraction #49

@Ian0sborne

Description

@Ian0sborne

The proc function in packs/proc/proc.py calls the process_bin_WD2 function, passing in two arguments from the config file: file_path & save_path. The way these two arguments are extracted from the config file (shown below) could be problematic if the config file passed in also contains optional/additional parameters in future.

conf_dict = read_config_file(full_path)
# removing the first two components so that they can be fed into functions
arg_dict  = dict(list(conf_dict.items())[2:])
# check the method implemented, currently just process
match conf_dict['process']:
    case 'decode':
        if conf_dict['wavedump_edition'] == 2:
            process_bin_WD2(**arg_dict)

I suggest we extract the required parameters by their key, making the code safer and robust in case of future changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Prio 2

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions