danielwippermann/resol-vbus

View on GitHub

Showing 212 of 557 total issues

Function runSingleShot has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const runSingleShot = async (argv) => {
    const context = {};

    try {
        if (argv.q) {
Severity: Major
Found in examples/customizer/index.js - About 3 hrs to fix

    Function transceiveConfiguration has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async transceiveConfiguration(options, optimizerCallback) {
            if (typeof options === 'function') {
                optimizerCallback = options;
                options = null;
            }
    Severity: Major
    Found in src/connection-customizer.js - About 3 hrs to fix

      Function _processRecord has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          _processRecord(buffer) {
              const type = buffer [1] & 0x0F;
              const timestamp = moreints.readUInt64LE(buffer, 6);
      
              if (type === 3) {
      Severity: Minor
      Found in src/vbus-recording-converter.js - About 3 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 getDeviceSpecification has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          getDeviceSpecification(selfAddress, peerAddress, channel) {
              if (typeof selfAddress === 'object') {
                  if (peerAddress === 'source') {
                      ({ channel } = selfAddress);
                      peerAddress = selfAddress.destinationAddress;
      Severity: Minor
      Found in src/specification.js - About 3 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 transceiveConfiguration has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          async transceiveConfiguration(options, optimizerCallback) {
              if (typeof options === 'function') {
                  optimizerCallback = options;
                  options = null;
              }
      Severity: Minor
      Found in src/connection-customizer.js - About 3 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

      File connection-customizer.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*! resol-vbus | Copyright (c) 2013-present, Daniel Wippermann | MIT license */
      
      const {
          applyDefaultOptions,
          isNumber,
      Severity: Minor
      Found in src/connection-customizer.js - About 3 hrs to fix

        Function transceive has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async transceive(txData, options) {
                options = applyDefaultOptions({}, options, {
                    timeout: 500,
                    timeoutIncr: 0,
                    tries: 1,
        Severity: Major
        Found in src/connection.js - About 3 hrs to fix

          Function main has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          async function main(options) {
              const { signal, onListen, onRunning } = (options || {});
          
              logger.debug('Starting server...');
          
          
          Severity: Minor
          Found in examples/json-live-data-server/index.js - About 3 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 main has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          async function main(args) {
              let inputRscFilename = null;
              let inputImageFilename = null;
              let outputJsFilename = null;
          
          
          Severity: Minor
          Found in tools/rsc-scheme-converter/main.js - About 3 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

          File tcp-connection.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*! resol-vbus | Copyright (c) 2013-present, Daniel Wippermann | MIT license */
          
          const net = require('net');
          const tls = require('tls');
          
          
          Severity: Minor
          Found in src/tcp-connection.js - About 3 hrs to fix

            Function startMqttLogging has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const startMqttLogging = async () => {
                const onHeaderSet = async (headerSet, client) => {
                    const headers = headerSet.getSortedHeaders();
                    const packetFields = specification.getPacketFieldsForHeaders(headers);
            
            
            Severity: Major
            Found in examples/vbustouch-proxy/index.js - About 3 hrs to fix

              Function _convertEnergyRawValue has 79 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _convertEnergyRawValue(rawValue, sourceUnitCode, targetUnitCode) {
                      switch (sourceUnitCode) {
                      case 'WattHours':
                          // nop
                          break;
              Severity: Major
              Found in src/specification.js - About 3 hrs to fix

                Function startMqttLogging has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                const startMqttLogging = async () => {
                    const onHeaderSet = async (headerSet, client) => {
                        const headers = headerSet.getSortedHeaders();
                        const packetFields = specification.getPacketFieldsForHeaders(headers);
                
                
                Severity: Minor
                Found in examples/vbustouch-proxy/index.js - About 3 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 main has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                async function main(argv, options) {
                    const args = new ArgParser(argv);
                
                    function usage(message) {
                        args.printUsage(message, [
                Severity: Minor
                Found in examples/customizer2/src/main.js - About 3 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 _createUInt32BlockTypeFieldSpecification has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _createUInt32BlockTypeFieldSpecification(fieldIdPrefix, offset, name, typeId, factor) {
                        return {
                            fieldId: sprintf('%s_%03d_4_0', fieldIdPrefix, offset),
                            name,
                            type: this.getTypeById(typeId),
                Severity: Major
                Found in src/specification.js - About 2 hrs to fix

                  Function getPacketFieldsForHeaders has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      getPacketFieldsForHeaders(headers) {
                          const _this = this;
                  
                          // filter out all packets
                          const packets = headers.reduce((memo, header) => {
                  Severity: Major
                  Found in src/specification.js - About 2 hrs to fix

                    Function discover has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    async function discover() {
                        const interfaceMap = os.networkInterfaces();
                    
                        const interfaceNames = Object.getOwnPropertyNames(interfaceMap);
                    
                    
                    Severity: Major
                    Found in examples/discovery/index.js - About 2 hrs to fix

                      Function convertRawValue has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          convertRawValue(rawValue_, sourceUnit_, targetUnit_) {
                              const that = this;
                      
                              let conversions;
                              if (Array.isArray(sourceUnit_)) {
                      Severity: Major
                      Found in src/specification.js - About 2 hrs to fix

                        Function discover has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                        async function discover() {
                            const interfaceMap = os.networkInterfaces();
                        
                            const interfaceNames = Object.getOwnPropertyNames(interfaceMap);
                        
                        
                        Severity: Minor
                        Found in examples/discovery/index.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 mergeTypes has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const mergeTypes = function(menuSystem) {
                            const typeById = _.reduce(menuSystem.types, (memo, type) => {
                                memo [type.id] = type;
                                return memo;
                            }, {});
                        Severity: Major
                        Found in tools/configuration-importer/index.js - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language