-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
unused-parameter
: Support configuring parameter names to ignore
#5741
Comments
You can always replace the parameter with |
The problem with replacing the parameter name with How about allowing prefixing the parameter with |
Here's an example of where I would almost never use struct FooView: NSViewRepresentable {
func makeNSView(context: Context) -> NSViewType {
// ...
}
func updateNSView(_ nsView: NSViewType, context: Context) {}
} I pretty much want to ignore the |
If the function satisfies a protocol requirement or overrides a method from a super class, the parameter can anyway not be omitted. Thus, its name is still there. It cannot be replaced with just
You say
I get that. However, the rule can be run with What about excluding whole functions by name from the analysis given that this is typically annoying for a defined set of framework methods? |
You generally have |
Just the function name can have the same problem with being too broad as you argued with just using the parameter name. |
Fair enough. An option to support this style should be fine then.
Indeed. Glad you mention it. 😅 Up to now, I don't really see an elegant solution. |
New Issue Checklist
Feature or Enhancement Proposal
The rule has a large number of violations where you either cannot change or remove the parameters. The most common case are delegate methods. It would be useful to be able to specify a list of parameter names to ignore. That would silence a lot of the most common cases.
Personally, I would add
coder
,sender
, andcontext
.The text was updated successfully, but these errors were encountered: