jsverify/jsverify

View on GitHub
lib/jsverify.js

Summary

Maintainability
C
1 day
Test Coverage

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

          Function check has a Cognitive Complexity of 6 (exceeds 5 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 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

          There are no issues that match your filters.

          Category
          Status