Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

leadingUnderscoreAccess rule not working properly #1588

@Nightmaster

Description

@Nightmaster

We are using JSCS on our Angular application, but we got some problems with the leadingUnderscoreAccess rule. I let you see the code, JSCS rule and output to see why I say this.

JavaScript demo code:

(function()
{
    angular.module('bug-demo').controller('DemoController', DemoController);

    DemoController.$inject = ['$scope', '$log'];

    function DemoController($scope, $log)
    {
        $scope.myFunctionWorking = function myFunctionWorking()
        {
            $scope.$on('bug', _jscsFailsHereWithJsDocRule)

            /**
            * Here is the demonstration that JSCS don't find the @private annotation
            *
            * @private
            **/
            function _jscsFailsHereWithJsDocRule()
            {
                _jscsWillFailEvenWithAccessAnnotation();
            }

            /**
            * Here is the demonstration that JSCS don't find the @access annotation no more
            *
            * @access private
            **/
            function _jscsWillFailEvenWithAccessAnnotation()
            {
                $log.debug('JSCS will report innapropriate error here');
            }
        }
    }
})();

.jscrc file used:

{
    "disallowEmptyBlocks": true,
    "disallowKeywords": ["with"],
    "disallowMixedSpacesAndTabs": true,
    "disallowMultipleSpaces": true,
    "disallowPaddingNewlinesInBlocks": true,
    "disallowQuotedKeysInObjects": "allButReserved",
    "disallowSpaceAfterObjectKeys": true,
    "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
    "disallowSpaceBeforeComma": true,
    "disallowSpaceBeforeSemicolon": true,
    "disallowSpacesInFunctionExpression": { "beforeOpeningRoundBrace": true },
    "disallowSpacesInsideArrayBrackets": true,
    "disallowSpacesInsideParentheses": true,
    "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
    "disallowTrailingWhitespace": true,

    "jsDoc": {
        "checkAnnotations": "jsdoc3",
        "checkParamNames": true,
        "requireParamTypes": true,
        "checkRedundantParams": true,
        "checkReturnTypes": true,
        "checkRedundantReturns": true,
        "checkTypes": "capitalizedNativeCase",
        "checkRedundantAccess": true,
        "leadingUnderscoreAccess": true,
        "requireNewlineAfterDescription": true
    },

    "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
    "requireCapitalizedConstructors": true,
    "requireCommaBeforeLineBreak": true,
    "requireCurlyBraces": ["try", "catch"],
    "requireDotNotation": true,
    "requireFunctionDeclarations": true,
    "requireLineFeedAtFileEnd": true,
    "requireMultipleVarDecl": true,
    "requireOperatorBeforeLineBreak": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", ","],
    "requireParenthesesAroundIIFE": true,
    "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ","],
    "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
    "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
    "requireSpaceBeforeObjectValues": true,
    "requireSpaceBetweenArguments": true,
    "requireSpacesInConditionalExpression": true,
    "requireSpacesInForStatement": true,
    "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
    "requireSpacesInsideObjectBrackets": "all",
    "requireYodaConditions": true,

    "validateLineBreaks": "LF",
    "validateQuoteMarks": "'",


    "excludeFiles": ["node_modules/**", "bower_components/**", "src/assets/**"],
    "fileExtensions": [".js"]
}

Console output – runned with JSCS --verbose:

jscs leadingunderscoreaccess rule not working demo

Running environment:

OS / Application Version
Windows 7
Node.js 0.12.6
JSCS 2.0.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions