Skip to content

Releases: bedapub/QM-LUX

Release list

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 30 Jul 11:37
fix(preparation): report bad inputs instead of raising UnboundLocalError

`data_preparation` assigned `data_chir` inside an if/elif/else chain whose
`else` branch only printed "Error in the inputs". Execution then continued
into `data_chir.rename(...)` two lines below, so every unsupported input
died with `UnboundLocalError: cannot access local variable 'data_chir'` --
with the diagnostic on stdout and the traceback on stderr.

The reachable case was `stereo_check="YES"` with no `current_df`: the branch
was gated on the argument rather than the mode
(`elif stereo_check == "YES" and current_df:`), while the docstring called
`current_df` optional and `cli.py` declared `-d` as `required=False`. Any
unrecognised value failed the same way.

The `elif` now matches on the mode alone and checks `current_df` separately,
so the two mistakes get two messages -- a bare `else: raise` would have told
a user who typed `-c YES` that "stereo_check must be 'YES' or 'NO', got
'YES'". The `else` raises and names the offending value. `current_df` is
therefore mandatory under "YES", which is what `workflow/Snakefile:58-60`
already enforced for the workflow; the docstring no longer disagrees.

`cli.py` normalises `-c` with `.strip().upper()` the same way the Snakefile
normalises the config key, so `-c yes` reaches the YES path instead of being
read as an unknown mode. Help text for `-c`/`-d` corrected to match.

The Snakemake workflow was never affected -- its guard rejects the
combination up front -- and no README example passes `-c`, so this reached
users through direct library use and the CLI only. It always failed loudly,
so no run produced bad output.

Tests: 327 -> 338. New `TestDataPreparationBadInput` covers the 2x2 cell that
was never exercised (YES with no current_df, which is why the suite passed
over a live bug), an empty-string `current_df`, six bad `stereo_check`
values, and the value appearing in the message; two subprocess CLI tests
cover case-normalisation and rejection. `tests/cli/test_run_sh.sh` still
108/108.