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

Lint messages reported from porter should not mention mixins #2526

Closed
carolynvs opened this issue Jan 17, 2023 · 3 comments · Fixed by #2992
Closed

Lint messages reported from porter should not mention mixins #2526

carolynvs opened this issue Jan 17, 2023 · 3 comments · Fixed by #2992
Labels
bug Oops, sorry! good first issue Good for new contributors hacktoberfest Issues chosen for Hacktoberfest 2023

Comments

@carolynvs
Copy link
Member

When porter generates a lint message directly, instead of the message coming from a mixin, we should change the message so that it doesn't print out extra "empty" text about mixins that isn't relevant.

Once #2434 is merged, you can do the following to reproduce:

  1. porter create
  2. edit porter.yaml and define a parameter named "porter_test"
  3. porter lint

expected output

Running linters for each mixin used in the manifest...
error(porter-100) - Reserved name warning
porter_test has a reserved prefix. Parameters cannot start with porter- or porter_
See https://getporter.org/reference/linter/#porter-100 for more information

actual output

Running linters for each mixin used in the manifest...
error(porter-100) - Reserved name warning
: 0th step in the  mixin ()
porter_test has a reserved prefix. Parameters cannot start with porter- or porter_
See https://getporter.org/reference/linter/#porter-100 for more information

You can tell that a lint result was generated by porter because Location.Mixin is an empty string. The relevant code to change is

porter/pkg/linter/linter.go

Lines 113 to 116 in 6df2790

func (l Location) String() string {
return fmt.Sprintf("%s: %s step in the %s mixin (%s)",
l.Action, humanize.Ordinal(l.StepNumber), l.Mixin, l.StepDescription)
}

Please update the unit tests in linter_test.go to validate that lint results generated by porter do not print out that extra text ": 0th step in the mixin ()"

See our Contributing Tutorial and New Contributor Guide for help getting started contributing to Porter.

@carolynvs carolynvs added bug Oops, sorry! good first issue Good for new contributors labels Jan 17, 2023
@carolynvs carolynvs mentioned this issue Jan 17, 2023
4 tasks
@0xquark
Copy link
Contributor

0xquark commented Jan 22, 2023

Hi @carolynvs, I'd like to work on this!

@carolynvs
Copy link
Member Author

@0xquark That would be great! You won't be able to reproduce the behavior listed in the reproduction steps yet, because we haven't merged #2434 as mentioned in the issue above. But you can start on it now, and it should be merged soon. 👍

@0xquark
Copy link
Contributor

0xquark commented Jan 23, 2023

Thanks! I'll start working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Oops, sorry! good first issue Good for new contributors hacktoberfest Issues chosen for Hacktoberfest 2023
Projects
Status: Done
Status: Done
3 participants