Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages for duplicate component aliases #399

Merged
merged 2 commits into from
Jan 3, 2022

Conversation

simu
Copy link
Member

@simu simu commented Dec 31, 2021

This commit adds logic to detect component aliases which alias another component used in the hierarchy.

To do this, we validate discovered components and aliases after parsing all applications array entries. This also allows us to provide all components which illegally map to the same alias.

The errors are still raw KeyError exceptions when running commodore catalog compile.

Fixes #344

Checklist

  • Keep pull requests small so they can be easily reviewed.
  • Update tests.
  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog
  • Link this PR to related issues.

@simu simu added the change PR with a minor change which affects users label Dec 31, 2021
@simu simu requested a review from glrf December 31, 2021 15:03
simu added 2 commits December 31, 2021 16:18
This commit adds logic to detect component aliases which alias another
component used in the hierarchy.

To do this, we validate discovered components and aliases after parsing
all `applications` array entries. This also allows us to provide all
components which illegally map to the same alias.

The errors are still raw `KeyError` exceptions when running `commodore
catalog compile`.

Fixes #344
…ents`

Raise a `ClickException` instead to produce a nice error message.
@simu simu force-pushed the fix/component-alias-error-message branch from 6b8f405 to 814180f Compare December 31, 2021 15:18
Copy link
Contributor

@glrf glrf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nitpick I would have done differently. Feel free to ignore that.

commodore/dependency_mgmt.py Show resolved Hide resolved
@simu simu merged commit 17f4ee5 into master Jan 3, 2022
@simu simu deleted the fix/component-alias-error-message branch January 3, 2022 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change PR with a minor change which affects users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error message when user tries to alias a component to another component's name
2 participants