Skip to content
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

Warn when the required documentation for functions is missing #1618

Merged

Conversation

pwrobeldev
Copy link
Contributor

This change extends function validator by checking
if parameters and return value are properly documented.

The logic works as follows:

  • all function parameters need to be documented
  • return value needs to be documented
  • the validation is not applied for internal functions
    or functions nested in internal types (or types nested
    in internal types)

The user may enable treating the warning as error via werror
flag.

@pwrobeldev
Copy link
Contributor Author

Please see how the output looks like. For instance, in smoke tests we have ForwardDeclarations.lime file, which contains the following interface:

interface UseForward {
    fun use_it(
        param1: Class1,
        param2: Class2,
        simpleClass: smoke.SimpleClass,
        simpleInterface: smoke.SimpleInterface
    )
}

The documentation is missing for parameters and return value.

When the code is generated, the following warning is produced.

ForwardDeclarations.lime, element smoke.forward.UseForward.use_it: Parameter 'param1' must be documented
ForwardDeclarations.lime, element smoke.forward.UseForward.use_it: Parameter 'param2' must be documented
ForwardDeclarations.lime, element smoke.forward.UseForward.use_it: Parameter 'simpleClass' must be documented
ForwardDeclarations.lime, element smoke.forward.UseForward.use_it: Parameter 'simpleInterface' must be documented
ForwardDeclarations.lime, element smoke.forward.UseForward.use_it: Return must be documented

@pwrobeldev pwrobeldev marked this pull request as ready for review November 18, 2024 09:48
This change extends function validator by checking
if parameters and return value are properly documented.

The logic works as follows:
 - all function parameters need to be documented
 - return value needs to be documented
 - the validation is not applied for internal functions
   or functions nested in internal types (or types nested
   in internal types)

The user may enable treating the warning as error via werror
flag.

Signed-off-by: Patryk Wrobel <[email protected]>
This change adds the required unit tests that
verify the logic related to validation of comments
that are required to properly document function
parameters and return value.

Signed-off-by: Patryk Wrobel <[email protected]>
Hsilgos
Hsilgos previously approved these changes Nov 18, 2024
@pwrobeldev pwrobeldev force-pushed the pwrobeldev/warn-if-function-arg-or-return-is-not-documented branch from 16ea63e to 860d5b2 Compare November 18, 2024 10:11
@pwrobeldev pwrobeldev merged commit 9c0ab5d into master Nov 18, 2024
17 checks passed
@pwrobeldev pwrobeldev deleted the pwrobeldev/warn-if-function-arg-or-return-is-not-documented branch November 18, 2024 10:35
@pwrobeldev
Copy link
Contributor Author

CHANGELOG.md was not adjusted. It is done by the follow-up PR: #1620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants