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

snap: detect layouts vs layout in snap.yaml (#5869) #5911

Merged
merged 1 commit into from Oct 4, 2018

Conversation

zyga
Copy link
Collaborator

@zyga zyga commented Oct 3, 2018

  • snap: detect layouts vs layout in snap.yaml

This patch adds a check for a typo that people can easily make when
experimenting with snap layouts. The yaml is defined to use the singular
form but there used to be no notification when the plural form was used.

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

  • snap: fix typo in a typo

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

  • snap: simplify typo type

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

  • snap: tweak error wording

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

  • snap: tweak type documentation

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

  • snap: tweak error handling

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

  • snap: generalize the typo detector

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

* snap: detect layouts vs layout in snap.yaml

This patch adds a check for a typo that people can easily make when
experimenting with snap layouts. The yaml is defined to use the singular
form but there used to be no notification when the plural form was used.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* snap: fix typo in a typo

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* snap: simplify typo type

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* snap: tweak error wording

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* snap: tweak type documentation

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* snap: tweak error handling

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* snap: generalize the typo detector

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@zyga zyga added this to the 2.36 milestone Oct 3, 2018
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Just one comment.

@@ -116,6 +127,8 @@ type socketsYaml struct {
// InfoFromSnapYaml creates a new info based on the given snap.yaml data
func InfoFromSnapYaml(yamlData []byte) (*Info, error) {
var y snapYaml
// Customize hints for the typo detector.
y.TypoLayouts.Hint = `use singular "layout" instead of plural "layouts"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I know I'm late to the party and this is just a backport. But it would be great if this hint could be encocded into the struct tag like: TypoLayouts typoDetectoryaml:"layouts,omitempty typo-hints:"..."`. This would mean things are all in the same place. The downside of course is that its no longer i18n able. But at least right now the hint is also not i18n so…

@mvo5 mvo5 merged commit 1a0a49e into snapcore:release/2.36 Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants