SuitestAutomation/suitest-js-api

View on GitHub

Showing 179 of 181 total issues

Function createDeviceLogger has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function createDeviceLogger() {
        let logTime = 0;

        // Create transform stream to prepend our custom prefix to each output new line.
        const transformStream = new Transform({
Severity: Minor
Found in lib/utils/logger.js - About 1 hr to fix

    Function start has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const start = config => {
        const server = net.createServer();
    
        state.server = server;
    
    
    Severity: Minor
    Found in lib/testLauncher/ipc/server.js - About 1 hr to fix

      Function request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function request(url, requestObject, onFail) {
          if (requestObject.body) {
              requestObject.body = JSON.stringify(requestObject.body);
      
              if (!requestObject.headers) {
      Severity: Minor
      Found in lib/api/request.js - About 1 hr to fix

        Function toJSON has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const toJSON = data => {
                const type = getRequestType(data);
                const socketMessage = {type};
        
                if (type === 'query') {
        Severity: Minor
        Found in lib/chains/brightScriptExpressionChain.js - About 1 hr to fix

          Function toJSON has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const toJSON = data => {
                  const type = getRequestType(data);
                  const subject = {type: 'cookie'};
                  const socketMessage = {type};
          
          
          Severity: Minor
          Found in lib/chains/cookieChain.js - About 1 hr to fix

            Function getComposers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const getComposers = (data) => {
                    const output = [
                        toStringComposer,
                        thenComposer,
                        cloneComposer,
            Severity: Minor
            Found in lib/chains/playstationVideoChain.js - About 1 hr to fix

              Function composeConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              const composeConfig = (argv) => {
                  if (argv.configFile) {
                      console.warn('Warning: You are using deprecated argument --config-file. Please use --override-config-file or --base-config-file instead.');
                      if (argv.baseConfigFile || argv.overrideConfigFile) {
                          throw new SuitestError('Combination of deprecated --config-file with either --base-config-file or --override-config-file is not allowed');
              Severity: Minor
              Found in lib/testLauncher/composeConfig.js - About 55 mins 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 (err.keyword === 'enum') {
                              return `${err.message}: "${err.params.allowedValues.join('", "')}"`; // -> ...of the allowed values: "all", "currentUrl"
                          }
              Severity: Minor
              Found in lib/validation/validators.js and 1 other location - About 55 mins to fix
              lib/validation/validators.js on lines 85..87

              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 53.

              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 2 locations. Consider refactoring.
              Open

                  if (err.keyword === 'enum') {
                      return `${err.message}: "${err.params.allowedValues.join('", "')}"`; // -> ...of the allowed values: "all", "currentUrl"
                  }
              Severity: Minor
              Found in lib/validation/validators.js and 1 other location - About 55 mins to fix
              lib/validation/validators.js on lines 129..131

              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 53.

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

              const getSnippetLogs = ({testId, definitions, results, level, verbosity}, translate = chainUtils.translateLineResult) => {
                  const indent = ' '.repeat(level);
                  // Indent all text by indent constant
                  const applyIndent = (str) => str.split('\n').map(l => indent + l).join('\n');
                  // array of definition without comments to get right def based on lineId in results
              Severity: Minor
              Found in lib/utils/socketErrorMessages.js - About 45 mins 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 request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              async function request(url, requestObject, onFail) {
                  if (requestObject.body) {
                      requestObject.body = JSON.stringify(requestObject.body);
              
                      if (!requestObject.headers) {
              Severity: Minor
              Found in lib/api/request.js - About 45 mins 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 runTestFactory has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 (lineType === 'click' || lineType === 'tap' || lineType === 'scroll' || lineType === 'swipe') {
                          socketMessage.request = compose(
                              msg => applyUntilCondition(msg, data),
                              msg => applyCountAndDelayAndActions(msg, data),
                          )({...socketMessage.request});
              Severity: Minor
              Found in lib/chains/positionChain.js and 1 other location - About 45 mins to fix
              lib/chains/relativePositionChain.js on lines 47..52

              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 50.

              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 2 locations. Consider refactoring.
              Open

                      if (lineType === 'click') {
                          socketMessage.request = compose(
                              msg => applyUntilCondition(msg, data),
                              msg => applyCountAndDelayAndActions(msg, data),
                          )({...socketMessage.request});
              Severity: Minor
              Found in lib/chains/relativePositionChain.js and 1 other location - About 45 mins to fix
              lib/chains/positionChain.js on lines 67..72

              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 50.

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              const responseMatchesComposer = makeModifierComposer(
                  composers.RESPONSE_MATCHES,
                  ['responseMatch', 'responseMatches'],
                  (_, data, ...args) => ({
                      ...data,
              Severity: Major
              Found in lib/composers/responseMatchesComposer.js and 2 other locations - About 40 mins to fix
              lib/composers/matchRepoComposer.js on lines 41..54
              lib/composers/requestMatchesComposer.js on lines 37..51

              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 79.

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              const requestMatchesComposer = makeModifierComposer(
                  composers.REQUEST_MATCHES,
                  ['requestMatch', 'requestMatches'],
                  (_, data, ...args) => ({
                      ...data,
              Severity: Major
              Found in lib/composers/requestMatchesComposer.js and 2 other locations - About 40 mins to fix
              lib/composers/matchRepoComposer.js on lines 41..54
              lib/composers/responseMatchesComposer.js on lines 38..52

              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 79.

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              const matchRepoComposer = makeModifierComposer(
                  composers.MATCH_REPO,
                  ['matchRepo', 'matchesRepo'],
                  (_, data, ...args) => ({
                      ...data,
              Severity: Major
              Found in lib/composers/matchRepoComposer.js and 2 other locations - About 40 mins to fix
              lib/composers/requestMatchesComposer.js on lines 37..51
              lib/composers/responseMatchesComposer.js on lines 38..52

              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 79.

              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

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

                  const getComposers = data => {
                      const output = [
                          toStringComposer,
                          thenComposer,
                          cloneComposer,
              Severity: Minor
              Found in lib/chains/clearAppDataChain.js and 1 other location - About 40 mins to fix
              lib/chains/pollUrlChain.js on lines 43..61

              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 79.

              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

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

                  const getComposers = data => {
                      const output = [
                          toStringComposer,
                          thenComposer,
                          gettersComposer,
              Severity: Minor
              Found in lib/chains/pollUrlChain.js and 1 other location - About 40 mins to fix
              lib/chains/clearAppDataChain.js on lines 32..50

              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 79.

              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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              const isStoppedComposer = makeModifierComposer(composers.MATCH, ['isStopped'], (_, data) => ({
                  ...data,
                  comparator: {
                      type: SUBJ_COMPARATOR.MATCH,
                      props: [{
              Severity: Minor
              Found in lib/composers/videoComposers.js and 2 other locations - About 40 mins to fix
              lib/composers/videoComposers.js on lines 7..17
              lib/composers/videoComposers.js on lines 31..41

              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 78.

              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