LivePersonInc/chronosjs

View on GitHub

Showing 34 of 71 total issues

Function _handleResult has 31 lines of code (exceeds 25 allowed). Consider refactoring.
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
Severity: Minor
Found in src/courier/PostMessageCourier.js - About 1 hr to fix

    Function unbind has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function unbind(eventObj) {
            var cmdName = eventObj.unbindObj[eventObj.attrName];
            var unBound = false;
            var updatedListeners;
    
    
    Severity: Minor
    Found in src/util/EventsUtil.js - About 1 hr to fix

      Function cloneEventData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function cloneEventData(cloneObj) {
              var resultObj = {};
              if (cloneObj.constructor === Object) {//If this is an object
                  for (var key in cloneObj) {
                      //noinspection JSUnfilteredForInLoop
      Severity: Minor
      Found in src/util/EventsUtil.js - About 1 hr to fix

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

            function resolveOrigin(target, top, hostParam) {
                var origin;
                var url;
                var ref;
        
        
        Severity: Minor
        Found in src/courier/PostMessageUtilities.js - About 1 hr to fix

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

                  function _kickStartHandshake(handler, handleMessage) {
                      var initiated;
                      try {
                          initiated = _handshake.call(this);
                      }
          Severity: Minor
          Found in src/courier/PostMessageChannel.js - About 1 hr to fix

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

                function _unbind(listeners, func, context, appName) {
                    var newListeners = [];
                    if (listeners && listeners.length) {
                        for (var i = 0; i < listeners.length; i++) {
                            try {
            Severity: Minor
            Found in src/util/EventsUtil.js - About 1 hr to fix

              Function exports has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function (grunt, options) {
                  const path = require('path');
              
                  return {
                      release: {
              Severity: Minor
              Found in build/concat_in_order.js - About 1 hr to fix

                Function initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function initialize(options, onmessage) {
                            var handleMessage;
                            var handler;
                
                            if (!this.initialized) {
                Severity: Minor
                Found in src/courier/PostMessageChannel.js - About 1 hr to fix

                  Function dispose has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function dispose() {
                              if (!this.disposed) {
                                  if (this.removeListener) {
                                      this.removeListener.call(this);
                                      this.removeListener = void 0;
                  Severity: Minor
                  Found in src/courier/PostMessageChannel.js - About 1 hr to fix

                    Function _onReady has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function _onReady() {
                                if (!this.disposed && !this.ready) {
                                    this.ready = true;
                    
                                    // Handshake was successful, Channel is ready for messages
                    Severity: Minor
                    Found in src/courier/PostMessageChannel.js - About 1 hr to fix

                      Function middleware has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      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/');
                      Severity: Minor
                      Found in build/connect.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

                      Avoid deeply nested control flow statements.
                      Open

                                              if (cloneObj[key].constructor === Array) {
                                                  //noinspection JSUnfilteredForInLoop
                                                  resultObj[key] = cloneObj[key].slice(0) || [];
                                              }
                                              else { //noinspection JSUnfilteredForInLoop
                      Severity: Major
                      Found in src/util/EventsUtil.js - About 45 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                            if (_isHandshake.call(this, message) && !this.disposed && !this.hosted && !this.ready) {
                                                _onReady.call(this);
                                            }
                                            else {
                                                try {
                        Severity: Major
                        Found in src/courier/PostMessageChannel.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          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
                          Severity: Major
                          Found in src/courier/PostMessageChannel.js - About 40 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language