Showing 19 of 19 total issues
Function getRequestDict
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public getRequestDict(): RequestDict {
const dict: RequestDict = {};
if (this.power === undefined) throw new Error('Required Field power do not exists');
if (this.mode === undefined) throw new Error('Required Field mode do not exists');
if (this.targetTemperature === undefined) throw new Error('Required Field targetTemperature do not exists');
- 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 overwrite
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public overwrite(obj: Partial<ControlInfo>) {
if (obj.power !== undefined) this.power = obj.power;
if (obj.mode !== undefined) this.mode = obj.mode;
if (obj.targetTemperature !== undefined) this.targetTemperature = obj.targetTemperature;
if (obj.targetHumidity !== undefined) this.targetHumidity = obj.targetHumidity;
- 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
DaikinAC
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export class DaikinAC {
get currentACModelInfo(): ModelInfoResponse | null {
return this._currentACModelInfo;
}
get currentACControlInfo(): ControlInfo | null {
Function getRequestDict
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public getRequestDict(): RequestDict {
const dict: RequestDict = {};
if (this.power === undefined) throw new Error('Required Field power do not exists');
if (this.mode === undefined) throw new Error('Required Field mode do not exists');
if (this.targetTemperature === undefined) throw new Error('Required Field targetTemperature do not exists');
Function addDevices
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private addDevices(devices: { [name: string]: string }, logInitialDeviceConnection: boolean = false): void {
const expectedAmount: number = Object.keys(devices).length;
let connectedAmount: number = 0;
let triedAmmount: number = 0;
for (const key in devices) {
- 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 parseResponse
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static parseResponse(dict: ResponseDict, cb: DaikinResponseCb<ControlInfo>): void {
const result = new ControlInfo();
result.power = DaikinDataParser.resolveBool(dict, 'pow', Power);
result.mode = DaikinDataParser.resolveInteger(dict, 'mode', Mode);
result.targetTemperature = DaikinDataParser.resolveFloat(dict, 'stemp', AlternativeTemperatureTargets);
Function doPost
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public doPost(url: string, parameters: { [key: string]: any }, callback: ResponseHandler) {
if (this.useGetToPost) {
this.doGet(url, parameters, callback);
return;
}
Function overwrite
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public overwrite(obj: Partial<ControlInfo>) {
if (obj.power !== undefined) this.power = obj.power;
if (obj.mode !== undefined) this.mode = obj.mode;
if (obj.targetTemperature !== undefined) this.targetTemperature = obj.targetTemperature;
if (obj.targetHumidity !== undefined) this.targetHumidity = obj.targetHumidity;
Function doGet
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public doGet(url: string, parameters: RequestDict, callback: ResponseHandler) {
const reqParams = Object.assign({}, this.defaultParameters, parameters);
const data: any = {
parameters: reqParams,
Function processResponse
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static processResponse<T>(
inputData: Error | string | Buffer,
callback?: DaikinResponseCb<T>,
requestDict: RequestDict = {},
): ResponseDict | null {
Function resolveFloat
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static resolveFloat<T>(
dict: ResponseDict,
key: string,
altValues?: { [key: string]: number | T },
): number | undefined | T {
- 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 parseResponse
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static parseResponse(dict: ResponseDict, cb: DaikinResponseCb<BasicInfoResponse>): void {
const result = new BasicInfoResponse();
result.type = DaikinDataParser.resolveString(dict, 'type', Type);
result.region = DaikinDataParser.resolveString(dict, 'reg');
result.dst = DaikinDataParser.resolveBool(dict, 'dst');
Function resolveInteger
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static resolveInteger<T>(
dict: ResponseDict,
key: string,
altValues?: { [key: string]: number | T },
): number | undefined | T {
- 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 resolveString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static resolveString(
dict: ResponseDict,
key: string,
altValues?: { [key: string]: string },
): string | 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 null;
Avoid too many return
statements within this function. Open
return dict;
Parsing error: parser.parse is not a function Open
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
TODO found Open
// TODO: Which parameterrs are really needed
- Exclude checks
TODO found Open
// TODO: Also initialize DaicinAC instances?
- Exclude checks