gkozlenko/node-video-lib

View on GitHub

Showing 79 of 79 total issues

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

    packFragment() {
        let buffers = [];
        let buffersLength = 0;
        let packetTimescale = 90 * this.fragment.timescale;

Severity: Minor
Found in lib/hls/packetizer-impl.js - About 1 hr to fix

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

            if (fragmentList.audio) {
                bufferSize += fragmentList.audio.extraData.length + Utils.HEADER_AUDIO_SIZE;
                if (fragmentList.audio.codec) {
                    bufferSize += fragmentList.audio.codec.length;
                }
    Severity: Major
    Found in lib/index/fragment-list-indexer.js and 1 other location - About 1 hr to fix
    lib/index/fragment-list-indexer.js on lines 15..20

    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

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

            if (fragmentList.video) {
                bufferSize += fragmentList.video.extraData.length + Utils.HEADER_VIDEO_SIZE;
                if (fragmentList.video.codec) {
                    bufferSize += fragmentList.video.codec.length;
                }
    Severity: Major
    Found in lib/index/fragment-list-indexer.js and 1 other location - About 1 hr to fix
    lib/index/fragment-list-indexer.js on lines 21..26

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

        packFragment() {
            let buffers = [];
            let buffersLength = 0;
            let packetTimescale = 90 * this.fragment.timescale;
    
    
    Severity: Minor
    Found in lib/hls/packetizer-impl.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 _readByType has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _readByType(type) {
            switch (type) {
                case TYPE_NUMBER: {
                    return this._readDouble();
                }
    Severity: Minor
    Found in lib/flv/amf-parser.js - About 1 hr to fix

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

          static readSamples(fragment, source) {
              // Collect entries
              let entries = fragment.samples.map((sample, i) => {
                  return {
                      index: i,
      Severity: Minor
      Found in lib/fragment-reader.js - About 1 hr to fix

        Function get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            get(index) {
                if (index >= this._fragmentsCount) {
                    return;
                }
                let bufFragment = Buffer.allocUnsafe(Utils.FRAGMENT_SIZE);
        Severity: Minor
        Found in lib/index/indexed-fragment-list.js - About 1 hr to fix

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

                  if (version === 1) {
                      this.timescale = buffer.readUInt32BE(20);
                      this.duration = BufferUtils.readUInt64BE(buffer, 24);
                      this.nextTrackId = buffer.readUInt32BE(104);
                  } else {
          Severity: Major
          Found in lib/mp4/atoms/atom-mvhd.js and 1 other location - About 1 hr to fix
          lib/mp4/atoms/atom-tkhd.js on lines 26..34

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

          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 (buffer[0] === 1) {
                      this.duration = BufferUtils.readUInt64BE(buffer, 28);
                      this.width = buffer.readUInt16BE(88);
                      this.height = buffer.readUInt16BE(92);
                  } else {
          Severity: Major
          Found in lib/mp4/atoms/atom-tkhd.js and 1 other location - About 1 hr to fix
          lib/mp4/atoms/atom-mvhd.js on lines 25..33

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

          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 parse has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              parse(buffer) {
                  let offset = 5;
          
                  // ES_Length
                  let esSize = readSize(buffer, offset);
          Severity: Minor
          Found in lib/mp4/atoms/atom-esds.js - About 1 hr to fix

            Function parse has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                parse(buffer) {
                    let offset = 8;
                    let version = buffer.readUInt16BE(offset);
                    offset += 8;
                    this.channels = buffer.readUInt16BE(offset);
            Severity: Minor
            Found in lib/mp4/atoms/atom-mp4a.js - About 1 hr to fix

              Function _findMoovAtom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  _findMoovAtom() {
                      this.moovAtom = null;
              
                      let pos = 0;
                      let size = this.reader.size();
              Severity: Minor
              Found in lib/mp4/parser-impl.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 _findMoovAtom has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _findMoovAtom() {
                      this.moovAtom = null;
              
                      let pos = 0;
                      let size = this.reader.size();
              Severity: Minor
              Found in lib/mp4/parser-impl.js - About 1 hr to fix

                Function _parseAudio has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _parseAudio(pos, dataSize, timestamp) {
                        // Read header
                        let headerSize = 2;
                        let buffer = Buffer.allocUnsafe(headerSize);
                        this.reader.read(buffer, pos);
                Severity: Minor
                Found in lib/flv/parser-impl.js - About 1 hr to fix

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

                      _parseVideo(pos, dataSize, timestamp) {
                          // Read header
                          let headerSize = 5;
                          let buffer = Buffer.allocUnsafe(headerSize);
                          this.reader.read(buffer, pos);
                  Severity: Minor
                  Found in lib/flv/parser-impl.js - About 1 hr to fix

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

                        static build(movie, fragmentDuration) {
                            let fragmentList = new FragmentList();
                            fragmentList.fragmentDuration = fragmentDuration;
                            fragmentList.duration = movie.duration * FRAGMENT_TIMESCALE / movie.timescale;
                            fragmentList.timescale = FRAGMENT_TIMESCALE;
                    Severity: Minor
                    Found in lib/fragment-list-builder.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 _convertVideoSample has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _convertVideoSample(buffer, isKeyframe) {
                            let packetLength = 6 + buffer.length + (isKeyframe ? this._videoConfig.length : 0);
                            if (this._videoCodecInfo.type() === CodecUtils.CODEC_H265) {
                                packetLength++;
                            }
                    Severity: Minor
                    Found in lib/hls/packetizer-impl.js - About 1 hr to fix

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

                          _parseBody(pos) {
                              let buffer = Buffer.allocUnsafe(15);
                              let size = this.reader.size();
                              while (pos < size) {
                                  pos += this.reader.read(buffer, pos);
                      Severity: Minor
                      Found in lib/flv/parser-impl.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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          parse(buffer) {
                              let offset = 8;
                              let version = buffer.readUInt16BE(offset);
                              offset += 8;
                              this.channels = buffer.readUInt16BE(offset);
                      Severity: Minor
                      Found in lib/mp4/atoms/atom-mp4a.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 _parseAudio has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          _parseAudio(pos, dataSize, timestamp) {
                              // Read header
                              let headerSize = 2;
                              let buffer = Buffer.allocUnsafe(headerSize);
                              this.reader.read(buffer, pos);
                      Severity: Minor
                      Found in lib/flv/parser-impl.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

                      Severity
                      Category
                      Status
                      Source
                      Language