-
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
Question: function_parameter_count rule behavior #2171
Comments
That's the expected behavior: we currently don't count the default parameters. If you feel like this is important, this could be a configuration option and PRs would be welcome. |
Understood. I think this could be added as a configuration option. Anyway, this is just my suggestion. Thanks, Varun |
@varunpm1 would you want to implement it and contribute back? |
I could try but I'm not sure on the steps to contributing. |
@varunpm1 thanks for your interest in contributing! Please read our CONTRIBUTING.md document and let us know if you have any questions. |
A small concern here - When I tried to go through the steps as per CONTRIBUTING.md, I couldn't run the following command - I'm receiving the following error - Any help here would be appreciated. Also, I'm assuming that this has to be a separate rule, correct? |
Are you sure you have docker installed? Instructions to do so here: https://docs.docker.com/install/ |
And no, to configure the |
Got it. Thanks for the help. Trying to implement the configuration. |
I have sent a PR to master branch with the required configuration. I have also added a test case for function_parameter_count rule. Let me know if anything else is needed here. |
Thanks for taking the initiative to do this! Myself or another contributor will hopefully have time to review your PR shortly. |
Closing this issue as the PR has been merged. |
New Issue Checklist
Possible Bug
Swift Lint rule - function_parameter_count
func test(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int = 0, g: Int = 0)
The total parameters count for the above function is 7 (i.e., 5 compulsory parameters and 2 optional parameters). So I would like to know if the rule function_parameter_count should throw a warning for this function or not. Currently, this rule doesn't throw a warning for such functions.
func test(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int, g: Int)
However, making all parameters as compulsory throws warning as expected.
xcode-select -p
)? - XCode 9.3As per my understanding, this should throw a warning in both the scenarios since total parameter count exceeds the limit. Any help/suggestions appreciated here.
Thanks, Varun
The text was updated successfully, but these errors were encountered: