Showing 34 of 71 total issues
Function _handleResult
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _handleResult(id, name, result, message) {
var retMsg;
var params;
// If the result is async (promise) we need to defer the execution of the results data
Function unbind
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function unbind(eventObj) {
var cmdName = eventObj.unbindObj[eventObj.attrName];
var unBound = false;
var updatedListeners;
Function cloneEventData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function cloneEventData(cloneObj) {
var resultObj = {};
if (cloneObj.constructor === Object) {//If this is an object
for (var key in cloneObj) {
//noinspection JSUnfilteredForInLoop
Function resolveOrigin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function resolveOrigin(target, top, hostParam) {
var origin;
var url;
var ref;
Function _kickStartHandshake
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _kickStartHandshake(handler, handleMessage) {
var initiated;
try {
initiated = _handshake.call(this);
}
Function _unbind
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _unbind(listeners, func, context, appName) {
var newListeners = [];
if (listeners && listeners.length) {
for (var i = 0; i < listeners.length; i++) {
try {
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (grunt, options) {
const path = require('path');
return {
release: {
Function initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initialize(options, onmessage) {
var handleMessage;
var handler;
if (!this.initialized) {
Function dispose
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dispose() {
if (!this.disposed) {
if (this.removeListener) {
this.removeListener.call(this);
this.removeListener = void 0;
Function _onReady
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _onReady() {
if (!this.disposed && !this.ready) {
this.ready = true;
// Handshake was successful, Channel is ready for messages
Function middleware
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
middleware: (connect, options, middlewares) => {
// inject a custom middleware into the array of default middlewares - this middleware captures the coverage report generated by istanbul
middlewares.unshift((req, res, next) => {
if (req && req.method === 'POST') {
mkdirp.sync('test/coverage/reports/');
- 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
Avoid deeply nested control flow statements. Open
Open
if (cloneObj[key].constructor === Array) {
//noinspection JSUnfilteredForInLoop
resultObj[key] = cloneObj[key].slice(0) || [];
}
else { //noinspection JSUnfilteredForInLoop
Consider simplifying this complex logical expression. Open
Open
if (_isHandshake.call(this, message) && !this.disposed && !this.hosted && !this.ready) {
_onReady.call(this);
}
else {
try {
Consider simplifying this complex logical expression. Open
Open
if (!options.target || (options.target !== root || options.target === root.top) && "undefined" !== typeof Window && options.target instanceof Window) {
this.hosted = true;
this.target = options.target || root.top;
}
else if (options.target.contentWindow) { // We've got a reference to an "external" iframe