zammad/zammad

View on GitHub
app/assets/javascripts/app/lib/base/linkify.js

Summary

Maintainability
F
3 wks
Test Coverage

Function linkify has 2298 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var linkify = (function (exports) {
    'use strict';

    /**
     * Finite State Machine generation utilities
Severity: Major
Found in app/assets/javascripts/app/lib/base/linkify.js - About 1 wk to fix

    File linkify.js has 2370 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * Linkify v3.0.5
     * https://github.com/Hypercontext/linkifyjs
     * Copyright (c) 2021 SoapBox Innovations Inc.; Licensed MIT
     *
    Severity: Major
    Found in app/assets/javascripts/app/lib/base/linkify.js - About 6 days to fix

      Function linkify has a Cognitive Complexity of 174 (exceeds 5 allowed). Consider refactoring.
      Open

      var linkify = (function (exports) {
          'use strict';
      
          /**
           * Finite State Machine generation utilities
      Severity: Minor
      Found in app/assets/javascripts/app/lib/base/linkify.js - About 3 days 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 init$1 has 139 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function init$1() {
            // The universal starting state.
            var S_START = makeState(); // Intermediate states for URLs. Note that domains that begin with a protocol
            // are treated slighly differently from those that don't.
      
      
      Severity: Major
      Found in app/assets/javascripts/app/lib/base/linkify.js - About 5 hrs to fix

        Function linkifyStr has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        var linkifyStr = (function (linkifyjs) {
            'use strict';
        
            /**
                Convert strings of text into linkable HTML text
        Severity: Minor
        Found in app/assets/javascripts/app/lib/base/linkify.js - About 4 hrs 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 init$2 has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function init$2() {
              var customProtocols = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
              // Frequently used states
              var S_START = makeState();
              var S_NUM = makeAcceptingState(NUM);
        Severity: Major
        Found in app/assets/javascripts/app/lib/base/linkify.js - About 2 hrs to fix

          Function linkifyStr has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var linkifyStr = (function (linkifyjs) {
              'use strict';
          
              /**
                  Convert strings of text into linkable HTML text
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/linkify.js - About 2 hrs to fix

            Function run has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function run(start, input, tokens) {
                  var len = tokens.length;
                  var cursor = 0;
                  var multis = [];
                  var textTokens = [];
            Severity: Minor
            Found in app/assets/javascripts/app/lib/base/linkify.js - About 1 hr to fix

              Function run$1 has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function run$1(start, str) {
                    // State machine is not case sensitive, so input is tokenized in lowercased
                    // form (still returns the regular case though) Uses selective `toLowerCase`
                    // is used because lowercasing the entire string causes the length and
                    // character position to vary in some non-English strings with V8-based
              Severity: Minor
              Found in app/assets/javascripts/app/lib/base/linkify.js - About 1 hr to fix

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

                    function linkifyStr(str) {
                      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
                      opts = new linkifyjs.Options(opts);
                      var tokens = linkifyjs.tokenize(str);
                      var result = [];
                Severity: Minor
                Found in app/assets/javascripts/app/lib/base/linkify.js - About 1 hr to fix

                  There are no issues that match your filters.

                  Category
                  Status