aureooms/js-prime

View on GitHub

Showing 11 of 17 total issues

Function __eratosthenes23__ has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

export function __eratosthenes23__(alloc, fill, get, gothrough, usqrt) {
    const first = 5;

    const eratosthenes23 = function (n, callback) {
        let j;
Severity: Minor
Found in src/sieve/eratosthenes23.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

Function __eratosthenes23__ has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function __eratosthenes23__(alloc, fill, get, gothrough, usqrt) {
    const first = 5;

    const eratosthenes23 = function (n, callback) {
        let j;
Severity: Major
Found in src/sieve/eratosthenes23.js - About 2 hrs to fix

    Function eratosthenes23 has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const eratosthenes23 = function (n, callback) {
            let j;
            let p;
            let l;
    
    
    Severity: Major
    Found in src/sieve/eratosthenes23.js - About 2 hrs to fix

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

      export function __eratosthenes2__(alloc, fill, get, gothrough, usqrt) {
          const first = 3;
      
          const eratosthenes2 = function (n, callback) {
              if (n <= 2) {
      Severity: Minor
      Found in src/sieve/eratosthenes2.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 __eratosthenes__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export function __eratosthenes__(alloc, fill, get, gothrough, usqrt) {
          const first = 2;
      
          const eratosthenes = function (n, callback) {
              if (n <= 2) {
      Severity: Minor
      Found in src/sieve/eratosthenes.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 __eratosthenes2__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function __eratosthenes2__(alloc, fill, get, gothrough, usqrt) {
          const first = 3;
      
          const eratosthenes2 = function (n, callback) {
              if (n <= 2) {
      Severity: Minor
      Found in src/sieve/eratosthenes2.js - About 1 hr to fix

        Function stoa has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function stoa(i, n) {
            let line = (i / n) | 0;
            let col = i % n;
        
            if (n % 2 === 0) {
        Severity: Minor
        Found in src/ulam/stoa.js - About 1 hr to fix

          Function __eratosthenes__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          export function __eratosthenes__(alloc, fill, get, gothrough, usqrt) {
          Severity: Minor
          Found in src/sieve/eratosthenes.js - About 35 mins to fix

            Function __eratosthenes23__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export function __eratosthenes23__(alloc, fill, get, gothrough, usqrt) {
            Severity: Minor
            Found in src/sieve/eratosthenes23.js - About 35 mins to fix

              Function __eratosthenes2__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export function __eratosthenes2__(alloc, fill, get, gothrough, usqrt) {
              Severity: Minor
              Found in src/sieve/eratosthenes2.js - About 35 mins to fix

                Function atos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                export function atos(i, n) {
                    const s = Math.sqrt(i) | 0;
                    const l = s;
                    const r = s + 1;
                    const L = l * l;
                Severity: Minor
                Found in src/ulam/atos.js - About 25 mins 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

                Severity
                Category
                Status
                Source
                Language