danielwippermann/resol-vbus

View on GitHub

Showing 212 of 557 total issues

Function _getAdjustableValues has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _getAdjustableValues() {
        const data = this.constructor.configurationData;

        const typeById = (data.types || []).reduce((memo, type) => {
            memo [type.id] = type;
Severity: Major
Found in src/base-configuration-optimizer.js - About 2 hrs to fix

    Function convertHeaderSet has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        convertHeaderSet(headerSet) {
            const _this = this;
    
            const spec = this.specification;
    
    
    Severity: Major
    Found in src/text-converter.js - About 2 hrs to fix

      Function main has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function main(argv, options) {
          const args = new ArgParser(argv);
      
          function usage(message) {
              args.printUsage(message, [
      Severity: Major
      Found in examples/customizer2/src/main.js - About 2 hrs to fix

        Function formatTextValueFromRawValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            formatTextValueFromRawValue(packetField, rawValue, unit) {
                let textValue;
        
                if ((rawValue !== undefined) && (rawValue !== null)) {
                    if (typeof unit === 'string') {
        Severity: Minor
        Found in src/specification.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 formatTextValueFromRawValueInternal has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            formatTextValueFromRawValueInternal(rawValue, unit, rootType, precision, defaultUnit) {
                const unitText = unit ? unit.unitText : defaultUnit ? defaultUnit.unitText : '';
        
                let result, textValue, format;
                if ((rawValue === undefined) || (rawValue === null)) {
        Severity: Minor
        Found in src/specification.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 updateCacheForValues has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        async function updateCacheForValues(connection, peerAddress, cache, values) {
            let knownValues = 0, unknownValues = 0;
            for (const value of values) {
                const { valueIndex } = cache.getValueInfoByIndexOrId(value.valueIndex, value.valueId);
                if (valueIndex) {
        Severity: Minor
        Found in examples/customizer2/src/customizer.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 _createUInt32BlockTypeFieldSpecification has a Cognitive Complexity of 19 (exceeds 5 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: Minor
        Found in src/specification.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 _deserializeType has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Connection has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Connection extends Duplex {
          
              /**
               * Creates a new Connection instance and optionally initializes its member with the given values.
               *
          Severity: Minor
          Found in src/connection.js - About 2 hrs to fix

            Function getBlockTypeSectionsForHeaders has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getBlockTypeSectionsForHeaders(headers) {
                    const _this = this;
            
                    return headers.reduce((memo, header) => {
                        if (((header.getProtocolVersion() & 0xF0) === 0x10) && (header.destinationAddress === 0x0015) && (header.command === 0x0100)) {
            Severity: Major
            Found in src/specification.js - About 2 hrs to fix

              Function storeSpecificationData has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static storeSpecificationData(options) {
                      if (options === undefined) {
                          options = {};
                      }
                      if (options instanceof Specification) {
              Severity: Major
              Found in src/specification.js - About 2 hrs to fix

                Function processLine has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                const processLine = function(line) {
                                    let md;
                                    if ((md = /^CONNECT (.*)$/.exec(line))) {
                                        const viaTagString = md [1];
                                        if (_this.verifyViaTag) {
                Severity: Major
                Found in src/tcp-connection-endpoint.js - About 2 hrs to fix

                  Function _deserializeMenuSystem has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _deserializeMenuSystem(parent, model) {
                          this._filterProperties(parent, function(key, child) {
                              switch (key) {
                              case 'language':
                                  model.languages.push(this._deserializeLanguage(child, new models.LanguageModel()));
                  Severity: Major
                  Found in tools/configuration-importer/configuration-xml-deserializer.js - About 2 hrs to fix

                    Function _processBuffer has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _processBuffer(chunk, endOfStream, processRecord) {
                            let buffer;
                            if (this.rxBuffer) {
                                buffer = Buffer.concat([ this.rxBuffer, chunk ]);
                            } else {
                    Severity: Major
                    Found in src/vbus-recording-converter.js - About 2 hrs to fix

                      Function _convertHeaders has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _convertHeaders(timestamp, headers) {
                              const buffers = [];
                      
                              const createBuffer = function(type, length, timestamp) {
                                  const buffer = Buffer.alloc(length);
                      Severity: Major
                      Found in src/vbus-recording-converter.js - About 2 hrs to fix

                        Function fields has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            const fields = docFields.map(docField => {
                                const x = +(docField.x [0]);
                                const y = +(docField.y [0]);
                                const width = +(docField.width [0]);
                                const height = +(docField.height [0]);
                        Severity: Major
                        Found in tools/rsc-scheme-converter/main.js - About 2 hrs to fix

                          Function getBlockTypePacketSpecificationsForSections has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              getBlockTypePacketSpecificationsForSections(sections) {
                                  const _this = this;
                          
                                  return sections.reduce((memo, section) => {
                                      const { sectionId } = section;
                          Severity: Major
                          Found in src/specification.js - About 2 hrs to fix

                            Function onHeaderSet has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Function sendBroadcast has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

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

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

                                const rewriteWebHeaderSet = function(headerSet) {
                                    const timestamp = headerSet.timestamp;
                                
                                    /*
                                     * Get list of packet fields in the received packets.
                                Severity: Major
                                Found in examples/vbustouch-proxy/index.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language