Showing 193 of 398 total issues
Function parseComplexJSXElement
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
JSXParser.prototype.parseComplexJSXElement = function (el) {
var stack = [];
while (!this.scanner.eof()) {
el.children = el.children.concat(this.parseJSXChildren());
var node = this.createJSXChildNode();
Function parsePropertyPattern
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.parsePropertyPattern = function (params, kind) {
var node = this.createNode();
var computed = false;
var shorthand = false;
var method = false;
Function finalize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.finalize = function (meta, node) {
if (this.config.range) {
node.range = [meta.index, this.lastMarker.index];
}
if (this.config.loc) {
Function findLeadingComments
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
CommentHandler.prototype.findLeadingComments = function (node, metadata) {
var leadingComments = [];
var target;
while (this.stack.length > 0) {
var entry = this.stack[this.stack.length - 1];
Function reinterpretExpressionAsPattern
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.reinterpretExpressionAsPattern = function (expr) {
switch (expr.type) {
case syntax_1.Syntax.Identifier:
case syntax_1.Syntax.MemberExpression:
case syntax_1.Syntax.RestElement:
Function canSetProperty
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function canSetProperty(object, property, primitives){
if (property === '__proto__' || primitives.isPrimitive(object)){
return false
} else if (object != null){
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validateParam
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.validateParam = function (options, param, name) {
var key = '$' + name;
if (this.context.strict) {
if (this.scanner.isRestrictedWord(name)) {
options.stricted = param;
Function parseObjectPropertyKey
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.parseObjectPropertyKey = function () {
var node = this.createNode();
var token = this.nextToken();
var key = null;
switch (token.type) {
Function scanOctalLiteral
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Scanner.prototype.scanOctalLiteral = function (prefix, start) {
var number = '';
var octal = false;
if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) {
octal = true;
Function testRegExp
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Scanner.prototype.testRegExp = function (pattern, flags) {
// The BMP character to use as a replacement for astral symbols when
// translating an ES6 "u"-flagged pattern to an ES5-compatible
// approximation.
// Note: replacing with '\uFFFF' enables false positives in unlikely
Function walk
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function walk(node){
var parent = parentStack[parentStack.length-1];
var remove = false;
parentStack.push(node);
Function _getTmpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _getTmpl (str) {
var parts = brackets.split(str.replace(RE_DQUOTE, '"'), 1);
var qstr = parts.qblocks;
var expr;
Function parseLeftHandSideExpression
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.parseLeftHandSideExpression = function () {
assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
var node = this.startNode(this.lookahead);
var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
Function _getTmpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _getTmpl (str) {
var parts = brackets.split(str.replace(RE_DQUOTE, '"'), 1)
var qstr = parts.qblocks
var expr
Function _getTmpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _getTmpl (str) {
var parts = brackets.split(str.replace(RE_DQUOTE, '"'), 1)
var qstr = parts.qblocks
var expr
Function _getTmpl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _getTmpl (str) {
var parts = brackets.split(str.replace(RE_DQUOTE, '"'), 1)// get text/expr parts
var qstr = parts.qblocks // hidden qblocks
var expr
Function visitComment
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
CommentHandler.prototype.visitComment = function (node, metadata) {
var type = (node.type[0] === 'L') ? 'Line' : 'Block';
var comment = {
type: type,
value: node.value
Function _skipRegex
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _skipRegex (code, start) {
var re = /.*/g
var pos = re.lastIndex = start++
var match = re.exec(code)[0].match(RE_REGEX)
Function _skipRegex
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _skipRegex (code, start) {
var re = /.*/g
var pos = re.lastIndex = start++
var match = re.exec(code)[0].match(RE_REGEX)
Function _skipRegex
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _skipRegex (code, start) {
var re = /.*/g;
var pos = re.lastIndex = start++;
var match = re.exec(code)[0].match(RE_REGEX);