abtExp/vecto

View on GitHub

Showing 46 of 48 total issues

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

module.exports = function(arr, axis = null) {
    const shape = arr.shape || calcShape(arr);

    arr = arr.data || flatten(arr);

Severity: Major
Found in util/argmin.js and 1 other location - About 1 day to fix
util/argmax.js on lines 7..43

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 328.

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

module.exports = function(arr, axis = null) {
    const shape = arr.shape || calcShape(arr);

    arr = arr.data || flatten(arr);

Severity: Major
Found in util/argmax.js and 1 other location - About 1 day to fix
util/argmin.js on lines 7..43

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 328.

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

    } else if (ev.keyCode === 38) {
      // arrow up
      var current = result.children[selectedIndex];
      var selected = result.children[selectedIndex - 1];
      if (selected && selected.classList.contains('search-separator')) {
Severity: Major
Found in docs/script/search.js and 1 other location - About 4 hrs to fix
docs/script/search.js on lines 51..88

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 133.

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

    if (ev.keyCode === 40) {
      // arrow down
      var current = result.children[selectedIndex];
      var selected = result.children[selectedIndex + 1];
      if (selected && selected.classList.contains('search-separator')) {
Severity: Major
Found in docs/script/search.js and 1 other location - About 4 hrs to fix
docs/script/search.js on lines 65..88

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 133.

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

Function min has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function min({ ar1, ar2 = null, axis = 0 }) {
    let minElems = [];
    if (ar2 === null) {
        let shape = calcShape(ar1),
            elems = axisOps(shape, axis);
Severity: Minor
Found in util/min.js - About 3 hrs to fix

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

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

    if (Array.isArray(max_val)) {
        f2 = true;
        if (calcShape(max_val).toString() === a_shape.toString()) {
            max = flatten(max_val);
        } else throw new Error(`Uneven shape : arg1 is ${a_shape}, given shape ${calcShape(min_val)}`);
Severity: Major
Found in lib/clip.js and 1 other location - About 3 hrs to fix
lib/clip.js on lines 31..38

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 102.

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

    if (Array.isArray(min_val)) {
        f1 = true;
        if (calcShape(min_val).toString() === a_shape.toString()) {
            min = flatten(min_val);
        } else throw new Error(`Uneven shape : arg1 is ${a_shape}, given shape ${calcShape(min_val)}`);
Severity: Major
Found in lib/clip.js and 1 other location - About 3 hrs to fix
lib/clip.js on lines 40..47

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 102.

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

Function fill has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function fill(shape, initializer = 'linear', ...args) {
    const { calcSize, arrange } = require('./core');
    initializer = initializer || 'zeros';
    let arr = [],
        size = calcSize(shape, 'shape');
Severity: Minor
Found in lib/fill.js - About 3 hrs to fix

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 max has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function max({ ar1, ar2 = null, axis = 0 }) {
    let maxElems = [],
        opShape = [];

    if (ar2 === null) {
Severity: Minor
Found in util/max.js - About 3 hrs to fix

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 fill has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

module.exports = function fill(shape, initializer = 'linear', ...args) {
    const { calcSize, arrange } = require('./core');
    initializer = initializer || 'zeros';
    let arr = [],
        size = calcSize(shape, 'shape');
Severity: Minor
Found in lib/fill.js - About 1 hr to fix

    Function clip has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function clip(arr, min_val, max_val) {
        const { arrange, calcShape, flatten } = require('./core');
        let a = flatten(arr),
            min = [],
            max = [],
    Severity: Minor
    Found in lib/clip.js - About 1 hr to fix

    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

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

            for (let i = 0; i < array.length; i++) {
                if ((array[i] > min) && (array[i] < max)) {
                    min = array[i];
                    maxIdx = i;
                }
    Severity: Major
    Found in util/maxK.js and 1 other location - About 1 hr to fix
    util/minK.js on lines 19..24

    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 72.

    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

            for (let i = 0; i < data.length; i++) {
                if ((data[i] > min) && (data[i] < max)) {
                    max = data[i];
                    maxIdx = i;
                }
    Severity: Major
    Found in util/minK.js and 1 other location - About 1 hr to fix
    util/maxK.js on lines 19..24

    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 72.

    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

    Function exports has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function(arr, axis = null) {
        const shape = arr.shape || calcShape(arr);
    
        arr = arr.data || flatten(arr);
    
    
    Severity: Minor
    Found in util/argmin.js - About 1 hr to fix

    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 exports has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function(arr, axis = null) {
        const shape = arr.shape || calcShape(arr);
    
        arr = arr.data || flatten(arr);
    
    
    Severity: Minor
    Found in util/argmax.js - About 1 hr to fix

    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 sum has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function sum(arr1, arr2 = null, axis = 0) {
        let ar1 = flatten(arr1),
            ar2 = arr2 !== null ? flatten(arr2) : null,
            s1 = calcShape(arr1),
            s2 = ar2 ? calcShape(arr2) : null,
    Severity: Minor
    Found in util/sum.js - About 1 hr to fix

    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 clip has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function clip(arr, min_val, max_val) {
        const { arrange, calcShape, flatten } = require('./core');
        let a = flatten(arr),
            min = [],
            max = [],
    Severity: Minor
    Found in lib/clip.js - About 1 hr to fix

      Function exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = (shape, axis) => {
          let nComp = axis < shape.length - 1 ? shape[shape.length - 1] : 1,
              jumpLen = 1,
              inc = 1,
              j = 0,
      Severity: Minor
      Found in util/axisOps.js - About 1 hr to fix

      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 exports has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = (shape, axis) => {
          let nComp = axis < shape.length - 1 ? shape[shape.length - 1] : 1,
              jumpLen = 1,
              inc = 1,
              j = 0,
      Severity: Minor
      Found in util/axisOps.js - About 1 hr to fix

        Function exports has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = (s1, s2, ar1, ar2, dtype = 'float32') => {
            ar1 = formArr(ar1, dtype);
            ar2 = formArr(ar2, dtype);
            let r1 = s1[0],
                c1 = s1[1],
        Severity: Minor
        Found in util/matmul.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language