gkozlenko/node-video-lib

View on GitHub

Showing 50 of 79 total issues

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 _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 _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

          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 = 5;
          
                  // ES_Length
                  let esSize = readSize(buffer, offset);
          Severity: Minor
          Found in lib/mp4/atoms/atom-esds.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

          Avoid deeply nested control flow statements.
          Open

                                  if (currentChunk + 1 >= samplesToChunk[3 * currentSampleChunk]) {
                                      samplesPerChunk = samplesToChunk[3 * currentSampleChunk + 1];
                                      currentSampleChunk++;
                                  }
          Severity: Major
          Found in lib/mp4/parser-impl.js - About 45 mins to fix

            Function parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                parse(buffer) {
                    let limit = buffer.length;
                    let offset = 0;
                    while (offset < limit) {
                        let size = buffer.readUInt32BE(offset);
            Severity: Minor
            Found in lib/mp4/container-atom.js - About 45 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 _parseScript has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                _parseScript(pos, dataSize) {
                    let buffer = Buffer.allocUnsafe(dataSize);
                    this.reader.read(buffer, pos);
            
                    let data = AmfParser.parse(buffer);
            Severity: Minor
            Found in lib/flv/parser-impl.js - About 45 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 get has a Cognitive Complexity of 8 (exceeds 5 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 45 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

            Avoid deeply nested control flow statements.
            Open

                                    if (currentCompositionCount >= compositions[2 * currentCompositionIndex]) {
                                        currentCompositionIndex++;
                                        currentCompositionCount = 0;
                                    }
            Severity: Major
            Found in lib/mp4/parser-impl.js - About 45 mins to fix

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

                  constructor(fd) {
                      super();
              
                      this.fd = fd;
              
              
              Severity: Minor
              Found in lib/index/indexed-fragment-list.js - About 45 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 buildDurationsReducer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  static buildDurationsReducer(result, sample, index, samples) {
                      if (index === 0) {
                          if (samples.length > 1) {
                              result.push(samples[1].timestamp - sample.timestamp);
                          } else {
              Severity: Minor
              Found in lib/mp4/builder-impl.js - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  parse() {
                      this._pos = 22;
                      let nalSequences = this.extraData[this._pos++];
                      for (let i = 0; i < nalSequences; i++) {
                          let nalType =  this.extraData[this._pos++] & 0x3f;
              Severity: Minor
              Found in lib/codecs/codec-h265.js - About 35 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 _buildHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  _buildHeader() {
                      let buffer = Buffer.allocUnsafe(2 * PACKET_SIZE);
                      let pos = 0;
              
                      // Write PAT packet
              Severity: Minor
              Found in lib/hls/packetizer-impl.js - About 35 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

              Avoid too many return statements within this function.
              Open

                              return this._readReference();
              Severity: Major
              Found in lib/flv/amf-parser.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return this._readLongString();
                Severity: Major
                Found in lib/flv/amf-parser.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language