aureooms/js-convex-hull-2d

View on GitHub

Showing 28 of 28 total issues

Function _n4 has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

const _n4 = function ( { col , pit } , points , take ) {

    const n = points.length;

    for ( let i = 0 ; i < n ; ++i ) {
Severity: Minor
Found in js/src/0-core/algorithm/_n4.js - About 5 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

const argmin = function ( compare, a, i, j ) {

    var k, key, tmp;

    if ( i >= j ) return undefined ;
Severity: Major
Found in js/src/0-core/lib/array/argmin.js and 1 other location - About 4 hrs to fix
js/src/0-core/lib/array/argmax.js on lines 1..22

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

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

const argmax = function ( compare, a, i, j ) {

    var k, key, tmp;

    if ( i >= j ) return undefined ;
Severity: Major
Found in js/src/0-core/lib/array/argmax.js and 1 other location - About 4 hrs to fix
js/src/0-core/lib/array/argmin.js on lines 1..22

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

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

const _n2 = function ( { crs , dot } , points , take ) {

    const n = points.length ;

    each : for ( let j = 0 ; j < n ; ++j ) {
Severity: Minor
Found in js/src/0-core/algorithm/_n2.js - About 4 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 ch_online_add has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

var ch_online_add = function(ch, p){
    if(ch.length == 0){
        ch.push(p);
        return;
    }
Severity: Minor
Found in js/src/0-core/algorithm/_online.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 qhull has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

const qhull = function* ( crs , lex , set , i , j , u , v , w ) {

    let l = i - 1 ;
    let r = j - 1 ;
    let e = r ;
Severity: Minor
Found in js/src/0-core/algorithm/qhull.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 _n3 has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

const _n3 = function ( { crs , dot } , points , take ) {

    const n = points.length ;

    for ( let i = 0 ; i < n ; ++i ) {
Severity: Minor
Found in js/src/0-core/algorithm/_n3.js - About 2 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 qhull has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const qhull = function* ( crs , lex , set , i , j , u , v , w ) {

    let l = i - 1 ;
    let r = j - 1 ;
    let e = r ;
Severity: Major
Found in js/src/0-core/algorithm/qhull.js - About 2 hrs to fix

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

        if ( R !== -1 ) {
    
            const tmp = set[R] ;
            set[R] = set[l] ;
            set[l] = tmp ;
    Severity: Major
    Found in js/src/0-core/algorithm/qhull.js and 1 other location - About 1 hr to fix
    js/src/0-core/algorithm/qhull.js on lines 103..111

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

    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 ( L !== -1 ) {
    
            const tmp = set[L] ;
            set[L] = set[i] ;
            set[i] = tmp ;
    Severity: Major
    Found in js/src/0-core/algorithm/qhull.js and 1 other location - About 1 hr to fix
    js/src/0-core/algorithm/qhull.js on lines 115..123

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

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

    var ch_online_add = function(ch, p){
        if(ch.length == 0){
            ch.push(p);
            return;
        }
    Severity: Minor
    Found in js/src/0-core/algorithm/_online.js - About 1 hr to fix

      Function binary_ext_sin_search has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      var binary_ext_sin_search = function(ch, l, r, o, p){
          var i = o;
          while(l < r){
              i = Math.floor((r - l) / 2) + l;
              var p_i = (i - 1) < 0 ? ch.length - 1: i - 1;
      Severity: Minor
      Found in js/src/0-core/algorithm/_online.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 jmarch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      const jmarch = function* ( crs , dot , points ) {
      
          const n = points.length ;
          const origin = points[0] ;
      
      
      Severity: Minor
      Found in js/src/0-core/algorithm/jmarch.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 qhull has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      const qhull = function* ( crs , lex , set , i , j , u , v , w ) {
      Severity: Major
      Found in js/src/0-core/algorithm/qhull.js - About 1 hr to fix

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

                while ( q >= 0 && crs( lo[q] , lo[q + 1] , u ) <= 0 ) {
                    lo.pop() ;
                    --q ;
                }
        Severity: Major
        Found in js/src/0-core/algorithm/gscanmono.js and 2 other locations - About 50 mins to fix
        js/src/0-core/algorithm/gscan.js on lines 20..23
        js/src/0-core/algorithm/gscanmono.js on lines 36..39

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

        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 3 locations. Consider refactoring.
        Open

                while ( p >= 0 && crs( hi[p] , hi[p + 1] , u ) >= 0 ) {
                    hi.pop() ;
                    --p ;
                }
        Severity: Major
        Found in js/src/0-core/algorithm/gscanmono.js and 2 other locations - About 50 mins to fix
        js/src/0-core/algorithm/gscan.js on lines 20..23
        js/src/0-core/algorithm/gscanmono.js on lines 44..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 52.

        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 3 locations. Consider refactoring.
        Open

                while ( p >= 0 && crs( hull[p] , hull[p + 1] , u ) <= 0 ) {
                    hull.pop( ) ;
                    --p ;
                }
        Severity: Major
        Found in js/src/0-core/algorithm/gscan.js and 2 other locations - About 50 mins to fix
        js/src/0-core/algorithm/gscanmono.js on lines 36..39
        js/src/0-core/algorithm/gscanmono.js on lines 44..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 52.

        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

        Avoid deeply nested control flow statements.
        Open

                        if ( cos < 0 ) {
                            take[j] = false ;
                            continue each ;
                        }
        Severity: Major
        Found in js/src/0-core/algorithm/_n2.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if ( x === i || x === j || x === k || !take[x] ) continue ;
          Severity: Major
          Found in js/src/0-core/algorithm/_n4.js - About 45 mins to fix

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

                    if(p.x < ch[0] || (p.x == ch[0] && p.y < ch[0].y)) ch.splice(0, 0, p);
                    else if(sin_sign(ch[0], ch[1], p) > 0) ch.splice(1, 0, p);
                    else ch.push(p);
            Severity: Minor
            Found in js/src/0-core/algorithm/_online.js and 1 other location - About 45 mins to fix
            js/src/0-core/algorithm/_online.js on lines 32..33

            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

            Severity
            Category
            Status
            Source
            Language