SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js

Summary

Maintainability
F
4 days
Test Coverage

Function jsep has 332 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        jsep = function(expr) {
            // `index` stores the character number we are currently at while `length` is a constant
            // All of the gobbles below will modify `index` as we move along
            var index = 0,
                charAtFunc = expr.charAt,
Severity: Major
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 day to fix

File jsep.js has 469 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//     JavaScript Expression Parser (JSEP) 0.3.1
//     JSEP may be freely distributed under the MIT License
//     http://jsep.from.so/

/*global module: true, exports: true, console: true */
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 7 hrs to fix

Function gobbleVariable has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                gobbleVariable = function() {
                    var ch_i, node;
                    ch_i = exprICode(index);
                        
                    if(ch_i === OPAREN_CODE) {
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 hr to fix

Function gobbleBinaryExpression has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                gobbleBinaryExpression = function() {
                    var ch_i, node, biop, prec, stack, biop_info, left, right, i;

                    // First, try to get the leftmost thing
                    // Then, check to see if there's a binary operator operating on that leftmost thing
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 hr to fix

Function gobbleNumericLiteral has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                gobbleNumericLiteral = function() {
                    var number = '', ch, chCode;
                    while(isDecimalDigit(exprICode(index))) {
                        number += exprI(index++);
                    }
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 hr to fix

Function gobbleStringLiteral has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                gobbleStringLiteral = function() {
                    var str = '', quote = exprI(index++), closed = false, ch;

                    while(index < length) {
                        ch = exprI(index++);
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 hr to fix

Function gobbleIdentifier has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                gobbleIdentifier = function() {
                    var ch = exprICode(index), start = index, identifier;

                    if(isIdentifierStart(ch)) {
                        index++;
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 hr to fix

Function gobbleToken has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                gobbleToken = function() {
                    var ch, to_check, tc_len;
                    
                    gobbleSpaces();
                    ch = exprICode(index);
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 hr to fix

Function gobbleExpression has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                gobbleExpression = function() {
                    var test = gobbleBinaryExpression(),
                        consequent, alternate;
                    gobbleSpaces();
                    if(exprICode(index) === QUMARK_CODE) {
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 1 hr to fix

Avoid too many return statements within this function.
Open

                                return {
                                    type: UNARY_EXP,
                                    operator: to_check,
                                    argument: gobbleToken(),
                                    prefix: true
Severity: Major
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return false;
Severity: Major
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js - About 30 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    jsep.removeUnaryOp = function(op_name) {
        delete unary_ops[op_name];
        if(op_name.length === max_unop_len) {
            max_unop_len = getMaxKeyLen(unary_ops);
        }
de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js on lines 609..615

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    jsep.removeBinaryOp = function(op_name) {
        delete binary_ops[op_name];
        if(op_name.length === max_binop_len) {
            max_binop_len = getMaxKeyLen(binary_ops);
        }
de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js on lines 596..602

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            return (ch === 36) || (ch === 95) || // `$` and `_`
                    (ch >= 65 && ch <= 90) || // A...Z
                    (ch >= 97 && ch <= 122) || // a...z
                    (ch >= 128 && !binary_ops[String.fromCharCode(ch)]); // any non-ASCII that is not an operator
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js and 1 other location - About 45 mins to fix
de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js on lines 111..114

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            return (ch === 36) || (ch === 95) || // `$` and `_`
                    (ch >= 65 && ch <= 90) || // A...Z
                    (ch >= 97 && ch <= 122) || // a...z
                    (ch >= 48 && ch <= 57) || // 0...9
Severity: Minor
Found in de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js and 1 other location - About 45 mins to fix
de.bund.bfr.knime.pmm.nodes/js-lib/jsep/0_3_1/debug/js/jsep.js on lines 105..108

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status