oppia / oppia-android

A free, online & offline learning platform to make quality education accessible for all.
https://www.oppia.org
Apache License 2.0
314 stars 517 forks source link

Introduce linter to ensure KDoc is present #3195

Open BenHenning opened 3 years ago

BenHenning commented 3 years ago

We need to ensure that KDocs are present on all non-private:

We should also make sure that the KDocs are properly formatted per the style guide. That is, the KDoc:

adhiamboperes commented 7 months ago

@BenHenning, we already have a KDOC validy check that checks most if not all of the requirements in this issue. Is something different needed? If not, then @deonwaju can review the kdoc validation script and verify that all the checks are present, then we can close this issue.

BenHenning commented 6 months ago

@adhiamboperes I think only the first list is addressed, right? The current KDoc checker is only for KDoc presence, not formatting validity. I've taken a stab at trying to fix this in the past, but I didn't make much progress on it. If I recall, our usage of the Kotlin compiler to determine KDoc presence involves checking for the presence of a documentation node in the parsed AST, and I think that node includes the raw document text for analysis. I do not remember what, if any, tokens are stripped by the compiler however (if it's not an exact copy including whitespace then we'll need to use its indexes to retrieve the comment directly from the source file since part of syntactical verification here is ensuring correct spacing of KDoc elements).