AlexRogalskiy/java-patterns

View on GitHub
packages/contributors-view/docs/js/menu.js

Summary

Maintainability
C
1 day
Test Coverage

File menu.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
Open

document.addEventListener('DOMContentLoaded', function () {
    var menuCollapsed = false,
        mobileMenu = document.getElementById('mobile-menu');

    var localContextInUrl = '';
Severity: Minor
Found in packages/contributors-view/docs/js/menu.js - About 3 hrs to fix

    Function processLogos has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var processLogos = function (entityLogos) {
            for (var i = 0; i < entityLogos.length; i++) {
                var entityLogo = entityLogos[i];
                if (entityLogo) {
                    var url = entityLogo.getAttribute('data-src');
    Severity: Minor
    Found in packages/contributors-view/docs/js/menu.js - About 1 hr to fix

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

                  toggleItemMenu = function (e) {
                      var element = $(e.target),
                          parent = element[0].parentNode,
                          parentLink,
                          elementIconChild;
      Severity: Minor
      Found in packages/contributors-view/docs/js/menu.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                            if (toggler) {
                                toggler.click();
                            }
        Severity: Major
        Found in packages/contributors-view/docs/js/menu.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (parentUl) {
                                      parentChapterMenu = parentUl.parentNode;
                                      if (parentChapterMenu) {
                                          var toggler = parentChapterMenu.querySelector('.menu-toggler'),
                                              elementIconChild =
          Severity: Major
          Found in packages/contributors-view/docs/js/menu.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (linkContextId === 'additional') {
                                        var mainToggler = activeMenu.querySelector(
                                            '.chapter.' + linkContextId + ' div.menu-toggler'
                                        );
                                        if (mainToggler) {
            Severity: Major
            Found in packages/contributors-view/docs/js/menu.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (toggler) {
                                          toggler.click();
                                      }
              Severity: Major
              Found in packages/contributors-view/docs/js/menu.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if (linkContextId === 'additional') {
                                        var mainToggler = activeMenu.querySelector(
                                            '.chapter.' + linkContextId + ' div.menu-toggler'
                                        );
                                        if (mainToggler) {
                Severity: Major
                Found in packages/contributors-view/docs/js/menu.js - About 45 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status