Showing 179 of 181 total issues
Function openUrlFactory
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const openUrlFactory = (classInstance) => {
const toJSON = data => ({
type: getRequestType(data, false),
request: {
type: 'openUrl',
Function runTokenSession
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async runTokenSession() {
suitest.logger.intro(t.launcherGreeting, version);
validateInput(TOKEN.toUpperCase(), this.ownArgv);
const appConfigIdAndDeviceIdPresented = this.ownArgv.appConfigId && this.ownArgv.deviceId;
const presetArrayDefined = this.ownArgv.preset && this.ownArgv.preset.length > 0;
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getComposers = data => {
const output = [
toStringComposer,
thenComposer,
cloneComposer,
Function suspendAppChainFactory
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const suspendAppChainFactory = (classInstance) => {
const toJSON = data => ({
type: getRequestType(data, false),
request: {
type: 'suspendApp',
Function closeAppChainFactory
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const closeAppChainFactory = (classInstance) => {
const toJSON = data => ({
type: getRequestType(data, false),
request: {
type: 'closeApp',
Function getComposers
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getComposers = data => {
const output = [
toStringComposer,
thenComposer,
cloneComposer,
Function clearAppDataFactory
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const clearAppDataFactory = (classInstance) => {
const toJSON = () => ({
type: 'eval',
request: {
type: 'clearAppData',
Function toJSON
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const toJSON = (data) => {
const lineType = !isNil(data.sendText) ? 'sendText' : 'browserCommand';
const socketMessage = {
type: getRequestType(data, false),
request: {type: lineType},
Function getComposers
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getComposers = data => {
const output = [
toStringComposer,
thenComposer,
gettersComposer,
Function toJSON
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const toJSON = (data) => {
if (!data.isClick && !data.isMoveTo && !data.tap && !data.isSwipe && !data.isScroll) {
throw new SuitestError(positionIsMalformed(), SuitestError.INVALID_INPUT);
}
Function handleResponse
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function handleResponse(msg) {
const messageId = msg.messageId;
const res = msg.content.response || msg.content;
const req = requestPromises[messageId];
- 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 bootstrapSession
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const bootstrapSession = async(suitest, {deviceId, configId, presetName}) => {
try {
if (suitest.config.sessionType === TOKEN) {
validate(validators.SESSION_BOOTSTRAP_TOKEN, suitest.config, 'suitest token configuration');
await openSession(
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getComposers = (data) => {
const output = [
toStringComposer,
thenComposer,
cloneComposer,
Function startREPL
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function startREPL(opts = {}) {
if (!replModeWasActivated) {
replModeWasActivated = true;
captureMessage('REPL mode activated');
}
Function toJSON
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const toJSON = data => {
const type = getRequestType(data);
const socketMessage = {type};
const subject = {
type: 'psVideo',
Function toJSON
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
}
Function getComposers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getComposers = (data) => {
const output = [
toStringComposer,
thenComposer,
cloneComposer,
Function takeScreenshotFactory
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const takeScreenshotFactory = (classInstance) => {
const toJSON = () => ({type: 'takeScreenshot'});
const toStringComposer = makeToStringComposer(toJSON);
const thenComposer = makeThenComposer(toJSON);
Function handleResponse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleResponse(msg) {
const messageId = msg.messageId;
const res = msg.content.response || msg.content;
const req = requestPromises[messageId];
Function getComposers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getComposers = (data) => {
const output = [
toStringComposer,
thenComposer,
cloneComposer,