ampache/ampache

View on GitHub
public/lib/modules/jplayer/jplayer.playlist.js

Summary

Maintainability
F
3 days
Test Coverage

File jplayer.playlist.js has 588 lines of code (exceeds 500 allowed). Consider refactoring.
Open

/**
 * FORKED BY AMPACHE 2022-02-01
 * USING LAST UPDATED GIT VERSION (https://github.com/jplayer/jPlayer)
 * https://github.com/jplayer/jPlayer/blob/master/dist/add-on/jplayer.playlist.js
 */
Severity: Major
Found in public/lib/modules/jplayer/jplayer.playlist.js - About 4 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                                    if ((current_item === htmlIndex || $(playlistRow).hasClass("jp-playlist-current"))) {
                                        console.log("this.current: " + current_item + " => " + new_index);
                                        console.log(playlistRow);
                                        self.current = new_index;
                                    }
    Severity: Major
    Found in public/lib/modules/jplayer/jplayer.playlist.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                      if ((current_item === htmlIndex || $(playlistRow).hasClass("jp-playlist-current"))) {
                                          console.log("this.current: " + current_item + " => " + new_index);
                                          console.log(playlistRow);
                                          self.current = new_index;
                                      }
      Severity: Major
      Found in public/lib/modules/jplayer/jplayer.playlist.js - About 45 mins to fix

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

                                $.each($(this.cssSelector.playlist + " ul li"), function(i, playlistRow) {
                                    var htmlIndex = parseInt($(playlistRow).attr("name"),10);
                                    if (htmlIndex < index) {
                                        $(playlistRow).remove();
                                    } else {
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 day to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 455..470

        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 197.

        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

                                $.each($(this.cssSelector.playlist + " ul li"), function(i, playlistRow) {
                                    var htmlIndex = parseInt($(playlistRow).attr("name"),10);
                                    if (htmlIndex === index) {
                                        $(playlistRow).remove();
                                    } else {
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 day to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 508..523

        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 197.

        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

                $(this.cssSelector.next).click(function(event) {
                    event.preventDefault();
                    self.next();
                    self.blur(this);
                });
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 hr to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 118..122

        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 60.

        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

                $(this.cssSelector.shuffle).click(function(event) {
                    event.preventDefault();
                    self.shuffle();
                    self.blur(this);
                });
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 hr to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 112..116

        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 60.

        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 (typeof index === "undefined") {
                        this._initPlaylist();
                        this._refresh(function() {
                            $(self.cssSelector.jPlayer).jPlayer("clearMedia");
                        });
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 hr to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 432..485

        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 56.

        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 (typeof index === "undefined") {
                        this._initPlaylist();
                        this._refresh(function() {
                            $(self.cssSelector.jPlayer).jPlayer("clearMedia");
                        });
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 hr to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 490..536

        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 56.

        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

                $(this.cssSelector.jPlayer).bind($.jPlayer.event.ready, function() {
                    self._init();
                });
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 hr to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 87..89

        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 55.

        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

                $(this.cssSelector.jPlayer).bind($.jPlayer.event.ended, function() {
                    self.next();
                });
        Severity: Major
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 1 hr to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 82..84

        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 55.

        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

                        if (this.shuffling) {
                            $(this.cssSelector.shuffleOff).show();
                            $(this.cssSelector.shuffle).hide();
                        } else {
        Severity: Minor
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 35 mins to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 349..352

        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 47.

        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

                        } else {
                            $(this.cssSelector.shuffleOff).hide();
                            $(this.cssSelector.shuffle).show();
                        }
        Severity: Minor
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 35 mins to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 346..349

        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 47.

        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

                    if (this.options.playlistOptions.enableRemoveControls) {
                        $(this.cssSelector.playlist + " ." + this.options.playlistOptions.removeItemClass).show();
                    } else {
        Severity: Minor
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 30 mins to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 336..338

        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 45.

        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

                    } else {
                        $(this.cssSelector.playlist + " ." + this.options.playlistOptions.removeItemClass).hide();
                    }
        Severity: Minor
        Found in public/lib/modules/jplayer/jplayer.playlist.js and 1 other location - About 30 mins to fix
        public/lib/modules/jplayer/jplayer.playlist.js on lines 334..336

        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 45.

        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

        There are no issues that match your filters.

        Category
        Status