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

add unparam linter #5742

Closed
wants to merge 8 commits into from
Closed

add unparam linter #5742

wants to merge 8 commits into from

Conversation

faddat
Copy link
Contributor

@faddat faddat commented Aug 14, 2023

This PR adds the unparam linter to caddy.

The result was getting rid of several parameters that were never used, and some situations where
we would return an error, where errors could never be triggered.

Note: this should not be merged before #5708

@faddat faddat marked this pull request as draft August 14, 2023 06:00
@francislavoie
Copy link
Member

Hmm, I think most of these are there to leave the option open for later changes. I think these warning and error param/return are harmless as-is and slightly annoying to re-introduce if we find we need them when adding new code, so I think we can leave it in.

@faddat
Copy link
Contributor Author

faddat commented Aug 14, 2023

works for me :)

@faddat faddat closed this Aug 14, 2023
@mholt
Copy link
Member

mholt commented Aug 14, 2023

What did this do, exactly? Only had time for a quick scan so far, but I mostly see reordered imports -- where are the param changes?

@francislavoie
Copy link
Member

@mholt see 5f5c8ed (#5742) i.e. it removed the warnings map in some Caddyfile code and the error return type in a spot it wasn't being checked, etc.

@mholt
Copy link
Member

mholt commented Aug 14, 2023

@francislavoie That looks like it was deleting parameters... which I agree we shouldn't do.

I am talking about renaming them to _ when they're not used, which I do sometimes already.

The more I think about it, the more I think it needs to be case-by-case basis. Sometimes it's obvious (for example, contexts), other times, it's just an int and you have no idea what it is without a variable name.

So probably best to leave the params un-linted for now.

@francislavoie
Copy link
Member

francislavoie commented Aug 14, 2023

Renaming to _ is a different PR, it was from #5712 (comment)

@mholt
Copy link
Member

mholt commented Aug 14, 2023

Oh. I got mixed up. Thanks.

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.

3 participants