Halyul/hexo-theme-mdui

View on GitHub

Showing 71 of 125 total issues

Function build has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Plugin.prototype.build = function (index) {

        var _this = this;

        _this.structure();
Severity: Minor
Found in source/js/_files/lightgallery.js - About 1 hr to fix

    Function exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(locals){
      var config = this.config;
      var searchConfig = config.search;
      var template = searchTmpl;
      var searchfield = searchConfig.field;
    Severity: Minor
    Found in scripts/lib/search/json_generator.js - About 1 hr to fix

      Function Promise$2 has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Promise$2 = function () {
        function Promise(resolver) {
          this[PROMISE_ID] = nextId();
          this._result = this._state = undefined;
          this._subscribers = [];
      Severity: Minor
      Found in source/js/_files/es6-promise.js - About 1 hr to fix

        Function PrismPlugin has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

         function PrismPlugin(data) {
           // Patch for caption support
           if (captionRegex.test(data.content)) {
             // Attempt to parse the code
             data.content = data.content.replace(captionRegex, (origin, lang, caption, code) => {
        Severity: Minor
        Found in scripts/lib/prism.js - About 1 hr to fix

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

              this._initBody = function(body) {
                this._bodyInit = body;
                if (!body) {
                  this._bodyText = '';
                } else if (typeof body === 'string') {
          Severity: Minor
          Found in source/js/_files/fetch.js - About 1 hr to fix

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

                      var actualSize = function actualSize(event, image, index, fromIcon) {
                        var w = image.clientWidth;
                        var nw;
                        if (_this.core.s.dynamic) {
                          nw = _this.core.s.dynamicEl[index].width || image.naturalWidth || w;
            Severity: Minor
            Found in source/js/_files/lg-zoom.js - About 1 hr to fix

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

                      off: function off(el, event) {
                          if (!el) {
                              return;
                          }
              
              
              Severity: Minor
              Found in source/js/_files/lightgallery.js - About 1 hr to fix

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

                    Plugin.prototype.touchEnd = function (distance) {
                        var _this = this;
                
                        // keep slide animation for any mode while dragg/swipe
                        if (_this.s.mode !== 'lg-slide') {
                Severity: Minor
                Found in source/js/_files/lightgallery.js - About 1 hr to fix

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

                        Promise.all = function (arr) {
                          var args = Array.prototype.slice.call(arr);
                      
                          return new Promise(function (resolve, reject) {
                            if (args.length === 0) return resolve([]);
                  Severity: Minor
                  Found in source/js/_files/barba.js - About 1 hr to fix

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

                    function getProperty(obj, name){
                        name = name.replace(/\[(\w+)\]/g, '.$1').replace(/^\./, '');
                    
                        var split = name.split('.');
                        var key = split.shift();
                    Severity: Minor
                    Found in scripts/lib/style_renderer.js - 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.lgBusy) {
                                                    _this.manageSwipeClass();
                                                    startCoords = e.pageX;
                                                    isDraging = true;
                    
                    
                    Severity: Major
                    Found in source/js/_files/lightgallery.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (index === _length - 1 && _prevIndex === 0 && !fromThumb) {
                                              _prev = true;
                                              _next = false;
                                          }
                      Severity: Major
                      Found in source/js/_files/lightgallery.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    for (var key in utils.Listener) {
                                                        if (utils.Listener.hasOwnProperty(key)) {
                                                            if (key.split('.').indexOf(_event.split('.')[1]) > -1) {
                                                                el.removeEventListener(key.split('.')[0], utils.Listener[key]);
                                                                el.setAttribute('lg-event-uid', el.getAttribute('lg-event-uid').replace('&' + _id[i], ''));
                        Severity: Major
                        Found in source/js/_files/lightgallery.js - About 45 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                          if (_this.s.dynamic) {
                                              _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src);
                                          } else {
                                              _src = _this.items[index].getAttribute('data-download-url') !== 'false' && (_this.items[index].getAttribute('data-download-url') || _this.items[index].getAttribute('href') || _this.items[index].getAttribute('data-src'));
                                          }
                          Severity: Major
                          Found in source/js/_files/lightgallery.js - About 40 mins to fix

                            Function closest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                Element.prototype.closest = function(s) {
                                    var matches = (this.document || this.ownerDocument).querySelectorAll(s),
                                        i,
                                        el = this;
                                    do {
                            Severity: Minor
                            Found in source/js/_files/smooth-scroll.js - About 35 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 too many return statements within this function.
                            Open

                                return result;
                            Severity: Major
                            Found in scripts/lib/style_renderer.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return cachedSetTimeout.call(this, fun, 0);
                              Severity: Major
                              Found in source/js/_files/barba.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                return cachedClearTimeout.call(this, marker);
                                Severity: Major
                                Found in source/js/_files/barba.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return {
                                                  vk: vk
                                              };
                                  Severity: Major
                                  Found in source/js/_files/lightgallery.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            if (typeof result !== 'object') return result;
                                    Severity: Major
                                    Found in scripts/lib/style_renderer.js - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language