influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.92k stars 5.6k forks source link

Linter: revive, Rule: `cognitive-complexity` - Measures of how hard code is to understand. Should we enable it? #15805

Closed zak-pawel closed 3 months ago

zak-pawel commented 3 months ago

Description

This issue starts a discussion about enabling:

Configuration:

(int) the maximum function complexity

Example configuration:

      - name: cognitive-complexity
        exclude: ["TEST"]
        arguments: [20]

Expected output

Decision about enabling or not enabling this rule.

Findings

For this rule (with above configuration), the following findings were found in the current codebase:

agent/agent.go:103:1                                                         revive  cognitive-complexity: function (*Agent).Run has cognitive complexity 29 (> max enabled 20)
agent/agent.go:250:1                                                         revive  cognitive-complexity: function (*Agent).initPersister has cognitive complexity 32 (> max enabled 20)
agent/agent.go:472:1                                                         revive  cognitive-complexity: function (*Agent).testRunInputs has cognitive complexity 21 (> max enabled 20)
cmd/telegraf/cmd_config.go:21:1                                              revive  cognitive-complexity: function getConfigCommands has cognitive complexity 56 (> max enabled 20)
cmd/telegraf/cmd_secretstore.go:36:1                                         revive  cognitive-complexity: function getSecretStoreCommands has cognitive complexity 44 (> max enabled 20)
cmd/telegraf/main.go:101:1                                                   revive  cognitive-complexity: function runApp has cognitive complexity 28 (> max enabled 20)
cmd/telegraf/printer.go:104:1                                                revive  cognitive-complexity: function printSampleConfig has cognitive complexity 59 (> max enabled 20)
cmd/telegraf/telegraf.go:137:1                                               revive  cognitive-complexity: function (*Telegraf).reloadLoop has cognitive complexity 49 (> max enabled 20)
cmd/telegraf/telegraf.go:252:1                                               revive  cognitive-complexity: function (*Telegraf).watchRemoteConfigs has cognitive complexity 23 (> max enabled 20)
cmd/telegraf/telegraf.go:336:1                                               revive  cognitive-complexity: function (*Telegraf).runAgent has cognitive complexity 49 (> max enabled 20)
config/config.go:509:1                                                       revive  cognitive-complexity: function (*Config).LoadConfigData has cognitive complexity 158 (> max enabled 20)
config/config.go:1152:1                                                      revive  cognitive-complexity: function (*Config).addOutput has cognitive complexity 24 (> max enabled 20)
config/config.go:1234:1                                                      revive  cognitive-complexity: function (*Config).addInput has cognitive complexity 23 (> max enabled 20)
config/config.go:1715:1                                                      revive  cognitive-complexity: function (*Config).getFieldTagFilter has cognitive complexity 26 (> max enabled 20)
config/deprecation.go:91:1                                                   revive  cognitive-complexity: function (*Config).collectDeprecationInfo has cognitive complexity 28 (> max enabled 20)
config/deprecation.go:193:1                                                  revive  cognitive-complexity: function (*Config).CollectDeprecationInfos has cognitive complexity 28 (> max enabled 20)
config/migration.go:73:1                                                     revive  cognitive-complexity: function assignTextToSections has cognitive complexity 28 (> max enabled 20)
config/migration.go:132:1                                                    revive  cognitive-complexity: function ApplyMigrations has cognitive complexity 41 (> max enabled 20)
internal/snmp/field.go:97:1                                                  revive  cognitive-complexity: function (*Field).Convert has cognitive complexity 57 (> max enabled 20)
internal/snmp/mib_loader.go:47:1                                             revive  cognitive-complexity: function LoadMibsFromPath has cognitive complexity 27 (> max enabled 20)
internal/snmp/mib_loader.go:93:1                                             revive  cognitive-complexity: function walkPaths has cognitive complexity 32 (> max enabled 20)
internal/snmp/table.go:120:1                                                 revive  cognitive-complexity: function (Table).Build has cognitive complexity 151 (> max enabled 20)
internal/snmp/wrapper.go:43:1                                                revive  cognitive-complexity: function NewWrapper has cognitive complexity 21 (> max enabled 20)
internal/templating/engine.go:45:1                                           revive  cognitive-complexity: function parseTemplateSpecs has cognitive complexity 22 (> max enabled 20)
internal/type_conversions.go:104:1                                           revive  cognitive-complexity: function ToUint64 has cognitive complexity 21 (> max enabled 20)
internal/type_conversions.go:171:1                                           revive  cognitive-complexity: function ToUint32 has cognitive complexity 25 (> max enabled 20)
internal/type_conversions.go:245:1                                           revive  cognitive-complexity: function ToUint16 has cognitive complexity 28 (> max enabled 20)
internal/type_conversions.go:322:1                                           revive  cognitive-complexity: function ToUint8 has cognitive complexity 31 (> max enabled 20)
internal/type_conversions.go:460:1                                           revive  cognitive-complexity: function ToInt32 has cognitive complexity 23 (> max enabled 20)
internal/type_conversions.go:531:1                                           revive  cognitive-complexity: function ToInt16 has cognitive complexity 25 (> max enabled 20)
internal/type_conversions.go:605:1                                           revive  cognitive-complexity: function ToInt8 has cognitive complexity 30 (> max enabled 20)
metric/metric.go:290:1                                                       revive  cognitive-complexity: function convertField has cognitive complexity 31 (> max enabled 20)
migrations/general_metricfilter/migration.go:14:1                            revive  cognitive-complexity: function migrate has cognitive complexity 37 (> max enabled 20)
migrations/inputs_cassandra/migration.go:61:1                                revive  cognitive-complexity: function migrate has cognitive complexity 33 (> max enabled 20)
migrations/inputs_httpjson/migration.go:34:1                                 revive  cognitive-complexity: function migrate has cognitive complexity 32 (> max enabled 20)
migrations/inputs_jolokia/migration.go:118:1                                 revive  cognitive-complexity: function migrate has cognitive complexity 34 (> max enabled 20)
migrations/inputs_procstat/migration.go:14:1                                 revive  cognitive-complexity: function migrate has cognitive complexity 30 (> max enabled 20)
models/filter.go:67:1                                                        revive  cognitive-complexity: function (*Filter).Compile has cognitive complexity 31 (> max enabled 20)
models/filter.go:298:1                                                       revive  cognitive-complexity: function ShouldTagsPass has cognitive complexity 42 (> max enabled 20)
plugins/aggregators/basicstats/basicstats.go:72:1                            revive  cognitive-complexity: function (*BasicStats).Add has cognitive complexity 28 (> max enabled 20)
plugins/aggregators/basicstats/basicstats.go:162:1                           revive  cognitive-complexity: function (*BasicStats).Push has cognitive complexity 60 (> max enabled 20)
plugins/aggregators/derivative/derivative.go:118:1                           revive  cognitive-complexity: function (*Derivative).Push has cognitive complexity 21 (> max enabled 20)
plugins/aggregators/minmax/minmax.go:39:1                                    revive  cognitive-complexity: function (*MinMax).Add has cognitive complexity 24 (> max enabled 20)
plugins/aggregators/quantile/quantile.go:40:1                                revive  cognitive-complexity: function (*Quantile).Add has cognitive complexity 24 (> max enabled 20)
plugins/common/encoding/decoder_reader.go:101:1                              revive  cognitive-complexity: function (*Reader).Read has cognitive complexity 30 (> max enabled 20)
plugins/common/jolokia2/gatherer.go:197:1                                    revive  cognitive-complexity: function makeReadRequests has cognitive complexity 24 (> max enabled 20)
plugins/common/opcua/input/input_client.go:310:1                             revive  cognitive-complexity: function (*OpcUAInputClient).InitNodeMetricMapping has cognitive complexity 37 (> max enabled 20)
plugins/common/opcua/opcua_util.go:153:1                                     revive  cognitive-complexity: function (*OpcUAClient).generateClientOpts has cognitive complexity 56 (> max enabled 20)
plugins/common/postgresql/config.go:115:1                                    revive  cognitive-complexity: function toKeyValue has cognitive complexity 21 (> max enabled 20)
plugins/common/shim/config.go:84:1                                           revive  cognitive-complexity: function createPluginsWithTomlConfig has cognitive complexity 27 (> max enabled 20)
plugins/common/socket/datagram.go:33:1                                       revive  cognitive-complexity: function (*packetListener).listenData has cognitive complexity 21 (> max enabled 20)
plugins/common/socket/datagram.go:64:1                                       revive  cognitive-complexity: function (*packetListener).listenConnection has cognitive complexity 25 (> max enabled 20)
plugins/common/socket/splitters.go:28:1                                      revive  cognitive-complexity: function (*SplitConfig).NewSplitter has cognitive complexity 25 (> max enabled 20)
plugins/common/socket/stream.go:126:1                                        revive  cognitive-complexity: function (*streamListener).setupConnection has cognitive complexity 24 (> max enabled 20)
plugins/common/socket/stream.go:272:1                                        revive  cognitive-complexity: function (*streamListener).listenConnection has cognitive complexity 32 (> max enabled 20)
plugins/common/starlark/builtins.go:191:1                                    revive  cognitive-complexity: function dictUpdate has cognitive complexity 49 (> max enabled 20)
plugins/common/tls/config.go:51:1                                            revive  cognitive-complexity: function (*ClientConfig).TLSConfig has cognitive complexity 31 (> max enabled 20)
plugins/common/tls/config.go:152:1                                           revive  cognitive-complexity: function (*ServerConfig).TLSConfig has cognitive complexity 22 (> max enabled 20)
plugins/common/tls/utils.go:41:1                                             revive  cognitive-complexity: function ParseCiphers has cognitive complexity 41 (> max enabled 20)
plugins/common/yangmodel/decoder.go:26:1                                     revive  cognitive-complexity: function NewDecoder has cognitive complexity 69 (> max enabled 20)
plugins/common/yangmodel/decoder.go:151:1                                    revive  cognitive-complexity: function DecodeLeafValue has cognitive complexity 27 (> max enabled 20)
plugins/inputs/aerospike/aerospike.go:100:1                                  revive  cognitive-complexity: function (*Aerospike).gatherServer has cognitive complexity 75 (> max enabled 20)
plugins/inputs/aerospike/aerospike.go:262:1                                  revive  cognitive-complexity: function (*Aerospike).getSets has cognitive complexity 34 (> max enabled 20)
plugins/inputs/aerospike/aerospike.go:375:1                                  revive  cognitive-complexity: function (*Aerospike).parseHistogram has cognitive complexity 33 (> max enabled 20)
plugins/inputs/aliyuncms/aliyuncms.go:272:1                                  revive  cognitive-complexity: function (*AliyunCMS).gatherMetric has cognitive complexity 49 (> max enabled 20)
plugins/inputs/aliyuncms/aliyuncms.go:375:1                                  revive  cognitive-complexity: function (*AliyunCMS).prepareTagsAndDimensions has cognitive complexity 45 (> max enabled 20)
plugins/inputs/amqp_consumer/amqp_consumer.go:386:1                          revive  cognitive-complexity: function (*AMQPConsumer).process has cognitive complexity 21 (> max enabled 20)
plugins/inputs/azure_storage_queue/azure_storage_queue.go:82:1               revive  cognitive-complexity: function (*AzureStorageQueue).Gather has cognitive complexity 21 (> max enabled 20)
plugins/inputs/bind/xml_stats_v3.go:71:1                                     revive  cognitive-complexity: function (*Bind).addStatsXMLv3 has cognitive complexity 22 (> max enabled 20)
plugins/inputs/bond/bond.go:213:1                                            revive  cognitive-complexity: function (*Bond).gatherSlavePart has cognitive complexity 27 (> max enabled 20)
plugins/inputs/ceph/ceph.go:71:1                                             revive  cognitive-complexity: function (*Ceph).gatherAdminSocketStats has cognitive complexity 30 (> max enabled 20)
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:102:1              revive  cognitive-complexity: function (*CiscoTelemetryMDT).Start has cognitive complexity 34 (> max enabled 20)
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:359:1              revive  cognitive-complexity: function (*CiscoTelemetryMDT).handleTelemetry has cognitive complexity 52 (> max enabled 20)
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:561:1              revive  cognitive-complexity: function (*CiscoTelemetryMDT).parseMicroburst has cognitive complexity 21 (> max enabled 20)
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:652:1              revive  cognitive-complexity: function (*CiscoTelemetryMDT).parseContentField has cognitive complexity 90 (> max enabled 20)
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go:104:1             revive  cognitive-complexity: function (*CiscoTelemetryMDT).nxosValueXform has cognitive complexity 26 (> max enabled 20)
plugins/inputs/clickhouse/clickhouse.go:103:1                                revive  cognitive-complexity: function (*ClickHouse).Gather has cognitive complexity 33 (> max enabled 20)
plugins/inputs/cloudwatch/cloudwatch.go:237:1                                revive  cognitive-complexity: function getFilteredMetrics has cognitive complexity 63 (> max enabled 20)
plugins/inputs/cloudwatch_metric_streams/cloudwatch_metric_streams.go:181:1  revive  cognitive-complexity: function (*CloudWatchMetricStreams).serveWrite has cognitive complexity 40 (> max enabled 20)
plugins/inputs/conntrack/conntrack.go:72:1                                   revive  cognitive-complexity: function (*Conntrack).Gather has cognitive complexity 26 (> max enabled 20)
plugins/inputs/consul/consul.go:90:1                                         revive  cognitive-complexity: function (*Consul).GatherHealthCheck has cognitive complexity 23 (> max enabled 20)
plugins/inputs/couchbase/couchbase.go:72:1                                   revive  cognitive-complexity: function (*Couchbase).gatherServer has cognitive complexity 21 (> max enabled 20)
plugins/inputs/cpu/cpu.go:40:1                                               revive  cognitive-complexity: function (*CPUStats).Gather has cognitive complexity 22 (> max enabled 20)
plugins/inputs/ctrlx_datalayer/ctrlx_datalayer.go:314:1                      revive  cognitive-complexity: function (*CtrlXDataLayer).gatherLoop has cognitive complexity 23 (> max enabled 20)
plugins/inputs/dcos/dcos.go:135:1                                            revive  cognitive-complexity: function (*DCOS).GatherContainers has cognitive complexity 30 (> max enabled 20)
plugins/inputs/dcos/dcos.go:187:1                                            revive  cognitive-complexity: function (*DCOS).createPoints has cognitive complexity 27 (> max enabled 20)
plugins/inputs/directory_monitor/directory_monitor.go:81:1                   revive  cognitive-complexity: function (*DirectoryMonitor).Gather has cognitive complexity 25 (> max enabled 20)
plugins/inputs/diskio/diskio.go:64:1                                         revive  cognitive-complexity: function (*DiskIO).Gather has cognitive complexity 30 (> max enabled 20)
plugins/inputs/disque/disque.go:94:1                                         revive  cognitive-complexity: function (*Disque).gatherServer has cognitive complexity 40 (> max enabled 20)
plugins/inputs/dns_query/dns_query.go:110:1                                  revive  cognitive-complexity: function (*DNSQuery).query has cognitive complexity 21 (> max enabled 20)
plugins/inputs/docker/docker.go:153:1                                        revive  cognitive-complexity: function (*Docker).Gather has cognitive complexity 34 (> max enabled 20)
plugins/inputs/docker/docker.go:256:1                                        revive  cognitive-complexity: function (*Docker).gatherSwarmInfo has cognitive complexity 30 (> max enabled 20)
plugins/inputs/docker/docker.go:327:1                                        revive  cognitive-complexity: function (*Docker).gatherInfo has cognitive complexity 23 (> max enabled 20)
plugins/inputs/docker/docker.go:531:1                                        revive  cognitive-complexity: function (*Docker).gatherContainerInspect has cognitive complexity 25 (> max enabled 20)
plugins/inputs/docker/docker.go:607:1                                        revive  cognitive-complexity: function (*Docker).parseContainerStats has cognitive complexity 37 (> max enabled 20)
plugins/inputs/docker/docker.go:846:1                                        revive  cognitive-complexity: function (*Docker).gatherBlockIOMetrics has cognitive complexity 21 (> max enabled 20)
plugins/inputs/dpdk/dpdk.go:203:1                                            revive  cognitive-complexity: function (*dpdk).maintainConnections has cognitive complexity 25 (> max enabled 20)
plugins/inputs/ecs/stats.go:198:1                                            revive  cognitive-complexity: function blkstats has cognitive complexity 24 (> max enabled 20)
plugins/inputs/elasticsearch/elasticsearch.go:213:1                          revive  cognitive-complexity: function (*Elasticsearch).Gather has cognitive complexity 68 (> max enabled 20)
plugins/inputs/elasticsearch/elasticsearch.go:635:1                          revive  cognitive-complexity: function (*Elasticsearch).gatherSingleIndexStats has cognitive complexity 30 (> max enabled 20)
plugins/inputs/elasticsearch_query/aggregation_parser.go:57:1                revive  cognitive-complexity: function recurseResponse has cognitive complexity 27 (> max enabled 20)
plugins/inputs/elasticsearch_query/aggregation_query.go:66:1                 revive  cognitive-complexity: function (*ElasticsearchQuery).getMetricFields has cognitive complexity 54 (> max enabled 20)
plugins/inputs/ethtool/ethtool_linux.go:276:1                                revive  cognitive-complexity: function (*CommandEthtool).Interfaces has cognitive complexity 21 (> max enabled 20)
plugins/inputs/eventhub_consumer/eventhub_consumer.go:267:1                  revive  cognitive-complexity: function (*EventHub).createMetrics has cognitive complexity 50 (> max enabled 20)
plugins/inputs/execd/shim/goshim.go:92:1                                     revive  cognitive-complexity: function (*Shim).Run has cognitive complexity 27 (> max enabled 20)
plugins/inputs/fibaro/hc2/parser.go:10:1                                     revive  cognitive-complexity: function Parse has cognitive complexity 37 (> max enabled 20)
plugins/inputs/filecount/filecount.go:122:1                                  revive  cognitive-complexity: function (*FileCount).count has cognitive complexity 38 (> max enabled 20)
plugins/inputs/filestat/filestat.go:46:1                                     revive  cognitive-complexity: function (*FileStat).Gather has cognitive complexity 31 (> max enabled 20)
plugins/inputs/fluentd/fluentd.go:80:1                                       revive  cognitive-complexity: function (*Fluentd).Gather has cognitive complexity 60 (> max enabled 20)
plugins/inputs/github/github.go:80:1                                         revive  cognitive-complexity: function (*GitHub).Gather has cognitive complexity 28 (> max enabled 20)
plugins/inputs/gnmi/gnmi.go:102:1                                            revive  cognitive-complexity: function (*GNMI).Init has cognitive complexity 52 (> max enabled 20)
plugins/inputs/gnmi/gnmi.go:237:1                                            revive  cognitive-complexity: function (*GNMI).Start has cognitive complexity 21 (> max enabled 20)
plugins/inputs/gnmi/handler.go:54:1                                          revive  cognitive-complexity: function (*handler).subscribeGNMI has cognitive complexity 21 (> max enabled 20)
plugins/inputs/gnmi/handler.go:130:1                                         revive  cognitive-complexity: function (*handler).handleSubscribeResponseUpdate has cognitive complexity 68 (> max enabled 20)
plugins/inputs/gnmi/tag_store.go:41:1                                        revive  cognitive-complexity: function (*tagStore).insert has cognitive complexity 43 (> max enabled 20)
plugins/inputs/gnmi/update_fields.go:67:1                                    revive  cognitive-complexity: function (*handler).processJSONIETF has cognitive complexity 26 (> max enabled 20)
plugins/inputs/haproxy/haproxy.go:198:1                                      revive  cognitive-complexity: function (*haproxy).importCsvResult has cognitive complexity 41 (> max enabled 20)
plugins/inputs/http/http.go:128:1                                            revive  cognitive-complexity: function (*HTTP).gatherURL has cognitive complexity 29 (> max enabled 20)
plugins/inputs/http_listener_v2/http_listener_v2.go:188:1                    revive  cognitive-complexity: function (*HTTPListenerV2).serveWrite has cognitive complexity 25 (> max enabled 20)
plugins/inputs/http_listener_v2/http_listener_v2.go:266:1                    revive  cognitive-complexity: function (*HTTPListenerV2).collectBody has cognitive complexity 26 (> max enabled 20)
plugins/inputs/http_response/http_response.go:235:1                          revive  cognitive-complexity: function (*HTTPResponse).httpGather has cognitive complexity 42 (> max enabled 20)
plugins/inputs/hugepages/hugepages.go:155:1                                  revive  cognitive-complexity: function (*Hugepages).gatherFromHugepagePath has cognitive complexity 25 (> max enabled 20)
plugins/inputs/influxdb/influxdb.go:100:1                                    revive  cognitive-complexity: function (*InfluxDB).gatherURL has cognitive complexity 43 (> max enabled 20)
plugins/inputs/influxdb_listener/influxdb_listener.go:254:1                  revive  cognitive-complexity: function (*InfluxDBListener).handleWriteInternalParser has cognitive complexity 35 (> max enabled 20)
plugins/inputs/influxdb_listener/influxdb_listener.go:363:1                  revive  cognitive-complexity: function (*InfluxDBListener).handleWriteUpstreamParser has cognitive complexity 41 (> max enabled 20)
plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go:157:1            revive  cognitive-complexity: function (*InfluxDBV2Listener).Start has cognitive complexity 22 (> max enabled 20)
plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go:264:1            revive  cognitive-complexity: function (*InfluxDBV2Listener).handleWrite has cognitive complexity 53 (> max enabled 20)
plugins/inputs/intel_pmu/config.go:26:1                                      revive  cognitive-complexity: function (*configParser).parseEntities has cognitive complexity 28 (> max enabled 20)
plugins/inputs/intel_pmu/config.go:177:1                                     revive  cognitive-complexity: function parseIDs has cognitive complexity 26 (> max enabled 20)
plugins/inputs/intel_pmu/intel_pmu.go:241:1                                  revive  cognitive-complexity: function (*IntelPMU).Stop has cognitive complexity 27 (> max enabled 20)
plugins/inputs/intel_pmu/resolver.go:25:1                                    revive  cognitive-complexity: function (*iaEntitiesResolver).resolveEntities has cognitive complexity 38 (> max enabled 20)
plugins/inputs/interrupts/interrupts.go:36:1                                 revive  cognitive-complexity: function parseInterrupts has cognitive complexity 25 (> max enabled 20)
plugins/inputs/ipmi_sensor/ipmi_sensor.go:249:1                              revive  cognitive-complexity: function (*Ipmi).parseV1 has cognitive complexity 23 (> max enabled 20)
plugins/inputs/ipset/ipset.go:50:1                                           revive  cognitive-complexity: function (*Ipset).Gather has cognitive complexity 33 (> max enabled 20)
plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go:254:1    revive  cognitive-complexity: function (*OpenConfigTelemetry).collectData has cognitive complexity 72 (> max enabled 20)
plugins/inputs/kafka_consumer/kafka_consumer.go:294:1                        revive  cognitive-complexity: function (*KafkaConsumer).Start has cognitive complexity 30 (> max enabled 20)
plugins/inputs/kafka_consumer/kafka_consumer.go:488:1                        revive  cognitive-complexity: function (*ConsumerGroupHandler).Handle has cognitive complexity 33 (> max enabled 20)
plugins/inputs/kernel/kernel.go:70:1                                         revive  cognitive-complexity: function (*Kernel).Gather has cognitive complexity 37 (> max enabled 20)
plugins/inputs/kinesis_consumer/kinesis_consumer.go:204:1                    revive  cognitive-complexity: function (*KinesisConsumer).onDelivery has cognitive complexity 21 (> max enabled 20)
plugins/inputs/kube_inventory/endpoint.go:22:1                               revive  cognitive-complexity: function (*KubernetesInventory).gatherEndpoint has cognitive complexity 24 (> max enabled 20)
plugins/inputs/kube_inventory/node.go:32:1                                   revive  cognitive-complexity: function (*KubernetesInventory).gatherNode has cognitive complexity 22 (> max enabled 20)
plugins/inputs/kube_inventory/pod.go:52:1                                    revive  cognitive-complexity: function (*KubernetesInventory).gatherPodContainer has cognitive complexity 30 (> max enabled 20)
plugins/inputs/kube_inventory/resourcequotas.go:23:1                         revive  cognitive-complexity: function (*KubernetesInventory).gatherResourceQuota has cognitive complexity 34 (> max enabled 20)
plugins/inputs/kubernetes/kubernetes.go:286:1                                revive  cognitive-complexity: function buildPodMetrics has cognitive complexity 44 (> max enabled 20)
plugins/inputs/libvirt/libvirt_metric_format.go:104:1                        revive  cognitive-complexity: function (*Libvirt).addCPUMetrics has cognitive complexity 40 (> max enabled 20)
plugins/inputs/libvirt/libvirt_metric_format.go:212:1                        revive  cognitive-complexity: function (*Libvirt).addVcpuMetrics has cognitive complexity 23 (> max enabled 20)
plugins/inputs/libvirt/libvirt_metric_format.go:449:1                        revive  cognitive-complexity: function (*Libvirt).addMemoryMetrics has cognitive complexity 48 (> max enabled 20)
plugins/inputs/logstash/logstash.go:234:1                                    revive  cognitive-complexity: function (*Logstash).gatherPluginsStats has cognitive complexity 31 (> max enabled 20)
plugins/inputs/logstash/logstash.go:462:1                                    revive  cognitive-complexity: function (*Logstash).Gather has cognitive complexity 28 (> max enabled 20)
plugins/inputs/lustre2/lustre2.go:426:1                                      revive  cognitive-complexity: function (*Lustre2).GetLustreProcStats has cognitive complexity 53 (> max enabled 20)
plugins/inputs/lustre2/lustre2.go:514:1                                      revive  cognitive-complexity: function (*Lustre2).getLustreProcBrwStats has cognitive complexity 51 (> max enabled 20)
plugins/inputs/lustre2/lustre2.go:648:1                                      revive  cognitive-complexity: function (*Lustre2).Gather has cognitive complexity 74 (> max enabled 20)
plugins/inputs/mcrouter/mcrouter.go:186:1                                    revive  cognitive-complexity: function (*Mcrouter).gatherServer has cognitive complexity 21 (> max enabled 20)
plugins/inputs/mdstat/mdstat.go:184:1                                        revive  cognitive-complexity: function (*MdstatConf).Gather has cognitive complexity 31 (> max enabled 20)
plugins/inputs/memcached/memcached.go:107:1                                  revive  cognitive-complexity: function (*Memcached).gatherServer has cognitive complexity 21 (> max enabled 20)
plugins/inputs/mesos/mesos.go:442:1                                          revive  cognitive-complexity: function (*Mesos).filterMetrics has cognitive complexity 28 (> max enabled 20)
plugins/inputs/modbus/configuration_metric.go:47:1                           revive  cognitive-complexity: function (*ConfigurationPerMetric).Check has cognitive complexity 83 (> max enabled 20)
plugins/inputs/modbus/configuration_metric.go:179:1                          revive  cognitive-complexity: function (*ConfigurationPerMetric).Process has cognitive complexity 32 (> max enabled 20)
plugins/inputs/modbus/configuration_metric.go:256:1                          revive  cognitive-complexity: function (*ConfigurationPerMetric).newField has cognitive complexity 22 (> max enabled 20)
plugins/inputs/modbus/configuration_register.go:185:1                        revive  cognitive-complexity: function (*ConfigurationOriginal).validateFieldDefinitions has cognitive complexity 48 (> max enabled 20)
plugins/inputs/modbus/configuration_request.go:50:1                          revive  cognitive-complexity: function (*ConfigurationPerRequest).Check has cognitive complexity 115 (> max enabled 20)
plugins/inputs/modbus/configuration_request.go:214:1                         revive  cognitive-complexity: function (*ConfigurationPerRequest).Process has cognitive complexity 24 (> max enabled 20)
plugins/inputs/modbus/configuration_request.go:302:1                         revive  cognitive-complexity: function (*ConfigurationPerRequest).newFieldFromDefinition has cognitive complexity 23 (> max enabled 20)
plugins/inputs/modbus/request.go:199:1                                       revive  cognitive-complexity: function groupFieldsToRequests has cognitive complexity 49 (> max enabled 20)
plugins/inputs/mongodb/mongodb_server.go:273:1                               revive  cognitive-complexity: function (*Server).gatherData has cognitive complexity 27 (> max enabled 20)
plugins/inputs/mongodb/mongostat.go:940:1                                    revive  cognitive-complexity: function NewStatLine has cognitive complexity 233 (> max enabled 20)
plugins/inputs/monit/monit.go:215:1                                          revive  cognitive-complexity: function (*Monit).Gather has cognitive complexity 61 (> max enabled 20)
plugins/inputs/mqtt_consumer/topic_parser.go:32:1                            revive  cognitive-complexity: function (*TopicParsingConfig).NewParser has cognitive complexity 45 (> max enabled 20)
plugins/inputs/mqtt_consumer/topic_parser.go:153:1                           revive  cognitive-complexity: function (*TopicParser).Parse has cognitive complexity 21 (> max enabled 20)
plugins/inputs/multifile/multifile.go:49:1                                   revive  cognitive-complexity: function (*MultiFile).Gather has cognitive complexity 25 (> max enabled 20)
plugins/inputs/mysql/mysql.go:433:1                                          revive  cognitive-complexity: function (*Mysql).gatherServer has cognitive complexity 53 (> max enabled 20)
plugins/inputs/mysql/mysql.go:628:1                                          revive  cognitive-complexity: function (*Mysql).gatherSlaveStatuses has cognitive complexity 34 (> max enabled 20)
plugins/inputs/mysql/mysql.go:767:1                                          revive  cognitive-complexity: function (*Mysql).gatherGlobalStatuses has cognitive complexity 70 (> max enabled 20)
plugins/inputs/nats_consumer/nats_consumer.go:90:1                           revive  cognitive-complexity: function (*natsConsumer).Start has cognitive complexity 49 (> max enabled 20)
plugins/inputs/nats_consumer/nats_consumer.go:198:1                          revive  cognitive-complexity: function (*natsConsumer).receiver has cognitive complexity 22 (> max enabled 20)
plugins/inputs/neptune_apex/neptune_apex.go:93:1                             revive  cognitive-complexity: function (*NeptuneApex).parseXML has cognitive complexity 25 (> max enabled 20)
plugins/inputs/net/net.go:50:1                                               revive  cognitive-complexity: function (*NetIOStats).Gather has cognitive complexity 36 (> max enabled 20)
plugins/inputs/netflow/netflow_decoder.go:545:1                              revive  cognitive-complexity: function (*netflowDecoder).Decode has cognitive complexity 133 (> max enabled 20)
plugins/inputs/netflow/netflow_decoder.go:729:1                              revive  cognitive-complexity: function (*netflowDecoder).decodeValueV9 has cognitive complexity 23 (> max enabled 20)
plugins/inputs/netflow/netflow_decoder.go:797:1                              revive  cognitive-complexity: function (*netflowDecoder).decodeValueIPFIX has cognitive complexity 28 (> max enabled 20)
plugins/inputs/netflow/sflow_v5.go:38:1                                      revive  cognitive-complexity: function (*sflowv5Decoder).Decode has cognitive complexity 67 (> max enabled 20)
plugins/inputs/netflow/sflow_v5.go:207:1                                     revive  cognitive-complexity: function (*sflowv5Decoder).decodeFlowRecords has cognitive complexity 53 (> max enabled 20)
plugins/inputs/nfsclient/nfsclient.go:66:1                                   revive  cognitive-complexity: function (*NFSClient).parseStat has cognitive complexity 63 (> max enabled 20)
plugins/inputs/nfsclient/nfsclient.go:224:1                                  revive  cognitive-complexity: function (*NFSClient).processText has cognitive complexity 40 (> max enabled 20)
plugins/inputs/nfsclient/nfsclient.go:324:1                                  revive  cognitive-complexity: function (*NFSClient).Init has cognitive complexity 22 (> max enabled 20)
plugins/inputs/nginx_plus/nginx_plus.go:378:1                                revive  cognitive-complexity: function (*Status).gatherUpstreamMetrics has cognitive complexity 28 (> max enabled 20)
plugins/inputs/nginx_plus/nginx_plus.go:493:1                                revive  cognitive-complexity: function (*Status).gatherStreamMetrics has cognitive complexity 23 (> max enabled 20)
plugins/inputs/nginx_plus_api/nginx_plus_api_metrics.go:333:1                revive  cognitive-complexity: function (*NginxPlusAPI).gatherHTTPUpstreamsMetrics has cognitive complexity 27 (> max enabled 20)
plugins/inputs/nginx_plus_api/nginx_plus_api_metrics.go:550:1                revive  cognitive-complexity: function (*NginxPlusAPI).gatherStreamUpstreamsMetrics has cognitive complexity 22 (> max enabled 20)
plugins/inputs/nsd/nsd.go:79:1                                               revive  cognitive-complexity: function (*NSD).Gather has cognitive complexity 21 (> max enabled 20)
plugins/inputs/ntpq/ntpq.go:144:1                                            revive  cognitive-complexity: function (*NTPQ).gatherServer has cognitive complexity 57 (> max enabled 20)
plugins/inputs/openldap/openldap.go:70:1                                     revive  cognitive-complexity: function (*Openldap).Gather has cognitive complexity 22 (> max enabled 20)
plugins/inputs/openntpd/openntpd.go:82:1                                     revive  cognitive-complexity: function (*Openntpd).Gather has cognitive complexity 57 (> max enabled 20)
plugins/inputs/opensearch_query/aggregation.response.go:53:1                 revive  cognitive-complexity: function (*Aggregation).GetMetrics has cognitive complexity 23 (> max enabled 20)
plugins/inputs/openstack/openstack.go:143:1                                  revive  cognitive-complexity: function (*OpenStack).Start has cognitive complexity 43 (> max enabled 20)
plugins/inputs/openstack/openstack.go:883:1                                  revive  cognitive-complexity: function (*OpenStack).gatherServers has cognitive complexity 36 (> max enabled 20)
plugins/inputs/openstack/openstack.go:975:1                                  revive  cognitive-complexity: function (*OpenStack).gatherServerDiagnostics has cognitive complexity 29 (> max enabled 20)
plugins/inputs/opentelemetry/grpc_service_profile.go:54:1                    revive  cognitive-complexity: function (*profileService).Export has cognitive complexity 73 (> max enabled 20)
plugins/inputs/openweathermap/openweathermap.go:131:1                        revive  cognitive-complexity: function (*OpenWeatherMap).Gather has cognitive complexity 28 (> max enabled 20)
plugins/inputs/pf/pf.go:83:1                                                 revive  cognitive-complexity: function (*PF).parsePfctlOutput has cognitive complexity 22 (> max enabled 20)
plugins/inputs/pgbouncer/pgbouncer.go:173:1                                  revive  cognitive-complexity: function (*PgBouncer).showPools has cognitive complexity 22 (> max enabled 20)
plugins/inputs/pgbouncer/pgbouncer.go:260:1                                  revive  cognitive-complexity: function (*PgBouncer).showDatabase has cognitive complexity 22 (> max enabled 20)
plugins/inputs/phpfpm/child.go:175:1                                         revive  cognitive-complexity: function (*child).handleRecord has cognitive complexity 34 (> max enabled 20)
plugins/inputs/phpfpm/fcgi_client.go:47:1                                    revive  cognitive-complexity: function (*conn).Request has cognitive complexity 21 (> max enabled 20)
plugins/inputs/ping/ping.go:125:1                                            revive  cognitive-complexity: function (*Ping).nativePing has cognitive complexity 32 (> max enabled 20)
plugins/inputs/ping/ping_notwindows.go:182:1                                 revive  cognitive-complexity: function processPingOutput has cognitive complexity 22 (> max enabled 20)
plugins/inputs/postgresql_extensible/postgresql_extensible.go:54:1           revive  cognitive-complexity: function (*Postgresql).Init has cognitive complexity 21 (> max enabled 20)
plugins/inputs/postgresql_extensible/postgresql_extensible.go:157:1          revive  cognitive-complexity: function (*Postgresql).accRow has cognitive complexity 23 (> max enabled 20)
plugins/inputs/procstat/filter.go:92:1                                       revive  cognitive-complexity: function (*Filter).ApplyFilter has cognitive complexity 81 (> max enabled 20)
plugins/inputs/procstat/process.go:72:1                                      revive  cognitive-complexity: function (*Proc).Metrics has cognitive complexity 163 (> max enabled 20)
plugins/inputs/procstat/procstat.go:85:1                                     revive  cognitive-complexity: function (*Procstat).Init has cognitive complexity 58 (> max enabled 20)
plugins/inputs/procstat/procstat.go:219:1                                    revive  cognitive-complexity: function (*Procstat).gatherOld has cognitive complexity 43 (> max enabled 20)
plugins/inputs/procstat/procstat.go:325:1                                    revive  cognitive-complexity: function (*Procstat).gatherNew has cognitive complexity 45 (> max enabled 20)
plugins/inputs/procstat/service_finders.go:53:1                              revive  cognitive-complexity: function findByCgroups has cognitive complexity 32 (> max enabled 20)
plugins/inputs/prometheus/consul.go:51:1                                     revive  cognitive-complexity: function (*Prometheus).startConsul has cognitive complexity 32 (> max enabled 20)
plugins/inputs/prometheus/kubernetes.go:54:1                                 revive  cognitive-complexity: function (*Prometheus).startK8s has cognitive complexity 36 (> max enabled 20)
plugins/inputs/prometheus/kubernetes.go:145:1                                revive  cognitive-complexity: function (*Prometheus).watchPod has cognitive complexity 22 (> max enabled 20)
plugins/inputs/prometheus/prometheus.go:124:1                                revive  cognitive-complexity: function (*Prometheus).Init has cognitive complexity 25 (> max enabled 20)
plugins/inputs/prometheus/prometheus.go:376:1                                revive  cognitive-complexity: function (*Prometheus).gatherURL has cognitive complexity 47 (> max enabled 20)
plugins/inputs/rabbitmq/rabbitmq.go:445:1                                    revive  cognitive-complexity: function gatherNodes has cognitive complexity 39 (> max enabled 20)
plugins/inputs/raindrops/raindrops.go:54:1                                   revive  cognitive-complexity: function (*Raindrops).gatherURL has cognitive complexity 21 (> max enabled 20)
plugins/inputs/redfish/redfish.go:361:1                                      revive  cognitive-complexity: function (*Redfish).gatherThermal has cognitive complexity 21 (> max enabled 20)
plugins/inputs/redis/redis.go:224:1                                          revive  cognitive-complexity: function (*Redis).connect has cognitive complexity 23 (> max enabled 20)
plugins/inputs/redis/redis.go:358:1                                          revive  cognitive-complexity: function gatherInfoOutput has cognitive complexity 51 (> max enabled 20)
plugins/inputs/riemann_listener/riemann_listener.go:62:1                     revive  cognitive-complexity: function (*riemannListener).listen has cognitive complexity 35 (> max enabled 20)
plugins/inputs/riemann_listener/riemann_listener.go:169:1                    revive  cognitive-complexity: function (*riemannListener).read has cognitive complexity 24 (> max enabled 20)
plugins/inputs/s7comm/s7comm.go:274:1                                        revive  cognitive-complexity: function handleFieldAddress has cognitive complexity 28 (> max enabled 20)
plugins/inputs/slurm/slurm.go:193:1                                          revive  cognitive-complexity: function (*Slurm).gatherJobsMetrics has cognitive complexity 46 (> max enabled 20)
plugins/inputs/slurm/slurm.go:270:1                                          revive  cognitive-complexity: function (*Slurm).gatherNodesMetrics has cognitive complexity 35 (> max enabled 20)
plugins/inputs/slurm/slurm.go:360:1                                          revive  cognitive-complexity: function (*Slurm).gatherReservationsMetrics has cognitive complexity 21 (> max enabled 20)
plugins/inputs/slurm/slurm.go:402:1                                          revive  cognitive-complexity: function (*Slurm).Gather has cognitive complexity 25 (> max enabled 20)
plugins/inputs/smart/smart.go:668:1                                          revive  cognitive-complexity: function gatherIntelNVMeDisk has cognitive complexity 23 (> max enabled 20)
plugins/inputs/smart/smart.go:736:1                                          revive  cognitive-complexity: function (*Smart).gatherDisk has cognitive complexity 100 (> max enabled 20)
plugins/inputs/smartctl/smartctl_device.go:12:1                              revive  cognitive-complexity: function (*Smartctl).scanDevice has cognitive complexity 33 (> max enabled 20)
plugins/inputs/snmp_trap/snmp_trap.go:276:1                                  revive  cognitive-complexity: function makeTrapHandler has cognitive complexity 55 (> max enabled 20)
plugins/inputs/socketstat/socketstat.go:76:1                                 revive  cognitive-complexity: function (*Socketstat).parseAndGather has cognitive complexity 22 (> max enabled 20)
plugins/inputs/sql/sql.go:58:1                                               revive  cognitive-complexity: function (*Query).parse has cognitive complexity 106 (> max enabled 20)
plugins/inputs/sql/sql.go:238:1                                              revive  cognitive-complexity: function (*SQL).Init has cognitive complexity 48 (> max enabled 20)
plugins/inputs/sqlserver/sqlserver.go:89:1                                   revive  cognitive-complexity: function (*SQLServer).initQueries has cognitive complexity 32 (> max enabled 20)
plugins/inputs/sqlserver/sqlserver.go:254:1                                  revive  cognitive-complexity: function (*SQLServer).Start has cognitive complexity 22 (> max enabled 20)
plugins/inputs/stackdriver/stackdriver.go:261:1                              revive  cognitive-complexity: function (*Stackdriver).newListTimeSeriesFilter has cognitive complexity 33 (> max enabled 20)
plugins/inputs/stackdriver/stackdriver.go:479:1                              revive  cognitive-complexity: function (*Stackdriver).generatetimeSeriesConfs has cognitive complexity 25 (> max enabled 20)
plugins/inputs/statsd/datadog.go:26:1                                        revive  cognitive-complexity: function (*Statsd).parseEventMessage has cognitive complexity 29 (> max enabled 20)
plugins/inputs/statsd/statsd.go:231:1                                        revive  cognitive-complexity: function (*Statsd).Gather has cognitive complexity 36 (> max enabled 20)
plugins/inputs/statsd/statsd.go:327:1                                        revive  cognitive-complexity: function (*Statsd).Start has cognitive complexity 25 (> max enabled 20)
plugins/inputs/statsd/statsd.go:438:1                                        revive  cognitive-complexity: function (*Statsd).tcpListen has cognitive complexity 29 (> max enabled 20)
plugins/inputs/statsd/statsd.go:483:1                                        revive  cognitive-complexity: function (*Statsd).udpListen has cognitive complexity 24 (> max enabled 20)
plugins/inputs/statsd/statsd.go:534:1                                        revive  cognitive-complexity: function (*Statsd).parser has cognitive complexity 27 (> max enabled 20)
plugins/inputs/statsd/statsd.go:574:1                                        revive  cognitive-complexity: function (*Statsd).parseStatsdLine has cognitive complexity 75 (> max enabled 20)
plugins/inputs/statsd/statsd.go:811:1                                        revive  cognitive-complexity: function (*Statsd).aggregate has cognitive complexity 27 (> max enabled 20)
plugins/inputs/suricata/suricata.go:203:1                                    revive  cognitive-complexity: function (*Suricata).parseStats has cognitive complexity 28 (> max enabled 20)
plugins/inputs/suricata/suricata.go:249:1                                    revive  cognitive-complexity: function (*Suricata).parseGeneric has cognitive complexity 30 (> max enabled 20)
plugins/inputs/syslog/syslog.go:271:1                                        revive  cognitive-complexity: function fields has cognitive complexity 34 (> max enabled 20)
plugins/inputs/sysstat/sysstat.go:201:1                                      revive  cognitive-complexity: function (*Sysstat).parse has cognitive complexity 39 (> max enabled 20)
plugins/inputs/system/ps.go:92:1                                             revive  cognitive-complexity: function (*SystemPS).DiskUsage has cognitive complexity 33 (> max enabled 20)
plugins/inputs/systemd_units/systemd_units_linux.go:208:1                    revive  cognitive-complexity: function (*SystemdUnits).Gather has cognitive complexity 84 (> max enabled 20)
plugins/inputs/tail/tail.go:169:1                                            revive  cognitive-complexity: function (*Tail).tailNewFiles has cognitive complexity 36 (> max enabled 20)
plugins/inputs/tail/tail.go:270:1                                            revive  cognitive-complexity: function (*Tail).receiver has cognitive complexity 54 (> max enabled 20)
plugins/inputs/temp/temp_linux.go:110:1                                      revive  cognitive-complexity: function (*Temperature).gatherHwmon has cognitive complexity 32 (> max enabled 20)
plugins/inputs/tengine/tengine.go:123:1                                      revive  cognitive-complexity: function (*Tengine).gatherURL has cognitive complexity 68 (> max enabled 20)
plugins/inputs/unbound/unbound.go:100:1                                      revive  cognitive-complexity: function (*Unbound).Gather has cognitive complexity 28 (> max enabled 20)
plugins/inputs/varnish/varnish.go:243:1                                      revive  cognitive-complexity: function (*Varnish).processMetricsV2 has cognitive complexity 41 (> max enabled 20)
plugins/inputs/varnish/varnish.go:356:1                                      revive  cognitive-complexity: function (*Varnish).parseMetricV2 has cognitive complexity 21 (> max enabled 20)
plugins/inputs/vsphere/client.go:125:1                                       revive  cognitive-complexity: function NewClient has cognitive complexity 22 (> max enabled 20)
plugins/inputs/vsphere/endpoint.go:447:1                                     revive  cognitive-complexity: function (*Endpoint).discover has cognitive complexity 39 (> max enabled 20)
plugins/inputs/vsphere/endpoint.go:583:1                                     revive  cognitive-complexity: function (*Endpoint).complexMetadataSelect has cognitive complexity 36 (> max enabled 20)
plugins/inputs/vsphere/endpoint.go:767:1                                     revive  cognitive-complexity: function getVMs has cognitive complexity 68 (> max enabled 20)
plugins/inputs/vsphere/endpoint.go:938:1                                     revive  cognitive-complexity: function (*Endpoint).Collect has cognitive complexity 21 (> max enabled 20)
plugins/inputs/vsphere/endpoint.go:1001:1                                    revive  cognitive-complexity: function (*Endpoint).chunkify has cognitive complexity 35 (> max enabled 20)
plugins/inputs/vsphere/endpoint.go:1214:1                                    revive  cognitive-complexity: function (*Endpoint).collectChunk has cognitive complexity 44 (> max enabled 20)
plugins/inputs/vsphere/endpoint.go:1329:1                                    revive  cognitive-complexity: function (*Endpoint).populateTags has cognitive complexity 98 (> max enabled 20)
plugins/inputs/vsphere/finder.go:80:1                                        revive  cognitive-complexity: function (*Finder).descend has cognitive complexity 48 (> max enabled 20)
plugins/inputs/vsphere/vsan.go:201:1                                         revive  cognitive-complexity: function (*Endpoint).queryPerformance has cognitive complexity 54 (> max enabled 20)
plugins/inputs/vsphere/vsan.go:424:1                                         revive  cognitive-complexity: function populateCMMDSTags has cognitive complexity 38 (> max enabled 20)
plugins/inputs/x509_cert/x509_cert.go:95:1                                   revive  cognitive-complexity: function (*X509Cert).Gather has cognitive complexity 58 (> max enabled 20)
plugins/inputs/x509_cert/x509_cert.go:309:1                                  revive  cognitive-complexity: function (*X509Cert).getCert has cognitive complexity 50 (> max enabled 20)
plugins/inputs/xtremio/xtremio.go:75:1                                       revive  cognitive-complexity: function (*XtremIO).Gather has cognitive complexity 24 (> max enabled 20)
plugins/inputs/zfs/zfs_linux.go:182:1                                        revive  cognitive-complexity: function (*Zfs).Gather has cognitive complexity 28 (> max enabled 20)
plugins/outputs/amqp/amqp.go:131:1                                           revive  cognitive-complexity: function (*AMQP).Write has cognitive complexity 34 (> max enabled 20)
plugins/outputs/amqp/amqp.go:230:1                                           revive  cognitive-complexity: function (*AMQP).makeClientConfig has cognitive complexity 21 (> max enabled 20)
plugins/outputs/azure_monitor/azure_monitor.go:456:1                         revive  cognitive-complexity: function (*AzureMonitor).Add has cognitive complexity 21 (> max enabled 20)
plugins/outputs/cloudwatch_logs/cloudwatch_logs.go:141:1                     revive  cognitive-complexity: function (*CloudWatchLogs).Connect has cognitive complexity 28 (> max enabled 20)
plugins/outputs/cloudwatch_logs/cloudwatch_logs.go:220:1                     revive  cognitive-complexity: function (*CloudWatchLogs).Write has cognitive complexity 68 (> max enabled 20)
plugins/outputs/datadog/datadog.go:79:1                                      revive  cognitive-complexity: function (*Datadog).convertToDatadogMetric has cognitive complexity 29 (> max enabled 20)
plugins/outputs/dynatrace/dynatrace.go:65:1                                  revive  cognitive-complexity: function (*Dynatrace).Write has cognitive complexity 37 (> max enabled 20)
plugins/outputs/elasticsearch/elasticsearch.go:266:1                         revive  cognitive-complexity: function (*Elasticsearch).Write has cognitive complexity 31 (> max enabled 20)
plugins/outputs/graphite/graphite.go:89:1                                    revive  cognitive-complexity: function (*Graphite).Connect has cognitive complexity 29 (> max enabled 20)
plugins/outputs/graylog/graylog_test_linux.go:202:1                          revive  cognitive-complexity: function TCPServer has cognitive complexity 35 (> max enabled 20)
plugins/outputs/groundwork/groundwork.go:221:1                               revive  cognitive-complexity: function (*Groundwork).parseMetric has cognitive complexity 75 (> max enabled 20)
plugins/outputs/groundwork/groundwork.go:399:1                               revive  cognitive-complexity: function adaptLog has cognitive complexity 23 (> max enabled 20)
plugins/outputs/http/http.go:135:1                                           revive  cognitive-complexity: function (*HTTP).writeMetric has cognitive complexity 36 (> max enabled 20)
plugins/outputs/influxdb/http.go:285:1                                       revive  cognitive-complexity: function (*httpClient).Write has cognitive complexity 25 (> max enabled 20)
plugins/outputs/influxdb/influxdb.go:76:1                                    revive  cognitive-complexity: function (*InfluxDB).Connect has cognitive complexity 42 (> max enabled 20)
plugins/outputs/influxdb_v2/http.go:208:1                                    revive  cognitive-complexity: function (*httpClient).Write has cognitive complexity 36 (> max enabled 20)
plugins/outputs/influxdb_v2/influxdb_v2.go:67:1                              revive  cognitive-complexity: function (*InfluxDB).Connect has cognitive complexity 33 (> max enabled 20)
plugins/outputs/kafka/kafka.go:197:1                                         revive  cognitive-complexity: function (*Kafka).Write has cognitive complexity 22 (> max enabled 20)
plugins/outputs/mongodb/mongodb.go:74:1                                      revive  cognitive-complexity: function (*MongoDB).Init has cognitive complexity 23 (> max enabled 20)
plugins/outputs/newrelic/newrelic.go:88:1                                    revive  cognitive-complexity: function (*NewRelic).Write has cognitive complexity 23 (> max enabled 20)
plugins/outputs/opensearch/opensearch.go:214:1                               revive  cognitive-complexity: function (*Opensearch).Write has cognitive complexity 46 (> max enabled 20)
plugins/outputs/postgresql/datatype_uint8.go:51:1                            revive  cognitive-complexity: function (*Uint8).Set has cognitive complexity 41 (> max enabled 20)
plugins/outputs/postgresql/table_manager.go:72:1                             revive  cognitive-complexity: function (*TableManager).MatchSource has cognitive complexity 24 (> max enabled 20)
plugins/outputs/postgresql/table_source.go:260:1                             revive  cognitive-complexity: function (*TableSource).getValues has cognitive complexity 25 (> max enabled 20)
plugins/outputs/prometheus_client/prometheus_client.go:77:1                  revive  cognitive-complexity: function (*PrometheusClient).Init has cognitive complexity 26 (> max enabled 20)
plugins/outputs/prometheus_client/v1/collector.go:98:1                       revive  cognitive-complexity: function (*Collector).Collect has cognitive complexity 21 (> max enabled 20)
plugins/outputs/prometheus_client/v1/collector.go:231:1                      revive  cognitive-complexity: function (*Collector).addMetrics has cognitive complexity 93 (> max enabled 20)
plugins/outputs/redistimeseries/redistimeseries.go:75:1                      revive  cognitive-complexity: function (*RedisTimeSeries).Write has cognitive complexity 21 (> max enabled 20)
plugins/outputs/remotefile/remotefile.go:169:1                               revive  cognitive-complexity: function (*File).Write has cognitive complexity 33 (> max enabled 20)
plugins/outputs/socket_writer/socket_writer.go:50:1                          revive  cognitive-complexity: function (*SocketWriter).Connect has cognitive complexity 23 (> max enabled 20)
plugins/outputs/sql/sql.go:203:1                                             revive  cognitive-complexity: function (*SQL).Write has cognitive complexity 30 (> max enabled 20)
plugins/outputs/stackdriver/stackdriver.go:217:1                             revive  cognitive-complexity: function (*Stackdriver).sendBatch has cognitive complexity 63 (> max enabled 20)
plugins/outputs/timestream/timestream.go:115:1                               revive  cognitive-complexity: function (*Timestream).Connect has cognitive complexity 31 (> max enabled 20)
plugins/outputs/wavefront/wavefront.go:139:1                                 revive  cognitive-complexity: function (*Wavefront).Write has cognitive complexity 27 (> max enabled 20)
plugins/outputs/wavefront/wavefront.go:213:1                                 revive  cognitive-complexity: function (*Wavefront).buildTags has cognitive complexity 34 (> max enabled 20)
plugins/parsers/avro/parser.go:183:1                                         revive  cognitive-complexity: function (*Parser).createMetric has cognitive complexity 43 (> max enabled 20)
plugins/parsers/binary/config.go:36:1                                        revive  cognitive-complexity: function (*Config).preprocess has cognitive complexity 35 (> max enabled 20)
plugins/parsers/binary/entry.go:28:1                                         revive  cognitive-complexity: function (*Entry).check has cognitive complexity 55 (> max enabled 20)
plugins/parsers/collectd/parser.go:111:1                                     revive  cognitive-complexity: function (*Parser).unmarshalValueList has cognitive complexity 36 (> max enabled 20)
plugins/parsers/csv/parser.go:269:1                                          revive  cognitive-complexity: function parseCSV has cognitive complexity 31 (> max enabled 20)
plugins/parsers/csv/parser.go:345:1                                          revive  cognitive-complexity: function (*Parser).parseRecord has cognitive complexity 78 (> max enabled 20)
plugins/parsers/dropwizard/parser.go:38:1                                    revive  cognitive-complexity: function (*Parser).Parse has cognitive complexity 27 (> max enabled 20)
plugins/parsers/dropwizard/parser.go:178:1                                   revive  cognitive-complexity: function (*Parser).readDWMetrics has cognitive complexity 33 (> max enabled 20)
plugins/parsers/graphite/config.go:25:1                                      revive  cognitive-complexity: function (*Config).validateTemplates has cognitive complexity 33 (> max enabled 20)
plugins/parsers/graphite/parser.go:88:1                                      revive  cognitive-complexity: function (*Parser).ParseLine has cognitive complexity 31 (> max enabled 20)
plugins/parsers/grok/parser.go:200:1                                         revive  cognitive-complexity: function (*Parser).ParseLine has cognitive complexity 91 (> max enabled 20)
plugins/parsers/influx/influx_upstream/parser.go:273:1                       revive  cognitive-complexity: function nextMetric has cognitive complexity 23 (> max enabled 20)
plugins/parsers/json/json_flattener.go:24:1                                  revive  cognitive-complexity: function (*JSONFlattener).FullFlattenJSON has cognitive complexity 22 (> max enabled 20)
plugins/parsers/json_v2/parser.go:131:1                                      revive  cognitive-complexity: function (*Parser).parseCriticalPath has cognitive complexity 38 (> max enabled 20)
plugins/parsers/json_v2/parser.go:317:1                                      revive  cognitive-complexity: function (*Parser).expandArray has cognitive complexity 93 (> max enabled 20)
plugins/parsers/json_v2/parser.go:470:1                                      revive  cognitive-complexity: function (*Parser).processObjects has cognitive complexity 28 (> max enabled 20)
plugins/parsers/json_v2/parser.go:539:1                                      revive  cognitive-complexity: function (*Parser).combineObject has cognitive complexity 47 (> max enabled 20)
plugins/parsers/json_v2/parser.go:657:1                                      revive  cognitive-complexity: function (*Parser).convertType has cognitive complexity 32 (> max enabled 20)
plugins/parsers/logfmt/parser.go:30:1                                        revive  cognitive-complexity: function (*Parser).Parse has cognitive complexity 33 (> max enabled 20)
plugins/parsers/nagios/parser.go:114:1                                       revive  cognitive-complexity: function (*Parser).Parse has cognitive complexity 21 (> max enabled 20)
plugins/parsers/nagios/parser.go:192:1                                       revive  cognitive-complexity: function parsePerfData has cognitive complexity 43 (> max enabled 20)
plugins/parsers/openmetrics/metric_v1.go:13:1                                revive  cognitive-complexity: function (*Parser).extractMetricsV1 has cognitive complexity 98 (> max enabled 20)
plugins/parsers/openmetrics/metric_v2.go:13:1                                revive  cognitive-complexity: function (*Parser).extractMetricsV2 has cognitive complexity 98 (> max enabled 20)
plugins/parsers/openmetrics/textparse.go:21:1                                revive  cognitive-complexity: function TextToMetricFamilies has cognitive complexity 123 (> max enabled 20)
plugins/parsers/openmetrics/textparse.go:252:1                               revive  cognitive-complexity: function (*MetricPoint).set has cognitive complexity 48 (> max enabled 20)
plugins/parsers/parquet/parser.go:47:1                                       revive  cognitive-complexity: function (*Parser).Parse has cognitive complexity 68 (> max enabled 20)
plugins/parsers/prometheus/metric_v1.go:14:1                                 revive  cognitive-complexity: function (*Parser).extractMetricsV1 has cognitive complexity 32 (> max enabled 20)
plugins/parsers/prometheus/metric_v2.go:14:1                                 revive  cognitive-complexity: function (*Parser).extractMetricsV2 has cognitive complexity 31 (> max enabled 20)
plugins/parsers/prometheusremotewrite/parser.go:23:1                         revive  cognitive-complexity: function (*Parser).Parse has cognitive complexity 35 (> max enabled 20)
...
Total: 384 issues
srebhan commented 3 months ago

Looking at a few of the listed function I'd say the felt cognitive complexity is much lower than what the linter claims. I don't think we should enable this one.

DStrand1 commented 3 months ago

I agree, similar to #15818 and #15808