Skip to content

Mentioning Commenting standards #2

@egekorkan

Description

@egekorkan

Not sure about Python but in Javascript, there is this pseudo-standard called JSDoc that visual studio code recognizes by default. It is simply about putting comments like this before the function:

/**
 * Solves equations of the form a * x = b
 * @example
 * // returns 2
 * globalNS.method1(5, 10);
 * @example
 * // returns 3
 * globalNS.method(5, 15);
 * @returns {Number} Returns the value of x for the equation.
 */
globalNS.method1 = function (a, b) {
    return b / a;
};

It can be used to generate documentation etc but the nicest use case for me is when reviewing code. VS-Code shows a rendered version of these comments when you hover your mouse pointer on the use of this function somewhere in the code. Below is an example screenshot:

image

So if people use such standards, it makes it easier for others to contribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions