gkozlenko/node-video-lib

View on GitHub
lib/flv/parser-impl.js

Summary

Maintainability
B
4 hrs
Test Coverage
A
98%

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

      There are no issues that match your filters.

      Category
      Status