danielwippermann/resol-vbus

View on GitHub

Showing 212 of 557 total issues

Avoid deeply nested control flow statements.
Open

                        if (numericValue.charAt(0) === '#') {
                            const valueTextId = numericValue.slice(1);
                            const valueText = refValue.valueTextById [valueTextId];
                            if (valueText !== undefined) {
                                numericValue = valueText;
Severity: Major
Found in src/base-configuration-optimizer.js - About 45 mins to fix

    Function generateDLxDownloadDownloadResponse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    async function generateDLxDownloadDownloadResponse(rawQuery) {
        const query = {
            source: rawQuery.source,
            outputType: rawQuery.outputType,
            dataLanguage: rawQuery.dataLanguage || 'en',
    Severity: Minor
    Found in examples/json-live-data-server/index.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

    Avoid deeply nested control flow statements.
    Open

                                if (channel) {
                                    memo.push('*' + index + ':' + channel);
                                }
    Severity: Major
    Found in src/tcp-connection-endpoint.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          } else if (version === 0x20) {
                              if (!Header.calcAndCompareChecksum(version, buffer, start + 1, start + 15)) {
                                  valid = false;
                              }
                          } else if (version === 0x30) {
      Severity: Major
      Found in src/connection.js - About 45 mins to fix

        Function startTextLogging has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const startTextLogging = async () => {
            let currentDatecode = null;
        
            let currentConverter = null;
        
        
        Severity: Minor
        Found in examples/vbustouch-proxy/index.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

        Avoid deeply nested control flow statements.
        Open

                            } else if ((md = /^CHANNEL (\d+)$/.exec(line))) {
                                const channelString = md [1];
                                const index = +channelString;
                                const channel = _this.channels [index];
                                if (_this.verifyChannel) {
        Severity: Major
        Found in src/tcp-connection-endpoint.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if (buffer.length >= 26 + dataLength) {
                              const frameCount = Math.floor(dataLength / 7);
          
                              const frameData = Buffer.alloc(3 * 7);
                              buffer.copy(frameData, 0, 26, 26 + dataLength);
          Severity: Major
          Found in src/vbus-recording-converter.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (!Header.calcAndCompareChecksum(version, buffer, start + 1, start + 9)) {
                                        // console.log('checksum error in header');
                                        valid = false;
                                    }
            Severity: Major
            Found in src/connection.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (majorVersion === 1) {
                                          if (this.listenerCount('packet') > 0) {
                                              const packet = Packet.fromLiveBuffer(buffer, start, index);
                                              packet.timestamp = new Date(timestamp);
                                              packet.channel = this.channel;
              Severity: Major
              Found in src/connection.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if (start < index) {
                                                    const line = buffer.toString('utf8', start, index);
                                                    start = index + 1;
                                                    processLine(line);
                                                    break;
                Severity: Major
                Found in src/tcp-connection-endpoint.js - About 45 mins to fix

                  Function setPacketFieldRawValues has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      setPacketFieldRawValues(packetFields, rawValues) {
                          const _this = this;
                  
                          const packetFieldById = packetFields.reduce((memo, packetField) => {
                              memo [packetField.id] = packetField;
                  Severity: Minor
                  Found in src/specification.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

                  Avoid deeply nested control flow statements.
                  Open

                                          if (isPromise(channelListCallbackResult)) {
                                              channelListCallbackResult.then(result => {
                                                  channelListCallbackDone(null, result);
                                              }, err => {
                                                  channelListCallbackDone(err);
                  Severity: Major
                  Found in src/tcp-connection.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        } else if (phase === 80) {
                                            newPhase = 900;
                                        } else if (phase === 900) {
                                            newPhase = 1000;
                                        }
                    Severity: Major
                    Found in src/tcp-connection.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (err) {
                                                      _this.socket.destroy();
                                                      _this.socket = null;
                      
                                                      _this._setConnectionState(TcpConnection.STATE_DISCONNECTED);
                      Severity: Major
                      Found in src/tcp-connection.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (md) {
                                                    channelList.push({
                                                        channel: md [1],
                                                        name: md [2],
                                                    });
                        Severity: Major
                        Found in src/tcp-connection.js - About 45 mins to fix

                          Function t has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              t(key, ...args) {
                                  const parts = key.split('.');
                          
                                  const languages = [ this.language, 'dev' ];
                          
                          
                          Severity: Minor
                          Found in src/i18n.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 processBlockTable has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  const processBlockTable = function(blockName, tableCount, tableOffset, blockSize, cb) {
                          Severity: Minor
                          Found in src/specification-file.js - About 35 mins to fix

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

                                static async fetchDeviceInformation(addressOrOptions, port) {
                                    if (port === undefined) {
                                        try {
                                            return await TcpDataSourceProvider.fetchDeviceInformation(addressOrOptions, 80);
                                        } catch (err) {
                            Severity: Minor
                            Found in src/tcp-data-source-provider.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 ping has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                ping(address, valueId, value, options) {
                                    options = applyDefaultOptions({}, options, {
                                        timeout: 500,
                                        timeoutIncr: 500,
                                        tries: 3,
                            Severity: Minor
                            Found in src/connection.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 setValueById has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                setValueById(address, valueId, value, options) {
                                    const _this = this;
                            
                                    options = applyDefaultOptions({}, options, {
                                        timeout: 500,
                            Severity: Minor
                            Found in src/connection.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

                            Severity
                            Category
                            Status
                            Source
                            Language