danielwippermann/resol-vbus

View on GitHub

Showing 212 of 557 total issues

Function getDeviceSpecification has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getDeviceSpecification(selfAddress, peerAddress, channel) {
        if (typeof selfAddress === 'object') {
            if (peerAddress === 'source') {
                ({ channel } = selfAddress);
                peerAddress = selfAddress.destinationAddress;
Severity: Major
Found in src/specification.js - About 2 hrs to fix

    ValuesWrapper has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ValuesWrapper {
    
        constructor(pattern, values) {
            this.pattern = pattern;
            this.values = values;
    Severity: Minor
    Found in src/base-configuration-optimizer.js - About 2 hrs to fix

      Function _convertHeaders has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          _convertHeaders(timestamp, headers) {
              const buffers = [];
      
              const createBuffer = function(type, length, timestamp) {
                  const buffer = Buffer.alloc(length);
      Severity: Minor
      Found in src/vbus-recording-converter.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 sendBroadcastIPv6 has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static async sendBroadcastIPv6(options) {
              options = applyDefaultOptions({}, options, {
                  broadcastAddress: 'ff02::1',
                  localAddress: null,
                  broadcastInterface: null,
      Severity: Major
      Found in src/tcp-data-source-provider.js - About 2 hrs to fix

        Function headersData has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                const headersData = packetInfoList.reduce((memo, packetInfo, packetInfoIndex) => {
                    if (packetInfo.packetFields.length >= 0) {
                        const fieldsData = packetInfo.packetFields.map((packetField, packetFieldIndex) => {
                            const fieldData = {
                                id: packetField.packetFieldSpec.fieldId,
        Severity: Major
        Found in src/dlx-json-converter.js - About 2 hrs to fix

          File tcp-data-source-provider.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*! resol-vbus | Copyright (c) 2013-present, Daniel Wippermann | MIT license */
          
          const dgram = require('dgram');
          const http = require('http');
          
          
          Severity: Minor
          Found in src/tcp-data-source-provider.js - About 2 hrs to fix

            Function _convertHeaderSetToJson has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _convertHeaderSetToJson(headerSet) {
                    const spec = this.specification;
            
                    const { i18n } = spec;
            
            
            Severity: Major
            Found in src/dlx-json-converter.js - About 2 hrs to fix

              Function startPvOutputOrgLogging has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const startPvOutputOrgLogging = async () => {
                  const onHeaderSet = async (headerSet) => {
                      const headers = headerSet.getSortedHeaders();
                      const packetFields = specification.getPacketFieldsForHeaders(headers);
              
              
              Severity: Minor
              Found in examples/vbustouch-proxy/index.js - About 2 hrs to fix

                Function _deserializeLine has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _deserializeLine(parent, model) {
                        this._filterProperties(parent, function(key, child) {
                            switch (key) {
                            case 'id':
                                model.id = this._getStringValue(child);
                Severity: Minor
                Found in tools/configuration-importer/configuration-xml-deserializer.js - About 2 hrs to fix

                  Function result has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          const result = conversions.reduce((valueInfo, conversion) => {
                              let { rawValue } = valueInfo;
                              const { sourceUnit, targetUnit } = conversion;
                              const unitFamily = sourceUnit && sourceUnit.unitFamily;
                  
                  
                  Severity: Minor
                  Found in src/specification.js - About 2 hrs to fix

                    Function loadSpecificationData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        static loadSpecificationData(rawSpecificationData, options) {
                            if (rawSpecificationData === undefined) {
                                rawSpecificationData = {};
                            }
                            if (options === undefined) {
                    Severity: Minor
                    Found in src/specification.js - About 1 hr to fix

                      Function fetchDeviceInformation has 48 lines of code (exceeds 25 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 1 hr to fix

                        Function getBlockTypeFieldsForSections has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            getBlockTypeFieldsForSections(sections) {
                                const _this = this;
                        
                                const sectionByBlockTypeId = sections.reduce((memo, section) => {
                                    memo [section.sectionId] = section;
                        Severity: Minor
                        Found in src/specification.js - About 1 hr to fix

                          Function transceive has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                              async transceive(txData, options) {
                                  options = applyDefaultOptions({}, options, {
                                      timeout: 500,
                                      timeoutIncr: 0,
                                      tries: 1,
                          Severity: Minor
                          Found in src/connection.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 getRawValue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                              getRawValue(pt, ptf, buffer, start, end) {
                                  let rawValue = 0, valid = false;
                                  for (const part of ptf.parts) {
                                      if (start + part.offset < end) {
                                          let partValue;
                          Severity: Minor
                          Found in src/specification-file.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 _saveConfiguration has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                          Open

                              async _saveConfiguration(newConfiguration, oldConfigurstion, options) {
                                  options = {
                                      action: 'set',
                                      actionOptions: {
                                          save: true,
                          Severity: Minor
                          Found in src/connection-customizer.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 getPacketSpecification has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              getPacketSpecification(headerOrChannel, destinationAddress, sourceAddress, command) {
                                  if (typeof headerOrChannel === 'object') {
                                      ({ command, sourceAddress, destinationAddress } = headerOrChannel);
                                      headerOrChannel = headerOrChannel.channel;
                                  } else if (typeof headerOrChannel === 'string') {
                          Severity: Minor
                          Found in src/specification.js - About 1 hr to fix

                            Function _deserializeValue has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                _deserializeValue(parent, model) {
                                    this._filterProperties(parent, function(key, child) {
                                        switch (key) {
                                        case 'id':
                                            model.id = this._getStringValue(child);
                            Severity: Minor
                            Found in tools/configuration-importer/configuration-xml-deserializer.js - About 1 hr to fix

                              Function handleVBus has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function handleVBus(connection, selfAddress, state) {
                                  let lastResistor = -1;
                              
                                  while (true) {
                                      const rxPacket = await connection.transceive(null, {
                              Severity: Minor
                              Found in examples/em-simulator/main.js - About 1 hr to fix

                                Function _createInt16BlockTypeFieldSpecification has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    _createInt16BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                                        return {
                                            fieldId: sprintf('%s_%03d_2_0', fieldIdPrefix, offset),
                                            name,
                                            type: this.getTypeById(typeId),
                                Severity: Minor
                                Found in src/specification.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language