SuitestAutomation/suitest-js-api

View on GitHub

Showing 179 of 181 total issues

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

        const ocrFactory = (classInstance) => {
            const toJSON = (data) => {
                const subject = {type: 'ocr'};
                const socketMessage = {type: getRequestType(data)};
        
        
        Severity: Minor
        Found in lib/chains/ocrChain.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 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

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

                  if (isSendText) {
                      if (!data.interval) {
                          output.push(intervalComposer);
                      }
          
          
          Severity: Major
          Found in lib/chains/applicationChain.js and 4 other locations - About 2 hrs to fix
          lib/chains/elementChain.js on lines 316..328
          lib/chains/positionChain.js on lines 109..121
          lib/chains/relativePositionChain.js on lines 89..101
          lib/chains/windowChain.js on lines 138..150

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 76.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

                  if (!isNil(data.sendText)) {
                      if (!data.interval) {
                          output.push(intervalComposer);
                      }
          
          
          Severity: Major
          Found in lib/chains/windowChain.js and 4 other locations - About 2 hrs to fix
          lib/chains/applicationChain.js on lines 103..117
          lib/chains/elementChain.js on lines 316..328
          lib/chains/positionChain.js on lines 109..121
          lib/chains/relativePositionChain.js on lines 89..101

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 76.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

                  if (data.isClick || !isNil(data.sendText) || data.tap || data.isScroll || data.isSwipe) {
                      if (!data.interval) {
                          output.push(intervalComposer);
                      }
          
          
          Severity: Major
          Found in lib/chains/elementChain.js and 4 other locations - About 2 hrs to fix
          lib/chains/applicationChain.js on lines 103..117
          lib/chains/positionChain.js on lines 109..121
          lib/chains/relativePositionChain.js on lines 89..101
          lib/chains/windowChain.js on lines 138..150

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 76.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

                  if (data.isClick) {
                      if (!data.interval) {
                          output.push(intervalComposer);
                      }
          
          
          Severity: Major
          Found in lib/chains/relativePositionChain.js and 4 other locations - About 2 hrs to fix
          lib/chains/applicationChain.js on lines 103..117
          lib/chains/elementChain.js on lines 316..328
          lib/chains/positionChain.js on lines 109..121
          lib/chains/windowChain.js on lines 138..150

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 76.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

                  if (data.isClick || data.tap || data.isScroll || data.isSwipe) {
                      if (!data.interval) {
                          output.push(intervalComposer);
                      }
          
          
          Severity: Major
          Found in lib/chains/positionChain.js and 4 other locations - About 2 hrs to fix
          lib/chains/applicationChain.js on lines 103..117
          lib/chains/elementChain.js on lines 316..328
          lib/chains/relativePositionChain.js on lines 89..101
          lib/chains/windowChain.js on lines 138..150

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 76.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            if (data.comparator) {
                                socketMessage.request.condition.type = applyNegation(data.comparator.type, data);
                                socketMessage.request.condition.val = data.comparator.val;
                            }
                Severity: Major
                Found in lib/chains/locationChain.js and 1 other location - About 1 hr to fix
                lib/chains/cookieChain.js on lines 61..64

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 70.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language