open-wa/whatsapp-button

View on GitHub

Showing 19 of 21 total issues

Function runtime has a Cognitive Complexity of 232 (exceeds 5 allowed). Consider refactoring.
Open

var runtime = (function (exports) {
  "use strict";

  var Op = Object.prototype;
  var hasOwn = Op.hasOwnProperty;

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 runtime has 486 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var runtime = (function (exports) {
  "use strict";

  var Op = Object.prototype;
  var hasOwn = Op.hasOwnProperty;

    File regenerator-runtime.de2e6a3a74a500cae72a3cab1a403efc.js has 500 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Copyright (c) 2014-present, Facebook, Inc.
     *
     * This source code is licensed under the MIT license found in the
     * LICENSE file in the root directory of this source tree.

      Function styles has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static get styles() {
          return css`
            :host {
              display: flex;
              flex-direction: column;
      Severity: Major
      Found in src/WhatsappButton.ts - About 2 hrs 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) {

          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");
                }
          
          

            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.

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

                  dispatchException: function(exception) {
                    if (this.done) {
                      throw exception;
                    }
              
              

                Function AsyncIterator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function AsyncIterator(generator, PromiseImpl) {
                    function invoke(method, arg, resolve, reject) {
                      var record = tryCatch(generator[method], generator, arg);
                      if (record.type === "throw") {
                        reject(record.arg);

                  Function loadingDialog has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    loadingDialog() {
                      if (this.shadowRoot) {
                        this.shadowRoot.innerHTML += `<vaadin-dialog >
                      </vaadin-dialog>`;
                        const dialog: any = this.shadowRoot.querySelector('vaadin-dialog') as any;
                  Severity: Minor
                  Found in src/WhatsappButton.ts - 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 firstUpdated has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    firstUpdated() {
                      this.label = this.label || this.invitecode ? 'Join Group!' : `Let's chat`;
                      this.phone = this.phone || ``;
                      this.text = this.text || `Hi!`;
                      const pre = this.invitecode
                  Severity: Minor
                  Found in src/WhatsappButton.ts - About 1 hr to fix

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

                      loadingDialog() {
                        if (this.shadowRoot) {
                          this.shadowRoot.innerHTML += `<vaadin-dialog >
                        </vaadin-dialog>`;
                          const dialog: any = this.shadowRoot.querySelector('vaadin-dialog') as any;
                    Severity: Minor
                    Found in src/WhatsappButton.ts - About 1 hr to fix

                      Function firstUpdated has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        firstUpdated() {
                          this.label = this.label || this.invitecode ? 'Join Group!' : `Let's chat`;
                          this.phone = this.phone || ``;
                          this.text = this.text || `Hi!`;
                          const pre = this.invitecode
                      Severity: Minor
                      Found in src/WhatsappButton.ts - 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 (this.prev < entry.catchLoc) {
                                    return handle(entry.catchLoc, true);
                                  }

                        Avoid deeply nested control flow statements.
                        Open

                                  } else if (hasFinally) {
                                    if (this.prev < entry.finallyLoc) {
                                      return handle(entry.finallyLoc);
                                    }
                        
                        

                          Function async has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {

                            Avoid too many return statements within this function.
                            Open

                                  return info;

                              Avoid too many return statements within this function.
                              Open

                                            return handle(entry.finallyLoc);

                                Avoid too many return statements within this function.
                                Open

                                    return ContinueSentinel;
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language