Halyul/hexo-theme-mdui

View on GitHub

Showing 125 of 125 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                                    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], ''));
                                        delete utils.Listener[key];
                                    }
Severity: Major
Found in source/js/_files/lightgallery.js and 1 other location - About 2 hrs to fix
source/js/_files/lightgallery.js on lines 158..162

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function structure has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Plugin.prototype.structure = function () {
        var list = '';
        var controls = '';
        var i = 0;
        var subHtmlCont = '';
Severity: Major
Found in source/js/_files/lightgallery.js - About 2 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            function CustomEvent(event, params) {
                params = params || {
                    bubbles: false,
                    cancelable: false,
                    detail: undefined
    Severity: Major
    Found in source/js/_files/lightgallery.js and 1 other location - About 2 hrs to fix
    source/js/_files/smooth-scroll.js on lines 34..39

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 81.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        function CustomEvent(event, params) {
            params = params || { bubbles: false, cancelable: false, detail: undefined };
            var evt = document.createEvent('CustomEvent');
            evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
            return evt;
    Severity: Major
    Found in source/js/_files/smooth-scroll.js and 1 other location - About 2 hrs to fix
    source/js/_files/lightgallery.js on lines 223..232

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 81.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    for (var j = 0; j < this.___slide.length; j++) {
                        _lgUtils2.default.removeClass(this.___slide[j], 'lg-prev-slide');
                        _lgUtils2.default.removeClass(this.___slide[j], 'lg-next-slide');
                    }
    Severity: Major
    Found in source/js/_files/lightgallery.js and 1 other location - About 2 hrs to fix
    source/js/_files/lightgallery.js on lines 1445..1448

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 79.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            for (var i = 0; i < this.___slide.length; i++) {
                _lgUtils2.default.removeClass(this.___slide[i], 'lg-next-slide');
                _lgUtils2.default.removeClass(this.___slide[i], 'lg-prev-slide');
            }
    Severity: Major
    Found in source/js/_files/lightgallery.js and 1 other location - About 2 hrs to fix
    source/js/_files/lightgallery.js on lines 1027..1030

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 79.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                  if (allowX) {
                    distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x);
                  } else {
                    distanceX = -Math.abs(_el.getAttribute('data-x'));
                  }
    Severity: Major
    Found in source/js/_files/lg-zoom.js and 3 other locations - About 2 hrs to fix
    source/js/_files/lg-zoom.js on lines 397..401
    source/js/_files/lg-zoom.js on lines 403..407
    source/js/_files/lg-zoom.js on lines 498..502

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                    if (allowX) {
                      distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x);
                    } else {
                      distanceX = -Math.abs(_el.getAttribute('data-x'));
                    }
    Severity: Major
    Found in source/js/_files/lg-zoom.js and 3 other locations - About 2 hrs to fix
    source/js/_files/lg-zoom.js on lines 397..401
    source/js/_files/lg-zoom.js on lines 498..502
    source/js/_files/lg-zoom.js on lines 504..508

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                  if (allowY) {
                    distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y);
                  } else {
                    distanceY = -Math.abs(_el.getAttribute('data-y'));
                  }
    Severity: Major
    Found in source/js/_files/lg-zoom.js and 3 other locations - About 2 hrs to fix
    source/js/_files/lg-zoom.js on lines 397..401
    source/js/_files/lg-zoom.js on lines 403..407
    source/js/_files/lg-zoom.js on lines 504..508

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

                    if (allowY) {
                      distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y);
                    } else {
                      distanceY = -Math.abs(_el.getAttribute('data-y'));
                    }
    Severity: Major
    Found in source/js/_files/lg-zoom.js and 3 other locations - About 2 hrs to fix
    source/js/_files/lg-zoom.js on lines 403..407
    source/js/_files/lg-zoom.js on lines 498..502
    source/js/_files/lg-zoom.js on lines 504..508

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 77.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function fetch has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function fetch(input, init) {
        return new Promise(function(resolve, reject) {
          var request = new Request(input, init);
    
          if (request.signal && request.signal.aborted) {
    Severity: Minor
    Found in source/js/_files/fetch.js - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

                  if (
                      // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
                      // U+007F, […]
                      (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
                      // If the character is the first character and is in the range [0-9]
      Severity: Critical
      Found in source/js/_files/smooth-scroll.js - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                  utils.on(document.getElementById('lg-zoom-in'), 'click.lg', function() {
                    if (_this.core.outer.querySelector('.lg-current .lg-image')) {
                      scale += _this.core.s.scale;
                      callScale();
                    }
        Severity: Major
        Found in source/js/_files/lg-zoom.js and 1 other location - About 1 hr to fix
        source/js/_files/lg-zoom.js on lines 285..290

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 74.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                  utils.on(document.getElementById('lg-zoom-out'), 'click.lg', function() {
                    if (_this.core.outer.querySelector('.lg-current .lg-image')) {
                      scale -= _this.core.s.scale;
                      callScale();
                    }
        Severity: Major
        Found in source/js/_files/lg-zoom.js and 1 other location - About 1 hr to fix
        source/js/_files/lg-zoom.js on lines 292..297

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 74.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function enableDrag has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Plugin.prototype.enableDrag = function () {
                var _this = this;
                var startCoords = 0;
                var endCoords = 0;
                var isDraging = false;
        Severity: Minor
        Found in source/js/_files/lightgallery.js - About 1 hr to fix

          Function PrismPlugin has a Cognitive Complexity of 15 (exceeds 5 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

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

            if (item !== null) {
              var originHref = item.getAttribute('href')
              item.classList.add('mdui-list-item-active')
              item.setAttribute('origin-href', originHref)
              item.setAttribute('href', 'javascript:;')
          Severity: Major
          Found in source/js/_files/js.pure.js and 1 other location - About 1 hr to fix
          source/js/_files/js.barba.js on lines 231..237

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 72.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              if (item !== null) {
                var originHref = item.getAttribute('href')
                item.classList.add('mdui-list-item-active')
                item.setAttribute('origin-href', originHref)
                item.setAttribute('href', 'javascript:;')
          Severity: Major
          Found in source/js/_files/js.barba.js and 1 other location - About 1 hr to fix
          source/js/_files/js.pure.js on lines 22..28

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 72.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  smoothScroll.animateScroll = function (anchor, toggle, options) {
          
                      // Cancel any in progress scrolls
                      smoothScroll.cancelScroll();
          
          
          Severity: Minor
          Found in source/js/_files/smooth-scroll.js - About 1 hr to fix

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

                Plugin.prototype.destroy = function (d) {
            
                    var _this = this;
            
                    if (!d) {
            Severity: Minor
            Found in source/js/_files/lightgallery.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language