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);
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);
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);
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;
- Read upRead up
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++;
}
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);
- Read upRead up
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);
- Read upRead up
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);
- Read upRead up
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);
- Read upRead up
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++;
}
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);
- Read upRead up
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);
- Read upRead up
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);
- Read upRead up
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;
}
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor(fd) {
super();
this.fd = fd;
- Read upRead up
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 {
- Read upRead up
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;
- Read upRead up
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
- Read upRead up
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();
Avoid too many return
statements within this function. Open
return this._readLongString();