danielwippermann/resol-vbus

View on GitHub

Showing 212 of 557 total issues

Function generateKM2WebserviceResponse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

async function generateKM2WebserviceResponse(requestBody) {
    const isBatchRequest = Array.isArray(requestBody);
    const requests = isBatchRequest ? requestBody : [ requestBody ];
    const replies = [];
    for (const request of requests) {
Severity: Minor
Found in examples/json-live-data-server/index.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 _check has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    _check(action, checker, options) {
        const _this = this;

        options = {
            includeUndefined: true,
Severity: Minor
Found in src/base-configuration-optimizer.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 getListOfFiles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    static async getListOfFiles(dirname, minDatecode, maxDatecode) {
        const entries = await fs.readdir(dirname, { withFileTypes: true });
        const files = [];
        for (const entry of entries) {
            if (!entry.isFile()) {
Severity: Minor
Found in src/file-list-reader.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 _filterProperties has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    _filterProperties(parent, iterator) {
        const _this = this;

        const originalStack = _.clone(this.stack);

Severity: Minor
Found in tools/configuration-importer/xml-deserializer.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 openSerialPort has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function openSerialPort(config) {
    debugLog('Opening serial port...');

    const port = await new Promise((resolve, reject) => {
        const port = new SerialPort(config.path, {
Severity: Minor
Found in examples/serial-to-tcp/main.js - About 1 hr to fix

    Function _processType3Record has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _processType3Record(buffer, timestamp) {
            const destinationAddress = buffer.readUInt16LE(14);
            const sourceAddress = buffer.readUInt16LE(16);
            const protocolVersion = buffer.readUInt16LE(18);
    
    
    Severity: Minor
    Found in src/vbus-recording-converter.js - About 1 hr to fix

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

        Function _buildConfiguration has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _buildConfiguration(oldConfig) {
                if (oldConfig === undefined) {
                    oldConfig = [];
                }
        
        
        Severity: Minor
        Found in src/base-configuration-optimizer.js - About 1 hr to fix

          Function getValueById has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getValueById(address, valueId, options) {
                  const _this = this;
          
                  options = applyDefaultOptions({}, options, {
                      timeout: 500,
          Severity: Minor
          Found in src/connection.js - About 1 hr to fix

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

            async function generateKM2WebserviceResponse(requestBody) {
                const isBatchRequest = Array.isArray(requestBody);
                const requests = isBatchRequest ? requestBody : [ requestBody ];
                const replies = [];
                for (const request of requests) {
            Severity: Minor
            Found in examples/json-live-data-server/index.js - About 1 hr to fix

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

              async function startDiscoveryServices() {
                  debugLog('Starting discovery web service...');
              
                  const webReplyContent = [
                      'vendor = "RESOL"',
              Severity: Minor
              Found in examples/serial-to-tcp/main.js - About 1 hr to fix

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

                const startTextLogging = async () => {
                    let currentDatecode = null;
                
                    let currentConverter = null;
                
                
                Severity: Minor
                Found in examples/vbustouch-proxy/index.js - About 1 hr to fix

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

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

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

                    const filterPrefsValues = function(menuSystem) {
                        const valueById = {};
                        _.forEach(menuSystem.values, (value) => {
                            valueById [value.id] = value;
                        });
                    Severity: Minor
                    Found in tools/configuration-importer/index.js - About 1 hr to fix

                      Function performTransaction has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function performTransaction(connection, fn) {
                          let result;
                      
                          logger.debug('Waiting for free bus...');
                      
                      
                      Severity: Minor
                      Found in examples/customizer2/src/customizer.js - About 1 hr to fix

                        Function adjustableValues has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                const adjustableValues = data.values.reduce((memo, value) => {
                                    if (adjustableValueIds [value.id]) {
                                        const valueTextById = {};
                                        const addValueText = (valueText, index) => {
                                            if (valueText.id && !hasOwnProperty(valueTextById, valueText.id)) {
                        Severity: Minor
                        Found in src/base-configuration-optimizer.js - About 1 hr to fix

                          Function processDownloadDownloadRequest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const processDownloadDownloadRequest = async (req, res) => {
                              try {
                                  const i18n = specification.i18n;
                          
                                  const startDate = req.query.startDate ? i18n.momentUtc(req.query.startDate, 'MM/DD/YYYY') : i18n.momentUtc();
                          Severity: Minor
                          Found in examples/vbustouch-proxy/index.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 startPvOutputOrgLogging has a Cognitive Complexity of 11 (exceeds 5 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 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 _loadConfiguration has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              async _loadConfiguration(configuration, options) {
                                  options = {
                                      action: 'get',
                                      ...options,
                                  };
                          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 _createInt16BlockTypeFieldSpecification has a Cognitive Complexity of 11 (exceeds 5 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

                          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