Showing 123 of 181 total issues
Function createLogger
has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring. Open
const createLogger = (config, pairedDeviceContext) => {
/**
* Prefix log with device id
*/
function devicePrefix() {
- 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 elementFactory
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
const elementFactory = (classInstance, video) => {
const toJSON = data => {
const type = getRequestType(data);
const socketMessage = {type};
const subject = {
- 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 elementFactory
has 239 lines of code (exceeds 25 allowed). Consider refactoring. Open
const elementFactory = (classInstance, video) => {
const toJSON = data => {
const type = getRequestType(data);
const socketMessage = {type};
const subject = {
File jsonSchemas.js
has 558 lines of code (exceeds 250 allowed). Consider refactoring. Open
const {uniq, values} = require('ramda');
const validationKeys = require('../constants/validationKeys');
const {NETWORK_PROP, NETWORK_METHOD} = require('../constants/networkRequest');
const {PROP_COMPARATOR} = require('../constants/comparator');
const {ELEMENT_PROP, VALUE} = require('../constants/element');
Function webSocketsFactory
has 220 lines of code (exceeds 25 allowed). Consider refactoring. Open
const webSocketsFactory = (self) => {
const {config, logger} = self;
let ws = null,
requestPromises = {},
Function createLogger
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createLogger = (config, pairedDeviceContext) => {
/**
* Prefix log with device id
*/
function devicePrefix() {
Function windowFactory
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
const windowFactory = (classInstance) => {
/**
* @description get browser command type basing on internal chain data
* @param data
* @returns {'refresh' | 'goBack' | 'goForward' | 'setWindowSize' | 'dismissAlertMessage' | 'acceptPromptMessage' | 'acceptAlertMessage'}
- 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 processServerResponse
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
const processServerResponse = (logger, verbosity) =>
function processServerResponseHandler(res, data, jsonMessage, snippets) {
const isSnippet = data.type === 'runSnippet';
const isAssertionError = isSnippet || assertionErrorTypes.includes(normalizeErrorType(res));
const responseForError = getResponseForError(res);
- 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 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({exitOnError} = {}) {
super();
// instance dependencies
this.authContext = new AuthContext();
Function connect
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
function connect(connectionOps = {}) {
disconnect();
logger.debug('Initializing websocket connection with options:', connectionOps);
if (!connectionOps.headers) {
Function networkRequestFactory
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
const networkRequestFactory = (classInstance) => {
const toJSON = data => {
const type = getRequestType(data);
const socketMessage = {type};
const subject = {
- 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 positionFactory
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
const positionFactory = (classInstance) => {
const toJSON = (data) => {
if (!data.isClick && !data.isMoveTo && !data.tap && !data.isSwipe && !data.isScroll) {
throw new SuitestError(positionIsMalformed(), SuitestError.INVALID_INPUT);
}
- 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 getComposers
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getComposers = (data) => {
const output = [
toStringComposer,
thenComposer,
cloneComposer,
validatorsMap
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
const validatorsMap = {
[validationKeys.NON_EMPTY_STRING]: (value, text) => {
return validators.validateJsonSchema(validationKeys.NON_EMPTY_STRING, value, text);
},
[validationKeys.STRING]: (value, text) => {
Function processServerResponseHandler
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processServerResponseHandler(res, data, jsonMessage, snippets) {
const isSnippet = data.type === 'runSnippet';
const isAssertionError = isSnippet || assertionErrorTypes.includes(normalizeErrorType(res));
const responseForError = getResponseForError(res);
const message = getErrorMessage({
Function windowFactory
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
const windowFactory = (classInstance) => {
/**
* @description get browser command type basing on internal chain data
* @param data
* @returns {'refresh' | 'goBack' | 'goForward' | 'setWindowSize' | 'dismissAlertMessage' | 'acceptPromptMessage' | 'acceptAlertMessage'}
Function builder
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
const builder = yargs => {
yargs
.option('token-id', {
alias: 'k',
describe: 'Suitest Token Key, can be generated on the profile page',
Function applicationFactory
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
const applicationFactory = (classInstance) => {
const toJSON = data => {
if (isNil(data.sendText) && (!data.comparator || data.comparator.type !== SUBJ_COMPARATOR.HAS_EXITED)) {
// Application can only be of "hasExited()" eval / assert
throw new SuitestError(applicationCommandMalformed(), SuitestError.INVALID_INPUT);
- 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 cookieFactory
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
const cookieFactory = (classInstance) => {
const toJSON = data => {
const type = getRequestType(data);
const subject = {type: 'cookie'};
const socketMessage = {type};
- 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 relativePositionFactory
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
const relativePositionFactory = (classInstance) => {
const toJSON = (data) => {
if (!data.isClick && !data.isMoveTo) {
throw new SuitestError(relativePositionIsMalformed(), SuitestError.INVALID_INPUT);
}
- 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"