Showing 11 of 31 total issues
Function testWithOption
has 343 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function testWithOption (option) {
var assert = empower(baseAssert, fakeFormatter, option);
test('Bug reproduction. should not fail if argument is null Literal. ' + JSON.stringify(option), function () {
File empower_test.js
has 452 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['empower', 'espower', 'acorn', 'acorn-es7-plugin', 'babel', 'escodegen', 'assert'], factory);
Function empower
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
function empower (assert, formatter, options) {
var config = assign(defaultOptions(), options);
var eagerEvaluation = !(config.modifyMessageOnRethrow || config.saveContextOnRethrow);
// see: https://github.com/power-assert-js/empower/pull/26
var shouldRecreateAssertionError = (function isStackUnchanged () {
- 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
File empower_option_test.js
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['empower', 'assert'], factory);
} else if (typeof exports === 'object') {
Function testWithOption
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function testWithOption (option) {
var assert = empower(baseAssert, fakeFormatter, option);
test(JSON.stringify(option) + ' argument is null Literal.', function () {
Function empower
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function empower (assert, formatter, options) {
var config = assign(defaultOptions(), options);
var eagerEvaluation = !(config.modifyMessageOnRethrow || config.saveContextOnRethrow);
// see: https://github.com/power-assert-js/empower/pull/26
var shouldRecreateAssertionError = (function isStackUnchanged () {
Function sharedTestsForEmpowerFunctionReturnValue
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function sharedTestsForEmpowerFunctionReturnValue () {
test('has ok method', function () {
assert.equal(typeof this.empoweredAssert.ok, 'function');
});
test('has _capt method', function () {
Function onError
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function onError(e) {
try {
if (!e) {
return done(new Error('Assertion Error should be thrown'));
}
Function onError
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function onError(e) {
try {
if (!e) {
return done(new Error('Assertion Error should be thrown'));
}
Function capturable
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function capturable () {
var events = [];
function _capt (value, espath) {
events.push({value: value, espath: espath});
Function onError
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onError: function onError (errorEvent) {
var e = errorEvent.error;
if (!/^AssertionError/.test(e.name)) {
throw e;
}