betajs/betajs-media-components

View on GitHub
src/dynamics/video_player/sidebar/sidebar.js

Summary

Maintainability
D
1 day
Test Coverage

File sidebar.js has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Scoped.define("module:VideoPlayer.Dynamics.Sidebar", [
    "dynamics:Dynamic",
    "base:Objs",
    "base:Async",
    "base:Types",
Severity: Minor
Found in src/dynamics/video_player/sidebar/sidebar.js - About 7 hrs to fix

    Function setNextVideoIndex has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    setNextVideoIndex: function(triggerNext) {
                        triggerNext = triggerNext || false;
                        let nextVideo, videoFromTop, indexFromTop, nextIndex = null;
                        const currentVideo = this.__getCurrentVideo();
                        const currentIndex = currentVideo?.get("index");
    Severity: Minor
    Found in src/dynamics/video_player/sidebar/sidebar.js - About 1 hr to fix

      Function showplaylist:playlist has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                          "showplaylist:playlist": function(playlist) {
                              if (!playlist) return false;
                              const showSidebar = playlist.length > 0;
                              if (!showSidebar) return false;
                              const videos = this.get("videos");
      Severity: Minor
      Found in src/dynamics/video_player/sidebar/sidebar.js - About 1 hr to fix

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

                        __generateCompanionAdContent: function(companionads) {
                            companionads = companionads || this.get("companionads");
                            if (companionads && companionads.length > 0) {
                                const isMobile = this.get("mobileviewport");
                                if (
        Severity: Minor
        Found in src/dynamics/video_player/sidebar/sidebar.js - About 1 hr to fix

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

                          initSidebarGallery: function() {
                              this.set("states.gallerysidebar", this.get("gallerysidebar"));
                              if (this.get("adsplaying")) return;
                              this.__sidebarGalleryInited = true;
          
          
          Severity: Minor
          Found in src/dynamics/video_player/sidebar/sidebar.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                                    if (
                                        (this.get("floatingoptions.desktop.companionad") && !isMobile) ||
                                        (this.get("floatingoptions.mobile.companionad") && isMobile) ||
                                        (this.get("gallerysidebar") && this.get("sidebaroptions.showcompanionad") && !isMobile)
                                    ) {
            Severity: Major
            Found in src/dynamics/video_player/sidebar/sidebar.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                                  if (this.__dyn.__listeningOnPlayNext) {
                                                      this.__dyn.trigger("play_next");
                                                  } else {
                                                      // TODO: need to be improved, this part runs only if first video from the playlist has error
                                                      this.__dyn.setAll({
              Severity: Major
              Found in src/dynamics/video_player/sidebar/sidebar.js - About 45 mins to fix

                Function __drawCompanionAdToContainer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                                __drawCompanionAdToContainer: function(container, companionAd, dimensions, ar, _ar) {
                Severity: Minor
                Found in src/dynamics/video_player/sidebar/sidebar.js - About 35 mins to fix

                  TODO found
                  Open

                                                          // TODO: need to be improved, this part runs only if first video from the playlist has error

                  TODO found
                  Open

                                                  // TODO: in the future could be better replace Async.eventually calling in the adsplaying change event to MutationObserver

                  There are no issues that match your filters.

                  Category
                  Status