SuitestAutomation/suitest-js-api

View on GitHub

Showing 123 of 181 total issues

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

    Function setScreenOrientationFactory has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function chainedPromise has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              const chainedPromise = chainPromise(async() => {
                  let promise;
      
                  if (promiseMap.has(data)) {
                      promise = promiseMap.get(data);
      Severity: Minor
      Found in lib/composers/thenComposer.js - About 1 hr to fix

        Function pollUrlFactory has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const pollUrlFactory = (classInstance) => {
            const toJSON = (data) => {
                const type = getRequestType(data, false);
                const {url = '', response = ''} = data;
        
        
        Severity: Minor
        Found in lib/chains/pollUrlChain.js - About 1 hr to fix

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

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

            Function readRcConfig has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function readRcConfig(pathToConfig) {
                let mainConfigFilePath = '';
            
                if (pathToConfig) {
                    mainConfigFilePath = pathToConfig;
            Severity: Minor
            Found in lib/testLauncher/composeConfig.js - About 1 hr to fix

              Function sleepFactory has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function executeBrightScriptFactory has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function executeCommandFactory has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function prettifyJsonSchemaErrors has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function prettifyJsonSchemaErrors(validate) {
                        let errors = [];
                    
                        if (validate.schema.schemaId === validationKeys.ELEMENT_PROPS) {
                            errors = prettifyElementPropsErrors(validate);
                    Severity: Minor
                    Found in lib/validation/validators.js - About 1 hr to fix

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

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

                        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',
                        Severity: Minor
                        Found in lib/chains/openUrlChain.js - About 1 hr to fix

                          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;
                          Severity: Minor
                          Found in lib/testLauncher/SuitestLauncher.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 getComposers has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            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',
                            Severity: Minor
                            Found in lib/chains/suspendAppChain.js - About 1 hr to fix

                              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',
                              Severity: Minor
                              Found in lib/chains/closeAppChain.js - About 1 hr to fix

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

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

                                  Function clearAppDataFactory has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const clearAppDataFactory = (classInstance) => {
                                      const toJSON = () => ({
                                          type: 'eval',
                                          request: {
                                              type: 'clearAppData',
                                  Severity: Minor
                                  Found in lib/chains/clearAppDataChain.js - About 1 hr to fix

                                    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},
                                    Severity: Minor
                                    Found in lib/chains/windowChain.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language