Add `inconsistent_default_argument` rule
### New Issue Checklist
- [x] Updated SwiftLint to the latest version
- [x] I searched for [existing GitHub issues](https://github.com/realm/SwiftLint/issues)
### New Rule Request
Please add a `inconsistent_default_argument` rule (it could be named `coordinate_default_arguments` if you want an imperative name for the fix instead of a descriptive name for the problem, or something else).
In certain circumstances, it would ensure that parameters with the same label & type that have a default argument use the same default argument.
It could have a few options to specify the applicable circumstances. I'll leave it to you to decide what circumstances (& if the whole rule) should be enabled by default (also, you can rename any options, add options, etc.) (I'd prefer the rule & all options to be enabled by default, but I don't know how much code would violate the maximal rule, so I don't want to cause a tsunami of violations). Boolean options:
- `call_default_arguments`: If functions F & G both have a default argument for parameter P, if F calls G passing its value of P to to G's P, then it is an error if the default arguments for P for both F & G are not the same.
- `overload_default_arguments`: If methods F & G for the same type with the same name but with different signatures both have a default argument for parameter P, then it is an error if the default arguments for P for both F & G are not the same.
- `override_default_arguments`: If method F exists for type T, and overrides a method G from some type/protocol, S, that T extends / conforms to, and both F & G have a default argument for parameter P, then it is an error if the default arguments for P for both F & G are not the same.
- etc.
1 条评论