Introduce NamedArguments rule#3167
Conversation
871850e to
4b2d0c6
Compare
Codecov Report
@@ Coverage Diff @@
## master #3167 +/- ##
============================================
+ Coverage 79.51% 79.53% +0.02%
- Complexity 2599 2606 +7
============================================
Files 437 439 +2
Lines 7865 7927 +62
Branches 1497 1510 +13
============================================
+ Hits 6254 6305 +51
- Misses 817 821 +4
- Partials 794 801 +7
Continue to review full report at Codecov.
|
… default number of non-named parameters
4b2d0c6 to
77c1cc5
Compare
cortinico
left a comment
There was a problem hiding this comment.
Thanks for your contrib @sowmyav24
Please clarify the documentation as the semantic is a bit unclear right now. The threshold applies to the whole number of parameters, and not just to the named parameters.
51041b8 to
cc50ded
Compare
schalkms
left a comment
There was a problem hiding this comment.
Thanks for the contribution! Please see my attached comments. I'm not sure whether there should be a bigger test coverage.
| ) | ||
|
|
||
| override fun visitCallExpression(expression: KtCallExpression) { | ||
| val valueArguments = expression.valueArguments |
There was a problem hiding this comment.
What happens when calling constructors? Shall a test be added?
There was a problem hiding this comment.
The rule gets triggered. Have added tests for them
5136577 to
81d02e1
Compare
|
@cortinico & @BraisGabin should this rule also report constructors or just functions? What's your take on this? |
|
I think that it should report constructors. But maybe we could have two different threshold. |
Seems like it works also for ctors.
Don't have a strong opinion on this actually. Considered that the rule is not enabled by default, I'd be fine having a single threshold for now and adding another one in the future if needed. |
* Introduce NamedArguments rule when function is invoked with more than default number of non-named parameters * Change the documentation to make the intent of default threshold clear * Add compliant and non-compliant code documentation. Add tests for constructor
* Introduce NamedArguments rule when function is invoked with more than default number of non-named parameters * Change the documentation to make the intent of default threshold clear * Add compliant and non-compliant code documentation. Add tests for constructor
* Introduce NamedArguments rule when function is invoked with more than default number of non-named parameters * Change the documentation to make the intent of default threshold clear * Add compliant and non-compliant code documentation. Add tests for constructor
Fixes #1007
Changes done:
NamedArgumentsrule which enforces function invocation to have named parameters when they cross the threshold of number of non-named parameters.3.