fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Function makeMediaResponsive has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function makeMediaResponsive(link) {
    if (!link.media) {
        link.media = {};
    }

Severity: Minor
Found in iframely/lib/plugins/validators/media.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 generateLinksHtml has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

exports.generateLinksHtml = function(data, options) {

    // Links may be grouped.

    var links = data.links;
Severity: Minor
Found in iframely/lib/utils.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 getData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    getData: function(url, oembedLinks, options, cb) {

        var href = oembedLinks[0].href;

        var skip = false, self_endpoint = false;
Severity: Minor
Found in iframely/lib/plugins/system/oembed/oembed.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 link has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    link: function(s, e, a, c){
      var ref$, btntype, that;
      if (!e.hasClass('ui')) {
        e.addClass('btn');
      }
Severity: Minor
Found in app/js/components/ui-choices.js - About 1 hr to fix

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

      function _handleDropDownSelection(key) {
        var processed = true;
        switch (key) {
          case KEY.DOWN:
            if (!ctrl.open && ctrl.multiple) ctrl.activate(false, true); //In case its the search input in 'multiple' mode
    Severity: Minor
    Found in app/js/components/select.js - About 1 hr to fix

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

              function h(e, r) {
                  if (k += e,
                  void 0 === r)
                      return D += f(),
                      0;
      Severity: Minor
      Found in app/js/components/highlight.js - About 1 hr to fix

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

                    year: function year(unixDate) {
                      var selectedDate = moment.utc(unixDate).startOf('year');
                      // View starts one year before the decade starts and ends one year after the decade ends
                      // i.e. passing in a date of 1/1/2013 will give a range of 2009 to 2020
                      // Truncate the last digit from the current year and subtract 1 to get the start of the decade
        Severity: Minor
        Found in app/js/components/datetimepicker.js - About 1 hr to fix

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

              function formatFile(o, headers, req) {
          
                  if (typeof o !== 'object' ||
                      (typeof Blob !== 'undefined' && o instanceof Blob) ||
                      (typeof ArrayBuffer !== 'undefined' && o instanceof ArrayBuffer)) {
          Severity: Minor
          Found in app/js/components/hello.all.js - About 1 hr to fix

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

                    removeEventListener: function(t, e, i) {
                        if (!this[s])
                            return this;
                        if (!t)
                            return this.clearAllEventListeners();
            Severity: Minor
            Found in app/js/components/leaflet.js - About 1 hr to fix

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

                      _onDragEnd: function(t) {
                          var e = this._map
                            , i = e.options
                            , n = +new Date - this._lastTime
                            , s = !i.inertia || n > i.inertiaThreshold || !this._positions[0];
              Severity: Minor
              Found in app/js/components/leaflet.js - About 1 hr to fix

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

                                function loadLogs(sets, cb) {
                
                                    var pluginTestsDict = _.object(pluginTests.map(function(p) { return [p._id, p]; }));
                
                                    async.eachSeries(sets.filter(function(s) {return s;}), function(s, cb) {
                Severity: Minor
                Found in iframely/modules/tests-ui/views.js - About 1 hr to fix

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

                  exports.fetchUrlsByPageOnFeed = function(pageWithFeed, otpions, cb) {
                  
                      if (typeof options === "function") {
                          cb = options;
                          options = {};
                  Severity: Minor
                  Found in iframely/modules/tests-ui/utils.js - About 1 hr 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

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

                                  minute: function minute(unixDate) {
                                    var selectedDate = moment.utc(unixDate).startOf('hour');
                                    var previousViewDate = moment.utc(selectedDate).startOf('day');
                                    var activeFormat = ngModelController.$modelValue ? moment(ngModelController.$modelValue).format('YYYY-MM-DD H:mm') : '';
                      
                      
                      Severity: Minor
                      Found in app/js/components/datetimepicker.js - About 1 hr to fix

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

                            function addListenersOnMap() {
                                window.map.on("zoomend", function(event) {
                                    if (!prevZoomAction) {
                                        prevZoomAction = new Date();
                                        getMoreLocationOnMapAction();
                        Severity: Minor
                        Found in app/js/controllers/search.js - About 1 hr to fix

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

                                  function _open(url, interactive) {
                          
                                      // Launch
                                      var ref = {
                                          closed: false
                          Severity: Minor
                          Found in app/js/components/hello.all.js - About 1 hr to fix

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

                                function addListenersOnMap() {
                                        window.map.on("zoomend", function(event) {
                                                if (!prevZoomAction) {
                                                        prevZoomAction = new Date();
                                                        getMoreLocationOnMapAction();
                            Severity: Minor
                            Found in app/js/controllers/advanced-search.js - About 1 hr to fix

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

                                      function getNewActiveMatchIndex(){
                                        switch(key){
                                          case KEY.LEFT:
                                            // Select previous/first item
                                            if(~$selectMultiple.activeMatchIndex) return prev;
                              Severity: Minor
                              Found in app/js/components/select.js - About 1 hr to fix

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

                                    getMeta: function(meta) {
                                
                                        function getAttr(attr) {
                                
                                            var root = meta.dc || meta.dcterms, key;
                                Severity: Minor
                                Found in iframely/plugins/meta/dc.js - About 1 hr to fix

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

                                  function LoklakFieldService() {
                                  
                                      var service = {};
                                  
                                      service.fieldList =
                                  Severity: Minor
                                  Found in app/js/services/loklakField.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language