alvaropinot/circular-iterator

View on GitHub

Showing 13 of 13 total issues

File es5-with-runtime.js has 512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright (c) 2014, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
Severity: Major
Found in es5-with-runtime.js - About 1 day to fix

    Function makeInvokeMethod has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function makeInvokeMethod(innerFn, self, context) {
        var state = GenStateSuspendedStart;
    
        return function invoke(method, arg) {
          if (state === GenStateExecuting) {
    Severity: Major
    Found in es5-with-runtime.js - About 2 hrs to fix

      Function invoke has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          return function invoke(method, arg) {
            if (state === GenStateExecuting) {
              throw new Error("Generator is already running");
            }
      
      
      Severity: Minor
      Found in es5-with-runtime.js - About 2 hrs to fix

        Function maybeInvokeDelegate has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function maybeInvokeDelegate(delegate, context) {
            var method = delegate.iterator[context.method];
            if (method === undefined) {
              // A .throw or .return when the delegate iterator has no .throw
              // method always terminates the yield* loop.
        Severity: Minor
        Found in es5-with-runtime.js - About 1 hr to fix

          Function dispatchException has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              dispatchException: function(exception) {
                if (this.done) {
                  throw exception;
                }
          
          
          Severity: Minor
          Found in es5-with-runtime.js - About 1 hr to fix

            Function circularIterator has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function circularIterator(arr) {
              var index, elements, length;
              return regeneratorRuntime.wrap(function circularIterator$(_context) {
                while (1) {
                  switch (_context.prev = _context.next) {
            Severity: Minor
            Found in es5-with-runtime.js - About 1 hr 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 circularIterator has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function circularIterator(arr) {
              var index, elements, length;
              return regeneratorRuntime.wrap(function circularIterator$(_context) {
                while (1) {
                  switch (_context.prev = _context.next) {
            Severity: Minor
            Found in es5.js - About 1 hr 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 AsyncIterator has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function AsyncIterator(generator) {
                function invoke(method, arg, resolve, reject) {
                  var record = tryCatch(generator[method], generator, arg);
                  if (record.type === "throw") {
                    reject(record.arg);
            Severity: Minor
            Found in es5-with-runtime.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                          if (this.prev < entry.catchLoc) {
                            return handle(entry.catchLoc, true);
                          }
              Severity: Major
              Found in es5-with-runtime.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          } else if (hasFinally) {
                            if (this.prev < entry.finallyLoc) {
                              return handle(entry.finallyLoc);
                            }
                
                
                Severity: Major
                Found in es5-with-runtime.js - About 45 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return ContinueSentinel;
                  Severity: Major
                  Found in es5-with-runtime.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                  return handle(entry.finallyLoc);
                    Severity: Major
                    Found in es5-with-runtime.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return info;
                      Severity: Major
                      Found in es5-with-runtime.js - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language