jsverify/jsverify

View on GitHub

Showing 28 of 52 total issues

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

function isApproxEqual(x, y, opts) {
  opts = opts || {};
  var fnEqual = opts.fnEqual !== false;
  var depth = opts.depth || 5; // totally arbitrary

Severity: Minor
Found in lib/utils.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 isEqual has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function isEqual(a, b) {
  var i;

  if (isNaN(a) && isNaN(b)) {
    return true;
Severity: Minor
Found in lib/utils.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

File jsverify.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* @flow weak */
/**
  # JSVerify

  <img src="https://raw.githubusercontent.com/jsverify/jsverify/master/jsverify-300.png" align="right" height="100" />
Severity: Minor
Found in lib/jsverify.js - About 2 hrs to fix

    Function forall has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function forall() {
      var args = Array.prototype.slice.call(arguments);
      var gens = args.slice(0, -1);
      var property = args[args.length - 1];
      var env;
    Severity: Minor
    Found in lib/jsverify.js - About 1 hr to fix

      Function isApproxEqual has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function isApproxEqual(x, y, opts) {
        opts = opts || {};
        var fnEqual = opts.fnEqual !== false;
        var depth = opts.depth || 5; // totally arbitrary
      
      
      Severity: Minor
      Found in lib/utils.js - About 1 hr to fix

        Function check has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function check(property, opts) {
          opts = opts || {};
          opts.size = opts.size || 50;
          opts.tests = opts.tests || 100;
          opts.quiet = opts.quiet || false;
        Severity: Minor
        Found in lib/jsverify.js - About 1 hr to fix

          Function loop has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function loop(a, b, n) {
              if (isNaN(a) && isNaN(b)) {
                return true;
              }
          
          
          Severity: Minor
          Found in lib/utils.js - About 1 hr to fix

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

            function suchthat(arb, userenv, predicate) {
              var env;
              if (arguments.length === 2) {
                predicate = userenv;
                env = environment;
            Severity: Minor
            Found in lib/suchthat.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 isEqual has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function isEqual(a, b) {
              var i;
            
              if (isNaN(a) && isNaN(b)) {
                return true;
            Severity: Minor
            Found in lib/utils.js - About 1 hr to fix

              Function suchthat has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function suchthat(arb, userenv, predicate) {
                var env;
                if (arguments.length === 2) {
                  predicate = userenv;
                  env = environment;
              Severity: Minor
              Found in lib/suchthat.js - About 1 hr to fix

                Function redundancyProp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function redundancyProp(input, output) {
                  var len = output.length;
                  for (var i = 0; i < len; i++) {
                    for (var j = 0; j < len; j++) {
                      if (i === j) {
                Severity: Minor
                Found in examples/set-cover-dsl/set-cover.js - About 55 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

                Function redundancyProp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function redundancyProp(input, output) {
                  var len = output.length;
                  for (var i = 0; i < len; i++) {
                    for (var j = 0; j < len; j++) {
                      if (i === j) {
                Severity: Minor
                Found in examples/set-cover/set-cover.js - About 55 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

                Function shrinkResult has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function shrinkResult(arbs, x, test, size, shrinksN, exc, transform) {
                Severity: Major
                Found in lib/jsverify.js - About 50 mins to fix

                  Function integer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var integer = numeric(function integer(maxsize) {
                    return {
                      generator: generator.bless(function (size) {
                        size = maxsize === undefined ? size : maxsize;
                        return random(-size, size);
                  Severity: Minor
                  Found in lib/primitive.js - About 45 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

                  Function formatFailedCase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function formatFailedCase(r, state, includeStack) {
                    var msg = "Failed after " + r.tests + " tests and " + r.shrinks + " shrinks. ";
                    msg += "rngState: " + (r.rngState || state) + "; ";
                    msg += "Counterexample: " + r.counterexamplestr + "; ";
                    if (r.exc) {
                  Severity: Minor
                  Found in lib/jsverify.js - About 45 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

                  Function throws has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function throws(block, error, message) {
                    assert(error === undefined || typeof error === "function", "throws: error parameter must be a constructor");
                    assert(message === undefined || typeof message === "string", "throws: message parameter must be a string");
                  
                    try {
                  Severity: Minor
                  Found in lib/jsverify.js - About 45 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

                  Avoid too many return statements within this function.
                  Open

                      return false;
                  Severity: Major
                  Found in lib/utils.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return true;
                    Severity: Major
                    Found in lib/utils.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return false;
                      Severity: Major
                      Found in lib/utils.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return true;
                        Severity: Major
                        Found in lib/utils.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language