SuitestAutomation/suitest-js-api

View on GitHub

Showing 123 of 181 total issues

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

Function unusedExpressionWatchersFactory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const unusedExpressionWatchersFactory = ({logger}) => {
    /**
     * Pool of chains, that were not awaited for
     * @type {Set<any>}
     */
Severity: Minor
Found in lib/utils/unusedExpressionWatchers.js - About 35 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 pairDevice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

async function pairDevice(
    {webSockets, authContext, logger, pairedDeviceContext, config},
    deviceId,
    recordingSettings
) {
Severity: Minor
Found in lib/commands/pairDevice.js - About 35 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 validateRepoProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const validateRepoProps = ({props, data, text}) => {
    const selector = path(['selector'], data) || {};

    if (has('apiId', selector)) {
        return props;
Severity: Minor
Found in lib/validation/validators.js - About 35 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 getDeviceName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function getDeviceName(deviceInfo, short = false) {
    const {manufacturer, model, customName, deviceId} = deviceInfo;

    let name;

Severity: Minor
Found in lib/utils/getDeviceInfo.js - About 35 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

Avoid too many return statements within this function.
Open

            return;
Severity: Major
Found in lib/utils/socketChainHelper.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return fs.promises
                        .access(dir)
                        .catch(() => fs.promises.mkdir(dir))
                        .then(() => fs.promises.writeFile(data.fileName, res.buffer))
                        .catch(e => {
    Severity: Major
    Found in lib/utils/socketChainHelper.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return 'dismissAlertMessage';
      Severity: Major
      Found in lib/chains/windowChain.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                return subtype === 'time'
                                    ? `Timer '${val1}' already exists`
                                    : `Timer '${val1}' does not exist`;
        Severity: Major
        Found in lib/utils/logger.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return res.buffer;
          Severity: Major
          Found in lib/utils/socketChainHelper.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 'acceptAlertMessage';
            Severity: Major
            Found in lib/chains/windowChain.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return `${val1}: ${val2}`;
              Severity: Major
              Found in lib/utils/logger.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return res.buffer.toString('base64');
                Severity: Major
                Found in lib/utils/socketChainHelper.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                      return val1.join('\n');
                  Severity: Major
                  Found in lib/utils/logger.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return 'acceptPromptMessage';
                    Severity: Major
                    Found in lib/chains/windowChain.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return val1;
                      Severity: Major
                      Found in lib/utils/logger.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                            return `${val1}: ${val2}ms`;
                        Severity: Major
                        Found in lib/utils/logger.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                  return `Count for '${val1}' does not exist`;
                          Severity: Major
                          Found in lib/utils/logger.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return;
                            Severity: Major
                            Found in lib/utils/socketChainHelper.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language