Showing 14 of 43 total issues
Function parseAdvertisement
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseAdvertisement(payload: Uint8Array): this {
if (!payload) {
return this;
}
this.rawAdvertisement = payload;
Function toString
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
toString(byteLength?: number, padding: boolean = true): string {
byteLength = byteLength ?? this._raw.byteLength;
const bytes = [];
for (const [, value] of this._raw.entries()) {
bytes.push(value);
Function processObject
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
processObject(object: BLEObject, frame: DataFrame): Promise<BLEObject> {
return new Promise((resolve) => {
let output = object;
for (let i = 0; i < this.options.types.length; i++) {
const BeaconType = this.options.types[i];
Function parseServiceData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
parseServiceData(uuid: BLEUUID, serviceData: Uint8Array): this {
super.parseServiceData(uuid, serviceData);
if (uuid === undefined && serviceData === undefined) {
return this;
}
- 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 parseServiceData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseServiceData(uuid: BLEUUID, serviceData: Uint8Array): this {
super.parseServiceData(uuid, serviceData);
if (uuid === undefined && serviceData === undefined) {
return this;
}
Function parseServiceData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseServiceData(uuid: BLEUUID, serviceData: Uint8Array): this {
super.parseServiceData(uuid, serviceData);
if (uuid === undefined && serviceData === undefined) {
return this;
}
Function parseServiceData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
parseServiceData(uuid: BLEUUID, serviceData: Uint8Array): this {
super.parseServiceData(uuid, serviceData);
if (uuid === undefined && serviceData === undefined) {
return this;
}
- 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 bundle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const bundle = (env, module) => ({
name: PROJECT_NAME,
entry: `./dist/${module ? "esm" : "cjs"}/index.js`,
output: {
path: path.resolve(__dirname, 'dist'),
- 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 toString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
toString(byteLength?: number, padding: boolean = true): string {
byteLength = byteLength ?? this._raw.byteLength;
const bytes = [];
for (const [, value] of this._raw.entries()) {
bytes.push(value);
- 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 parseAdvertisement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parseAdvertisement(payload: Uint8Array): this {
if (!payload) {
return this;
}
this.rawAdvertisement = payload;
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(address?: MACAddress | string) {
super(address ? (address instanceof MACAddress ? address.toString() : address) : undefined);
if (address instanceof MACAddress) {
this.address = address;
if (!this.knownAddresses.includes(address) && address !== undefined) {
- 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;
Avoid too many return
statements within this function. Open
return this;
Function convertToDistance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected convertToDistance(rel: RelativeRSSI, transmitter: RFTransmitterObject): RelativeDistance {
const environmentFactor = this.options.environmentFactor || transmitter.environmentFactor;
const calibratedRSSI = transmitter.calibratedRSSI || this.options.defaultCalibratedRSSI;
switch (this.options.propagationModel) {
case PropagationModel.LOG_DISTANCE:
- 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"