<commit_before>describe('rules/validate-jsdoc', function () {
    var checker = global.checker({
        additionalRules: ['lib/rules/validate-jsdoc.js']
    });

    describe('check-redudant-returns', function() {

        checker.rules({checkRedundantReturns: true});
        checker.cases([
            /* jshint ignore:start */
            {
                it: 'should report redundant @returns for function',
                errors: 3,
                code: function () {
                    /**
                     * @return {string}
                     */
                    function funcName() {
                        // dummy
                    }

                    /**
                     * @returns {String}
                     */
                    function funcName() {
                        var x = function () { return 1; }
                    }

                    /**
                     * @returns {String}
                     */
                    function funcName() {
                        return;
                    }
                }
            }, {
                it: 'should not report redundant @returns for function',
                code: function () {
                    /**
                     * @returns {String}
                     */
                    function funcName() {
                        var x = function () { return 1; }
                        if (true) { return x; }
                    }
                }
            }
            /* jshint ignore:end */
        ]);

    });
});<commit_msg>checkRedundantReturns: add test for issue #34<commit_after>describe('rules/validate-jsdoc', function () {
    var checker = global.checker({
        additionalRules: ['lib/rules/validate-jsdoc.js']
    });

    describe('check-redundant-returns', function() {

        checker.rules({checkRedundantReturns: true});
        checker.cases([
            /* jshint ignore:start */
            {
                it: 'should report redundant @returns for function',
                errors: 3,
                code: function () {
                    /**
                     * @return {string}
                     */
                    function funcName() {
                        // dummy
                    }

                    /**
                     * @returns {String}
                     */
                    function funcName() {
                        var x = function () { return 1; }
                    }

                    /**
                     * @returns {String}
                     */
                    function funcName() {
                        return;
                    }
                }
            }, {
                it: 'should not report redundant @returns for function',
                code: function () {
                    /**
                     * @returns {String}
                     */
                    function funcName() {
                        var x = function () { return 1; }
                        if (true) { return x; }
                    }
                }
            }, {
                it: 'should not report expression return for inner call result',
                code: function () {
                    /**
                     * @function
                     * @return {Promise} a promise
                     */
                    function onEvent () {
                        return this.login().then(function () {
                            // do some else
                        });
                    }
                }
            }
            /* jshint ignore:end */
        ]);

    });
});
{'fraction_non_alphanumeric': 0.10186199342825848, 'fraction_numerical': 0.002190580503833516, 'mean_word_length': 0.7321005215742058, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7656965', 'n_tokens_mistral': 832, 'n_tokens_neox': 729, 'n_words': 167}