fossasia/loklak_webclient

View on GitHub
iframely/lib/plugins/system/meta/HTMLMetaHandler.js

Summary

Maintainability
F
5 days
Test Coverage

Function onopentag has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

HTMLMetaHandler.prototype.onopentag = function(name, attributes) {

    if (this._end) return;

    name = name.toUpperCase();
Severity: Minor
Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 1 day 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 _finalMerge has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

HTMLMetaHandler.prototype._finalMerge = function() {

    this._end = true;

    var that = this;
Severity: Minor
Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 1 day 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 merge has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function merge(parentObj, props, value) {

    /*
    Test urls:
     http://www.travelchannel.com/video/its-a-real-life-video-game
Severity: Minor
Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 3 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

File HTMLMetaHandler.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var decodeHTML5 = require('entities').decodeHTML5;
var _ = require('underscore');
var url = require('url');

var utils = require('../../../utils');
Severity: Minor
Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 3 hrs to fix

    Function onopentag has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    HTMLMetaHandler.prototype.onopentag = function(name, attributes) {
    
        if (this._end) return;
    
        name = name.toUpperCase();
    Severity: Major
    Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 3 hrs to fix

      Function merge has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function merge(parentObj, props, value) {
      
          /*
          Test urls:
           http://www.travelchannel.com/video/its-a-real-life-video-game
      Severity: Major
      Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 3 hrs to fix

        Function _finalMerge has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        HTMLMetaHandler.prototype._finalMerge = function() {
        
            this._end = true;
        
            var that = this;
        Severity: Major
        Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 3 hrs to fix

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

              function _buildChildren(children, obj) {
          
                  var current = obj;
          
                  children.forEach(function(child) {
          Severity: Minor
          Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (v) {
                                        item[i] = v;
                                    }
            Severity: Major
            Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if (type) {
                                  property.type = type;
                              }
              Severity: Major
              Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                if (sizes) {
                                    property.sizes = sizes;
                                }
                Severity: Major
                Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  if (title) {
                                      property.title = title;
                                  }
                  Severity: Major
                  Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if (media) {
                                        property.media = media;
                                    }
                    Severity: Major
                    Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 45 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status