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" />
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;
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;
Function shrinkResult
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function shrinkResult(arbs, x, test, size, shrinksN, exc, transform) {
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) {
- Read upRead up
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 {
- Read upRead up
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;
- Read upRead up
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"