phetsims / kite

A library for creating, manipulating and displaying 2D shapes in JavaScript.
MIT License
13 stars 6 forks source link

Shape doesn't properly document optional parameters #62

Closed pixelzoom closed 2 months ago

pixelzoom commented 8 years ago

Shape doesn't properly document which parameters are optional. For example, for arc:

    /**
     * @public
     * @param {number} centerX - horizontal coordinate of the center of the arc
     * @param {number} centerY - Center of the arc
     * @param {number} radius - How far from the center the arc will be
     * @param {number} startAngle - Angle (radians) of the start of the arc
     * @param {number} endAngle - Angle (radians) of the end of the arc
     * @param {boolean} anticlockwise - Decides which direction the arc takes around the center
     * @returns {Shape}
     **/
    arc: function( centerX, centerY, radius, startAngle, endAngle, anticlockwise ) {

The anticlockwise parameter is optional, and should have square brackets around the parameter name, to indicate that it's optional:

     * @param {boolean} [anticlockwise] - Decides which direction the arc takes around the center

IntelliJ IDEA has gotten smarter, and is now flagging this as a problem. E.g. for a call to Shape.arc in WavelengthSlider, it's complaining that the anticlockwise arg is missing:

screenshot_88

pixelzoom commented 8 years ago

I handled this for [anticlockwise], but I'm unsure if there are other such parameters in Shape. Assigning to @jonathanolson to review and correct any additional documentation errors.

jonathanolson commented 2 months ago

Looks good! Scanned for similar issues and didn't see anything. Closing.