SuitestAutomation/suitest-js-api

View on GitHub

Showing 121 of 177 total issues

Function runTokenSession has 66 lines of code (exceeds 25 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;
Severity: Major
Found in lib/testLauncher/SuitestLauncher.js - About 2 hrs to fix

    Function makeThenComposer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    const makeThenComposer = (getSocketMessage, callback, beforeSend) => makeMethodComposer(
        composers.THEN,
        ['then'],
        ({webSockets, authContext, logger, config, appContext}, data, onResolve, onReject) => {
            const chainedPromise = chainPromise(async() => {
    Severity: Minor
    Found in lib/composers/thenComposer.js - About 2 hrs to fix

    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 playstationVideoFactory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    const playstationVideoFactory = (classInstance) => {
        const toJSON = data => {
            const type = getRequestType(data);
            const socketMessage = {type};
            const subject = {
    Severity: Minor
    Found in lib/chains/playstationVideoChain.js - About 2 hrs to fix

    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 makeArgumentsProcessor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    const makeArgumentsProcessor = (
        fromArguments,
        fromObject = identity,
        fromObjectArgsValidator = () => true,
        fromKeyValue = identity,
    Severity: Minor
    Found in lib/utils/makeArgumentsProcessor.js - About 2 hrs to fix

    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

    Consider simplifying this complex logical expression.
    Open

            if (
                !data.comparator
                && !data.isClick
                && !data.isMoveTo
                && !data.tap
    Severity: Critical
    Found in lib/chains/elementChain.js - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

              if (
                  !data.timeout
                  && !data.isClick
                  && !data.isSwipe
                  && !data.isScroll
      Severity: Critical
      Found in lib/chains/elementChain.js - About 2 hrs to fix

        Function testPosition has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function testPosition() {
            const {position} = suitest;
        
            const samplePos = position(100, 100);
        
        
        Severity: Major
        Found in testDefinition/examplesTS/positionChain.ts - About 2 hrs to fix

          Function openAppChainFactory has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const openAppChainFactory = (classInstance) => {
              const toJSON = data => {
                  const socketMessage = {
                      type: getRequestType(data, false),
                      request: {
          Severity: Major
          Found in lib/chains/openAppChain.js - About 2 hrs to fix

            Function saveScreenshotFactory has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const saveScreenshotFactory = (classInstance) => {
                function getPlaceholdersValues(date = new Date()) {
                    const userStackItem = getFirstNotSuitestStackItem();
            
                    return {
            Severity: Major
            Found in lib/chains/saveScreenshotChain.js - About 2 hrs to fix

              Function javascriptExpressionFactory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              const javascriptExpressionFactory = (classInstance) => {
                  const toJSON = data => {
                      const type = getRequestType(data);
                      const socketMessage = {type};
              
              
              Severity: Minor
              Found in lib/chains/javascriptExpressionChain.js - About 2 hrs to fix

              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 locationFactory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              const locationFactory = (classInstance) => {
                  const toJSON = data => {
                      const type = getRequestType(data);
                      const subject = {type: 'location'};
                      const socketMessage = {type};
              Severity: Minor
              Found in lib/chains/locationChain.js - About 2 hrs to fix

              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 brightScriptExpressionFactory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              const brightScriptExpressionFactory = (classInstance) => {
                  const {logger} = classInstance;
              
                  const toJSON = data => {
                      const type = getRequestType(data);
              Severity: Minor
              Found in lib/chains/brightScriptExpressionChain.js - About 2 hrs to fix

              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 pressButtonFactory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              const pressButtonFactory = (classInstance) => {
                  const toJSON = (data) => {
                      const base = {
                          type: 'button',
                          ids: data.ids,
              Severity: Minor
              Found in lib/chains/pressButtonChain.js - About 2 hrs to fix

              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 locationFactory has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const locationFactory = (classInstance) => {
                  const toJSON = data => {
                      const type = getRequestType(data);
                      const subject = {type: 'location'};
                      const socketMessage = {type};
              Severity: Major
              Found in lib/chains/locationChain.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                    if (
                        hasQuery &&
                        !data.comparator &&
                        !data.isClick &&
                        !data.tap &&
                Severity: Critical
                Found in lib/utils/socketChainHelper.js - About 2 hrs to fix

                  Function args has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              const args = data.map(d => {
                                  // If not an array, display as it is.
                                  if (!Array.isArray(d)) {
                                      return d;
                                  }
                  Severity: Minor
                  Found in lib/utils/logger.js - About 1 hr to fix

                    Function makeUrlFromArray has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function makeUrlFromArray(url) {
                        let key, reg;
                        let firstLoop = true;
                    
                        if (Array.isArray(url)) {
                    Severity: Minor
                    Found in lib/utils/makeUrlFromArray.js - About 1 hr to fix

                    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 openDeepLinkFactory has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const openDeepLinkFactory = (classInstance) => {
                        const toJSON = (data) => ({
                            type: getRequestType(data, false),
                            request: {
                                type: 'openDeepLink',
                    Severity: Minor
                    Found in lib/chains/openDeepLinkChain.js - About 1 hr to fix

                      Function runTestFactory has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const runTestFactory = (classInstance) => {
                          const toJSON = (data) => ({
                              type: getRequestType(data, false),
                              request: compose(
                                  msg => applyUntilCondition(msg, data),
                      Severity: Minor
                      Found in lib/chains/runTestChain.js - About 1 hr to fix

                        Function openAppChainFactory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const openAppChainFactory = (classInstance) => {
                            const toJSON = data => {
                                const socketMessage = {
                                    type: getRequestType(data, false),
                                    request: {
                        Severity: Minor
                        Found in lib/chains/openAppChain.js - About 1 hr to fix

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language