conda-forge / conda-smithy

The tool for managing conda-forge feedstocks.
https://conda-forge.org/
BSD 3-Clause "New" or "Revised" License
146 stars 170 forks source link

Unexpected top-level keys in conda-forge.yml fail to display anything #1895

Closed bollwyvl closed 4 months ago

bollwyvl commented 4 months ago

Solution to issue cannot be found in the documentation.

Issue

If a conda-forge.yml contains an unexpected top-level key, no useful output should be shown.

For example, given this file, the error should probably be:

Additional properties are not allowed ('linux_ppc64le' was unexpected)

But instead seeing:

Traceback (most recent call last):
  File "~/env/bin/conda-smithy", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/env/lib/python3.11/site-packages/conda_smithy/cli.py", line 737, in main
    args.subcommand_func(args)
  File "~/env/lib/python3.11/site-packages/conda_smithy/cli.py", line 616, in __call__
    lints, hints = lint_recipe.main(
                   ^^^^^^^^^^^^^^^^^
  File "~/env/lib/python3.11/site-packages/conda_smithy/lint_recipe.py", line 1115, in main
    results.extend([_format_validation_msg(err) for err in validation_errors])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/env/lib/python3.11/site-packages/conda_smithy/lint_recipe.py", line 1115, in <listcomp>
    results.extend([_format_validation_msg(err) for err in validation_errors])
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/env/lib/python3.11/site-packages/conda_smithy/lint_recipe.py", line 1081, in _format_validation_msg
    error.json_path.split(".")[1].split("[")[0].replace("_", "-")

PR incoming.

Installed packages

conda-smithy 3.34.0

Environment info

CI