ymyzk / tox-gh-actions

Seamless integration of tox into GitHub Actions for tox 3 and 4
MIT License
246 stars 25 forks source link

Improve error reporting when a config is malformed #175

Open ymyzk opened 1 year ago

ymyzk commented 1 year ago

Problem When a given configuration is malformed (: must be used instead of =) like the following example (#174)

python =
    3.7 = py37
    3.8 = py38
...

tox-gh-actions reports user-unfriendly error like

return {k: StrConvert.to_env_list(v).envs for k, v in parse_dict(value).items()}
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tox_gh_actions/plugin.py", line 264, in parse_dict
return dict((k.strip(), v.strip()) for k, v in pairs)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tox_gh_actions/plugin.py", line 264, in <genexpr>
return dict((k.strip(), v.strip()) for k, v in pairs)
ValueError: not enough values to unpack (expected 2, got 1)
Error: Process completed with exit code 1.

Idea It's better to detect malformed configurations and show user-friendly error messages instead.

bittner commented 1 year ago

I agree on reporting errors in a user-friendly manner.

The syntax, as shown off by your example, might be good to revise, though. = seems to work out better than : for Tox. Please see https://github.com/tox-dev/tox/discussions/3014 for some background.