#4169 OutdatedDocumentation rule#4185
Conversation
cortinico
left a comment
There was a problem hiding this comment.
Great work 💪 Thanks for taking the time to write this. I've left some comments. Let me know if you need some help or are unclear.
| private data class MutableDeclarations( | ||
| val params: MutableList<String> = mutableListOf(), | ||
| val props: MutableList<String> = mutableListOf() | ||
| ) { | ||
| fun toDeclarations(): Declarations { | ||
| return Declarations( | ||
| params = params, | ||
| props = props | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| private data class Declarations( | ||
| val params: List<String> = listOf(), | ||
| val props: List<String> = listOf() | ||
| ) |
There was a problem hiding this comment.
Do we need both? I believe we could rewrite the code to be fully immutable here. Specifically we could get rid of MutableDeclarations entirely.
There was a problem hiding this comment.
I've refactored this part a bit to get rid of mutable version and use more functional style
Basic implementation covers: - class primary constructor parameters - class primary constructor property parameters - function parameters
… any @param or @Property tag
…d declarations order
cb2a1cf to
5bd7f86
Compare
cortinico
left a comment
There was a problem hiding this comment.
Looks good on my end 💪 Great work and thanks for doing it!
Let's wait for another maintainers' review and we should be good to go
Codecov Report
@@ Coverage Diff @@
## main #4185 +/- ##
============================================
+ Coverage 84.12% 84.19% +0.06%
- Complexity 3205 3233 +28
============================================
Files 467 468 +1
Lines 10113 10185 +72
Branches 1774 1786 +12
============================================
+ Hits 8508 8575 +67
+ Misses 673 671 -2
- Partials 932 939 +7
Continue to review full report at Codecov.
|
BraisGabin
left a comment
There was a problem hiding this comment.
Really good test coverage :)
| * @param someParam Description of param | ||
| * @property someProp Description of property | ||
| */ | ||
| class MyClass(otherParam: String, val someProp: String) |
There was a problem hiding this comment.
What happend with:
/**
* @property someParam Description of param
* @param someProp Description of property
*/
class MyClass(someParam: String, val someProp: String)Should this rule catch when you use @param over a property or @property over a param?
There was a problem hiding this comment.
Rule will report such case, because @param is strictly required to be param, and @Property to be property. I've added test case for this scenario
|
To me this PR is ready to merge. I would like to know your opinion about my comments but both can be done in a follow up PR. The only thing stopping us to merge this is that CI is complaining. Could you check those issues? |
|
I hopefully fixed CI (there were some minors e.g. not compiling test snipets, because of lack of function body). I would also like to fix issue mentioned here #4185 (comment) before you merge |
|
Great first contribution 👏 |
Hi, I've prepared implementation of OutdatedDocumentation rule proposed in #4169
When KDoc is present and contains any
@paramor@propertytag, rule will check if params and properties of class/function/constructor declaration matches the ones from KDoc.By default, both type and value parameters are considered, but I've added configuration for turning off checks for type parameters. Also the order of declarations matters in default configuration, but can be turned off as well.
If you want to suggest additional test scenarios or configurable behaviour feel free to comment and I will be happy to enhance this PR.