harella1/video.js

View on GitHub

Showing 221 of 221 total issues

Function getTagSettings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  static getTagSettings(tag) {
    let baseOptions = {
      'sources': [],
      'tracks': []
    };
Severity: Minor
Found in src/js/player.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

Function canPlayType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  canPlayType(type) {
    let can;

    // Loop through each playback technology in the options order
    for (let i = 0, j = this.options_.techOrder; i < j.length; i++) {
Severity: Minor
Found in src/js/player.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

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

  constructor(options = {}) {
    let settings = merge(options, {
      kind: AudioTrackKind[options.kind] || ''
    });
    // on IE8 this will be a document element
Severity: Minor
Found in src/js/tracks/audio-track.js - About 1 hr to fix

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

      static getTagSettings(tag) {
        let baseOptions = {
          'sources': [],
          'tracks': []
        };
    Severity: Minor
    Found in src/js/player.js - About 1 hr to fix

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

      const parseCues = function(srcContent, track) {
        let parser = new window.WebVTT.Parser(window,
                                              window.vttjs,
                                              window.WebVTT.StringDecoder());
        let errors = [];
      Severity: Minor
      Found in src/js/tracks/text-track.js - About 1 hr to fix

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

          constructor(options={}, ready=function(){}){
            // we don't want the tech to report user activity automatically.
            // This is done manually in addControlsListeners
            options.reportTouchActivity = false;
            super(null, options, ready);
        Severity: Minor
        Found in src/js/tech/tech.js - About 1 hr to fix

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

          Flash.getEmbedCode = function(swf, flashVars, params, attributes){
            const objTag = '<object type="application/x-shockwave-flash" ';
            let flashVarsString = '';
            let paramsString = '';
            let attrsString = '';
          Severity: Minor
          Found in src/js/tech/flash.js - About 1 hr to fix

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

              constructor(options = {}) {
                let settings = merge(options, {
                  kind: VideoTrackKind[options.kind] || ''
                });
            
            
            Severity: Minor
            Found in src/js/tracks/video-track.js - About 1 hr to fix

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

              export const parseUrl = function(url) {
                const props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host'];
              
                // add the url to an anchor and let the browser parse the URL
                let a = document.createElement('a');
              Severity: Minor
              Found in src/js/utils/url.js - About 1 hr to fix

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

                  controls(bool) {
                    if (bool !== undefined) {
                      bool = !!bool; // force boolean
                      // Don't trigger a change event unless it actually changed
                      if (this.controls_ !== bool) {
                Severity: Minor
                Found in src/js/player.js - About 1 hr to fix

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

                    addRemoteTextTrack(options={}) {
                      if (!this['featuresNativeTextTracks']) {
                        return super.addRemoteTextTrack(options);
                      }
                  
                  
                  Severity: Minor
                  Found in src/js/tech/html5.js - About 1 hr to fix

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

                      getValues() {
                        const textEdge = getSelectedOptionValue(this.$('.vjs-edge-style select'));
                        const fontFamily = getSelectedOptionValue(this.$('.vjs-font-family select'));
                        const fgColor = getSelectedOptionValue(this.$('.vjs-fg-color > select'));
                        const textOpacity = getSelectedOptionValue(this.$('.vjs-text-opacity > select'));
                    Severity: Minor
                    Found in src/js/tracks/text-track-settings.js - About 1 hr to fix

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

                        createEl() {
                          let options = this.options_;
                      
                          // If video.js is hosted locally you should also set the location
                          // for the hosted swf, which should be relative to the page (not video.js)
                      Severity: Minor
                      Found in src/js/tech/flash.js - About 1 hr to fix

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

                            if (formattedTime !== this.formattedTime_) {
                              this.formattedTime_ = formattedTime;
                              this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> ${formattedTime}`;
                            }
                        Severity: Minor
                        Found in src/js/control-bar/time-controls/current-time-display.js and 1 other location - About 55 mins to fix
                        src/js/control-bar/time-controls/remaining-time-display.js on lines 57..60

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

                        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 (formattedTime !== this.formattedTime_) {
                                this.formattedTime_ = formattedTime;
                                this.contentEl_.innerHTML = `<span class="vjs-control-text">${localizedText}</span> -${formattedTime}`;
                              }
                        Severity: Minor
                        Found in src/js/control-bar/time-controls/remaining-time-display.js and 1 other location - About 55 mins to fix
                        src/js/control-bar/time-controls/current-time-display.js on lines 58..61

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

                        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 emulateTextTracks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          emulateTextTracks() {
                            let tracks = this.textTracks();
                            if (!tracks) {
                              return;
                            }
                        Severity: Minor
                        Found in src/js/tech/tech.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

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

                        const extendFn = function(superClass, subClassMethods={}) {
                          let subClass = function() {
                            superClass.apply(this, arguments);
                          };
                          let methods = {};
                        Severity: Minor
                        Found in src/js/extend.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

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

                          constructor(options = {}) {
                            super();
                        
                            let track = this;
                            if (browser.IS_IE8) {
                        Severity: Minor
                        Found in src/js/tracks/track.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

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

                          isFullscreen(isFS) {
                            if (isFS !== undefined) {
                              this.isFullscreen_ = !!isFS;
                              return this;
                            }
                        Severity: Minor
                        Found in src/js/player.js and 1 other location - About 55 mins to fix
                        src/js/player.js on lines 2457..2464

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

                        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

                          isAudio(bool) {
                            if (bool !== undefined) {
                              this.isAudio_ = !!bool;
                              return this;
                            }
                        Severity: Minor
                        Found in src/js/player.js and 1 other location - About 55 mins to fix
                        src/js/player.js on lines 1583..1589

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language