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

function_parameter_count should ignore initializers #544

Closed
ivanbruel opened this issue Feb 16, 2016 · 5 comments
Closed

function_parameter_count should ignore initializers #544

ivanbruel opened this issue Feb 16, 2016 · 5 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@ivanbruel
Copy link

How would you work around models with a good amount of properties to be set on an initializer?
I agree with the number of parameters being limited, but not initializers themselves.

screen shot 2016-02-16 at 18 54 25

@jpsim
Copy link
Collaborator

jpsim commented Feb 16, 2016

Just // swiftlint:disable:next function_parameter_count on the line above the initializer?

@jpsim jpsim added the question Question or doubts that needs discussion and clarification. Can become a bug or proposal. label Feb 16, 2016
@ivanbruel
Copy link
Author

It's not about working around but rather trying to understand why it's a best practice when it comes to initializers.

@jpsim
Copy link
Collaborator

jpsim commented Feb 16, 2016

Ok, thinking about this more I would agree. This was even suggested in the initial issue tracking this rule (#415 (comment)). This should be just a matter of removing FunctionConstructor from the functionKinds used to apply the rule: https://github.com/realm/SwiftLint/blob/0.9.0/Source/SwiftLintFramework/Rules/FunctionParameterCountRule.swift#L101

@jpsim jpsim added enhancement Ideas for improvements of existing features and rules. and removed question Question or doubts that needs discussion and clarification. Can become a bug or proposal. labels Feb 16, 2016
@kaybutter
Copy link

I tried applying your fix to the FunctionParameterCountRule but I'm still seeing the warning with my project. The issue seems to be that my constructor is being recognized as FunctionMethodInstance instead of FunctionConstructor. :(

@marcelofabri
Copy link
Collaborator

This was fixed in #942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

No branches or pull requests

4 participants