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

Fix linting issues #1694

Merged
merged 4 commits into from
Mar 7, 2023
Merged

Fix linting issues #1694

merged 4 commits into from
Mar 7, 2023

Conversation

skelouse
Copy link
Contributor

@skelouse skelouse commented Mar 5, 2023

What type of PR is this?

  • cleanup

What this PR does / why we need it:

Fixes 100% of golangci-lint linting issues

Which issue(s) this PR fixes:

Partially fixes #1663

Testing

https://asciinema.org/a/ucDYTAfRZzASFpkmpfdrTxQHJ

ran make

Release Notes

Update to pass `golangci-lint`

@skelouse skelouse requested a review from a team as a code owner March 5, 2023 05:50
@skelouse
Copy link
Contributor Author

skelouse commented Mar 5, 2023

Can we override the patch diff, or should I add test cases for the error checks?

meatballhat
meatballhat previously approved these changes Mar 6, 2023
Copy link
Member

@meatballhat meatballhat left a comment

Choose a reason for hiding this comment

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

Overall I'm very excited about this change! Thank you @skelouse 🎉

  • the notes here don't need to be addressed in this PR, but I'd like to get them done soonish
  • ignoring the patch-level coverage check is fine in this case, imho
  • can either this PR or a near future follow-up PR add golangci-lint integration in CI to assert that new linting errors are not introduced?

completion.go Outdated
Comment on lines 57 to 60
_, err = ctx.App.Writer.Write([]byte(c))
if err != nil {
return Exit(err, 1)
}
Copy link
Member

Choose a reason for hiding this comment

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

This would result in a behavioral change, which is arguably one of:

  • a bugfix! ➡️ patch release
  • backwards-incompatible ➡️ major release

I'm personally happy to revert this to ignoring the return values because if we can't print completion, something else is probably very unhappy on the system and I don't want to add to the noise by exiting non-zero.

Copy link
Member

Choose a reason for hiding this comment

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

🤦🏼 this is targeting the v3 alpha, so never mind what I said! Let's exit non-zero on failure to write completion 👍🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can easily do _, _ for v2 and support linting just the same, good note.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

app_test.go Outdated Show resolved Hide resolved
flag_test.go Outdated
Comment on lines 429 to 433
err := fl.Apply(tfs)
if err != nil {
t.Error(err)
return
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm happy to start using stretchr/testify more around here, e.g.:

Suggested change
err := fl.Apply(tfs)
if err != nil {
t.Error(err)
return
}
require.Nil(t, fl.Apply(tfs))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to introduce another import in go.mod? From my perspective it seems that this package has very few external imports. Maybe in another PR as there are many use cases for using testify.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

help.go Outdated Show resolved Hide resolved
context_test.go Outdated Show resolved Hide resolved
help.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dearchap dearchap left a comment

Choose a reason for hiding this comment

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

Great work @skelouse . Thanks for your contribution

@skelouse
Copy link
Contributor Author

skelouse commented Mar 6, 2023

@meatballhat

  • can either this PR or a near future follow-up PR add golangci-lint integration in CI to assert that new linting errors are not introduced?

I'd love to make this change, but i'm not sure where to start with CI integrations.

@skelouse skelouse merged commit e55fb61 into urfave:main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add integration with golangci-lint
3 participants