influxdata / telegraf

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

Linter: revive, Rule: `exported` - Warns on undocumented exported functions and methods. Should we enable it? #15813

Open zak-pawel opened 2 weeks ago

zak-pawel commented 2 weeks ago

Description

This issue starts a discussion about enabling:

More information here

Configuration:

([]string) rule flags. Please notice that without configuration, the default behavior of the rule is that of its golint counterpart. Available flags are:

Example configuration:

      - name: exported
        arguments:
          - "preserveScope"
          - "checkPrivateReceivers"
          - "sayRepetitiveInsteadOfStutters"

Expected output

Decision about enabling or not enabling this rule.

Findings

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

accumulator.go:60:6                                                              revive  exported: exported type TrackingData should have comment or be unexported
agent/accumulator.go:10:6                                                        revive  exported: exported type MetricMaker should have comment or be unexported
agent/accumulator.go:22:1                                                        revive  exported: exported function NewAccumulator should have comment or be unexported
agent/tick.go:13:6                                                               revive  exported: exported type Ticker should have comment or be unexported
agent/tick.go:42:1                                                               revive  exported: exported function NewAlignedTicker should have comment or be unexported
agent/tick.go:103:1                                                              revive  exported: exported method AlignedTicker.Elapsed should have comment or be unexported
agent/tick.go:107:1                                                              revive  exported: exported method AlignedTicker.Stop should have comment or be unexported
agent/tick.go:131:1                                                              revive  exported: exported function NewUnalignedTicker should have comment or be unexported
agent/tick.go:195:1                                                              revive  exported: exported method UnalignedTicker.InjectTick should have comment or be unexported
agent/tick.go:199:1                                                              revive  exported: exported method UnalignedTicker.Elapsed should have comment or be unexported
agent/tick.go:203:1                                                              revive  exported: exported method UnalignedTicker.Stop should have comment or be unexported
agent/tick.go:227:1                                                              revive  exported: exported function NewRollingTicker should have comment or be unexported
agent/tick.go:274:1                                                              revive  exported: exported method RollingTicker.Elapsed should have comment or be unexported
agent/tick.go:278:1                                                              revive  exported: exported method RollingTicker.Stop should have comment or be unexported
cmd/telegraf/main.go:29:6                                                        revive  exported: exported type TelegrafConfig should have comment or be unexported
cmd/telegraf/main.go:34:6                                                        revive  exported: exported type Filters should have comment or be unexported
cmd/telegraf/pprof.go:11:6                                                       revive  exported: exported type Server should have comment or be unexported
cmd/telegraf/pprof.go:16:6                                                       revive  exported: exported type PprofServer should have comment or be unexported
cmd/telegraf/pprof.go:20:1                                                       revive  exported: exported function NewPprofServer should have comment or be unexported
cmd/telegraf/pprof.go:26:1                                                       revive  exported: exported method PprofServer.Start should have comment or be unexported
cmd/telegraf/pprof.go:50:1                                                       revive  exported: exported method PprofServer.ErrChan should have comment or be unexported
cmd/telegraf/telegraf.go:36:6                                                    revive  exported: exported type GlobalFlags should have comment or be unexported
cmd/telegraf/telegraf.go:54:6                                                    revive  exported: exported type WindowFlags should have comment or be unexported
cmd/telegraf/telegraf.go:63:6                                                    revive  exported: exported type App should have comment or be unexported
cmd/telegraf/telegraf.go:72:6                                                    revive  exported: exported type Telegraf should have comment or be unexported
cmd/telegraf/telegraf.go:86:1                                                    revive  exported: exported method Telegraf.Init should have comment or be unexported
cmd/telegraf/telegraf.go:109:1                                                   revive  exported: exported method Telegraf.ListSecretStores should have comment or be unexported
cmd/telegraf/telegraf.go:122:1                                                   revive  exported: exported method Telegraf.GetSecretStore should have comment or be unexported
cmd/telegraf/telegraf_posix.go:10:1                                              revive  exported: exported method Telegraf.Run should have comment or be unexported
config/config.go:102:1                                                           revive  exported: comment on exported type OrderedPlugin should be of the form "OrderedPlugin ..." (with optional leading article)
config/config.go:107:6                                                           revive  exported: exported type OrderedPlugins should have comment or be unexported
config/config.go:405:1                                                           revive  exported: comment on exported function GetDefaultConfigPath should be of the form "GetDefaultConfigPath ..."
config/config.go:479:1                                                           revive  exported: exported method Config.LoadAll should have comment or be unexported
config/config.go:746:1                                                           revive  exported: exported function LoadConfigFileWithRetries should have comment or be unexported
config/config.go:929:1                                                           revive  exported: exported method Config.LinkSecrets should have comment or be unexported
config/deprecation.go:193:1                                                      revive  exported: exported method Config.CollectDeprecationInfos should have comment or be unexported
config/deprecation.go:255:1                                                      revive  exported: exported method Config.PrintDeprecationList should have comment or be unexported
config/deprecation.go:353:1                                                      revive  exported: exported function PrintOptionDeprecationNotice should have comment or be unexported
config/deprecation.go:374:1                                                      revive  exported: exported function PrintOptionValueDeprecationNotice should have comment or be unexported
config/migration.go:132:1                                                        revive  exported: exported function ApplyMigrations should have comment or be unexported
config/secret.go:43:1                                                            revive  exported: exported function EnableSecretProtection should have comment or be unexported
config/secret.go:47:1                                                            revive  exported: exported function DisableSecretProtection should have comment or be unexported
config/types.go:22:1                                                             revive  exported: comment on exported method Duration.UnmarshalText should be of the form "UnmarshalText ..."
config/types.go:68:1                                                             revive  exported: exported method Size.UnmarshalText should have comment or be unexported
filter/filter.go:9:6                                                             revive  exported: exported type Filter should have comment or be unexported
filter/filter.go:56:1                                                            revive  exported: exported function MustCompile should have comment or be unexported
filter/filter.go:97:6                                                            revive  exported: exported type IncludeExcludeFilter should have comment or be unexported
filter/filter.go:104:1                                                           revive  exported: exported function NewIncludeExcludeFilter should have comment or be unexported
filter/filter.go:111:1                                                           revive  exported: exported function NewIncludeExcludeFilterDefaults should have comment or be unexported
filter/filter.go:130:1                                                           revive  exported: exported method IncludeExcludeFilter.Match should have comment or be unexported
input.go:3:6                                                                     revive  exported: exported type Input should have comment or be unexported
input.go:11:6                                                                    revive  exported: exported type ServiceInput should have comment or be unexported
internal/content_coding.go:26:1                                                  revive  exported: exported function WithMaxDecompressionSize should have comment or be unexported
internal/content_coding.go:40:1                                                  revive  exported: exported function WithCompressionLevel should have comment or be unexported
internal/content_coding.go:66:1                                                  revive  exported: exported function NewGzipReader should have comment or be unexported
internal/content_coding.go:121:6                                                 revive  exported: exported type AutoDecoder should have comment or be unexported
internal/content_coding.go:127:1                                                 revive  exported: exported method AutoDecoder.SetEncoding should have comment or be unexported
internal/content_coding.go:131:1                                                 revive  exported: exported method AutoDecoder.Decode should have comment or be unexported
internal/content_coding.go:138:1                                                 revive  exported: exported function NewAutoContentDecoder should have comment or be unexported
internal/content_coding.go:176:1                                                 revive  exported: exported function NewGzipEncoder should have comment or be unexported
internal/content_coding.go:204:1                                                 revive  exported: exported method GzipEncoder.Encode should have comment or be unexported
internal/content_coding.go:245:6                                                 revive  exported: exported type ZlibEncoder should have comment or be unexported
internal/content_coding.go:250:1                                                 revive  exported: exported function NewZlibEncoder should have comment or be unexported
internal/content_coding.go:271:1                                                 revive  exported: exported method ZlibEncoder.Encode should have comment or be unexported
internal/content_coding.go:286:6                                                 revive  exported: exported type ZstdEncoder should have comment or be unexported
internal/content_coding.go:290:1                                                 revive  exported: exported function NewZstdEncoder should have comment or be unexported
internal/content_coding.go:317:1                                                 revive  exported: exported method ZstdEncoder.Encode should have comment or be unexported
internal/content_coding.go:324:1                                                 revive  exported: exported function NewIdentityEncoder should have comment or be unexported
internal/content_coding.go:332:1                                                 revive  exported: exported method IdentityEncoder.Encode should have comment or be unexported
internal/content_coding.go:350:1                                                 revive  exported: exported function NewGzipDecoder should have comment or be unexported
internal/content_coding.go:364:1                                                 revive  exported: exported method GzipDecoder.SetEncoding should have comment or be unexported
internal/content_coding.go:366:1                                                 revive  exported: exported method GzipDecoder.Decode should have comment or be unexported
internal/content_coding.go:419:6                                                 revive  exported: exported type ZlibDecoder should have comment or be unexported
internal/content_coding.go:424:1                                                 revive  exported: exported function NewZlibDecoder should have comment or be unexported
internal/content_coding.go:436:1                                                 revive  exported: exported method ZlibDecoder.SetEncoding should have comment or be unexported
internal/content_coding.go:438:1                                                 revive  exported: exported method ZlibDecoder.Decode should have comment or be unexported
internal/content_coding.go:461:6                                                 revive  exported: exported type ZstdDecoder should have comment or be unexported
internal/content_coding.go:465:1                                                 revive  exported: exported function NewZstdDecoder should have comment or be unexported
internal/content_coding.go:477:1                                                 revive  exported: exported method ZstdDecoder.SetEncoding should have comment or be unexported
internal/content_coding.go:479:1                                                 revive  exported: exported method ZstdDecoder.Decode should have comment or be unexported
internal/content_coding.go:487:1                                                 revive  exported: exported function NewIdentityDecoder should have comment or be unexported
internal/content_coding.go:491:1                                                 revive  exported: exported method IdentityDecoder.SetEncoding should have comment or be unexported
internal/content_coding.go:493:1                                                 revive  exported: exported method IdentityDecoder.Decode should have comment or be unexported
internal/customized_no.go:5:7                                                    revive  exported: exported const Customized should have comment or be unexported
internal/errors.go:5:5                                                           revive  exported: exported var ErrNotConnected should have comment or be unexported
internal/fuzz/json.go:3:1                                                        revive  exported: comment on exported var JSONDictionary should be of the form "JSONDictionary ..."
internal/globpath/globpath.go:12:6                                               revive  exported: exported type GlobPath should have comment or be unexported
internal/globpath/globpath.go:20:1                                               revive  exported: exported function Compile should have comment or be unexported
internal/goplugin/noplugin.go:7:1                                                revive  exported: exported function LoadExternalPlugins should have comment or be unexported
internal/host_endianness_le.go:7:5                                               revive  exported: exported var HostEndianness should have comment or be unexported
internal/http.go:15:6                                                            revive  exported: exported type BasicAuthErrorFunc should have comment or be unexported
internal/http.go:135:6                                                           revive  exported: exported type GenericAuthErrorFunc should have comment or be unexported
internal/http.go:218:1                                                           revive  exported: exported function OnClientError should have comment or be unexported
internal/internal.go:27:7                                                        revive  exported: exported const NoMetricsCreatedMsg should have comment or be unexported
internal/internal.go:32:2                                                        revive  exported: exported var ErrTimeout should have comment or be unexported
internal/internal.go:43:6                                                        revive  exported: exported type ReadWaitCloser should have comment or be unexported
internal/internal.go:48:1                                                        revive  exported: exported function FormatFullVersion should have comment or be unexported
internal/internal.go:196:1                                                       revive  exported: exported method ReadWaitCloser.Close should have comment or be unexported
internal/process/process.go:93:1                                                 revive  exported: exported method Process.Pid should have comment or be unexported
internal/process/process.go:98:1                                                 revive  exported: exported method Process.State should have comment or be unexported
internal/snmp/config.go:9:6                                                      revive  exported: exported type ClientConfig should have comment or be unexported
internal/snmp/config.go:39:1                                                     revive  exported: exported function DefaultClientConfig should have comment or be unexported
internal/snmp/field.go:60:1                                                      revive  exported: comment on exported method Field.Init should be of the form "Init ..."
internal/snmp/field.go:96:1                                                      revive  exported: comment on exported method Field.Convert should be of the form "Convert ..."
internal/snmp/mib_loader.go:20:6                                                 revive  exported: exported type MibLoader should have comment or be unexported
internal/snmp/mib_loader.go:29:6                                                 revive  exported: exported type GosmiMibLoader should have comment or be unexported
internal/snmp/mib_loader.go:46:1                                                 revive  exported: comment on exported function LoadMibsFromPath should be of the form "LoadMibsFromPath ..."
internal/snmp/table.go:54:1                                                      revive  exported: comment on exported method Table.Init should be of the form "Init ..."
internal/snmp/translator.go:3:6                                                  revive  exported: exported type TranslatorPlugin should have comment or be unexported
internal/snmp/translator.go:7:6                                                  revive  exported: exported type Translator should have comment or be unexported
internal/snmp/translator_gosmi.go:18:1                                           revive  exported: exported function NewGosmiTranslator should have comment or be unexported
internal/snmp/translator_gosmi.go:180:1                                          revive  exported: comment on exported type MibEntry should be of the form "MibEntry ..." (with optional leading article)
internal/snmp/translator_gosmi.go:186:1                                          revive  exported: exported function TrapLookup should have comment or be unexported
internal/snmp/translator_netsnmp.go:21:1                                         revive  exported: exported function NewNetsnmpTranslator should have comment or be unexported
internal/snmp/wrapper.go:43:1                                                    revive  exported: exported function NewWrapper should have comment or be unexported
internal/snmp/wrapper.go:195:1                                                   revive  exported: exported method GosnmpWrapper.Reconnect should have comment or be unexported
internal/templating/template.go:80:1                                             revive  exported: exported function NewDefaultTemplateWithPattern should have comment or be unexported
internal/type_conversions.go:10:5                                                revive  exported: exported var ErrOutOfRange should have comment or be unexported
internal/type_conversions.go:12:1                                                revive  exported: exported function ToFloat64 should have comment or be unexported
internal/type_conversions.go:55:1                                                revive  exported: exported function ToFloat32 should have comment or be unexported
internal/type_conversions.go:104:1                                               revive  exported: exported function ToUint64 should have comment or be unexported
internal/type_conversions.go:171:1                                               revive  exported: exported function ToUint32 should have comment or be unexported
internal/type_conversions.go:245:1                                               revive  exported: exported function ToUint16 should have comment or be unexported
internal/type_conversions.go:322:1                                               revive  exported: exported function ToUint8 should have comment or be unexported
internal/type_conversions.go:402:1                                               revive  exported: exported function ToInt64 should have comment or be unexported
internal/type_conversions.go:460:1                                               revive  exported: exported function ToInt32 should have comment or be unexported
internal/type_conversions.go:531:1                                               revive  exported: exported function ToInt16 should have comment or be unexported
internal/type_conversions.go:605:1                                               revive  exported: exported function ToInt8 should have comment or be unexported
internal/type_conversions.go:685:1                                               revive  exported: exported function ToString should have comment or be unexported
internal/type_conversions.go:725:1                                               revive  exported: exported function ToBool should have comment or be unexported
logger.go:21:1                                                                   revive  exported: exported function LogLevelFromString should have comment or be unexported
logger.go:53:1                                                                   revive  exported: exported method LogLevel.Indicator should have comment or be unexported
logger.go:69:1                                                                   revive  exported: exported method LogLevel.Includes should have comment or be unexported
logger/default_logger.go:15:2                                                    revive  exported: exported const LogTargetFile should have comment (or a comment on this block) or be unexported
logger/logger.go:197:6                                                           revive  exported: exported type Config should have comment or be unexported
logger/logger.go:276:1                                                           revive  exported: exported function RedirectLogging should have comment or be unexported
logger/logger.go:280:1                                                           revive  exported: exported function CloseLogging should have comment or be unexported
metric.go:143:6                                                                  revive  exported: exported type UnwrappableMetric should have comment or be unexported
metric.go:149:6                                                                  revive  exported: exported type TrackingMetric should have comment or be unexported
metric/deserialize.go:32:1                                                       revive  exported: exported function ToBytes should have comment or be unexported
metric/deserialize.go:56:1                                                       revive  exported: exported function FromBytes should have comment or be unexported
metric/init.go:5:1                                                               revive  exported: exported function Init should have comment or be unexported
metric/metric.go:21:1                                                            revive  exported: exported function New should have comment or be unexported
metric/series_grouper.go:31:6                                                    revive  exported: exported type SeriesGrouper should have comment or be unexported
migrations/common/filter_options.go:3:6                                          revive  exported: exported type FilterOptions should have comment or be unexported
migrations/common/input_options.go:3:6                                           revive  exported: exported type InputOptions should have comment or be unexported
migrations/common/input_options.go:31:1                                          revive  exported: exported method InputOptions.Migrate should have comment or be unexported
migrations/common/output_options.go:3:6                                          revive  exported: exported type OutputOptions should have comment or be unexported
migrations/common/output_options.go:23:1                                         revive  exported: exported method OutputOptions.Migrate should have comment or be unexported
migrations/registry.go:10:5                                                      revive  exported: exported var ErrNotApplicable should have comment or be unexported
migrations/registry.go:12:6                                                      revive  exported: exported type PluginMigrationFunc should have comment or be unexported
migrations/registry.go:14:5                                                      revive  exported: exported var PluginMigrations should have comment or be unexported
migrations/registry.go:16:1                                                      revive  exported: exported function AddPluginMigration should have comment or be unexported
migrations/registry.go:23:6                                                      revive  exported: exported type PluginOptionMigrationFunc should have comment or be unexported
migrations/registry.go:25:5                                                      revive  exported: exported var PluginOptionMigrations should have comment or be unexported
migrations/registry.go:27:1                                                      revive  exported: exported function AddPluginOptionMigration should have comment or be unexported
migrations/registry.go:34:6                                                      revive  exported: exported type GeneralMigrationFunc should have comment or be unexported
migrations/registry.go:36:5                                                      revive  exported: exported var GeneralMigrations should have comment or be unexported
migrations/registry.go:38:1                                                      revive  exported: exported function AddGeneralMigration should have comment or be unexported
migrations/registry.go:44:1                                                      revive  exported: exported function CreateTOMLStruct should have comment or be unexported
migrations/utils.go:7:1                                                          revive  exported: exported function AsStringSlice should have comment or be unexported
models/buffer.go:13:2                                                            revive  exported: exported var AgentMetricsWritten should have comment or be unexported
models/buffer.go:19:6                                                            revive  exported: exported type Buffer should have comment or be unexported
models/buffer.go:66:1                                                            revive  exported: exported function NewBufferStats should have comment or be unexported
models/buffer_disk.go:17:6                                                       revive  exported: exported type DiskBuffer should have comment or be unexported
models/buffer_disk.go:32:1                                                       revive  exported: exported function NewDiskBuffer should have comment or be unexported
models/buffer_disk.go:49:1                                                       revive  exported: exported method DiskBuffer.Len should have comment or be unexported
models/buffer_disk.go:81:1                                                       revive  exported: exported method DiskBuffer.Add should have comment or be unexported
models/buffer_disk.go:108:1                                                      revive  exported: exported method DiskBuffer.Batch should have comment or be unexported
models/buffer_disk.go:160:1                                                      revive  exported: exported method DiskBuffer.Accept should have comment or be unexported
models/buffer_disk.go:190:1                                                      revive  exported: exported method DiskBuffer.Reject should have comment or be unexported
models/buffer_disk.go:198:1                                                      revive  exported: exported method DiskBuffer.Stats should have comment or be unexported
models/buffer_mem.go:24:1                                                        revive  exported: exported function NewMemoryBuffer should have comment or be unexported
models/buffer_mem.go:32:1                                                        revive  exported: exported method MemoryBuffer.Len should have comment or be unexported
models/buffer_mem.go:69:1                                                        revive  exported: exported method MemoryBuffer.Add should have comment or be unexported
models/buffer_mem.go:84:1                                                        revive  exported: exported method MemoryBuffer.Batch should have comment or be unexported
models/buffer_mem.go:109:1                                                       revive  exported: exported method MemoryBuffer.Accept should have comment or be unexported
models/buffer_mem.go:121:1                                                       revive  exported: exported method MemoryBuffer.Reject should have comment or be unexported
models/buffer_mem.go:152:1                                                       revive  exported: exported method MemoryBuffer.Stats should have comment or be unexported
models/common.go:17:1                                                            revive  exported: exported function SetLoggerOnPlugin should have comment or be unexported
models/filter.go:25:1                                                            revive  exported: exported method TagFilter.Compile should have comment or be unexported
models/filter.go:287:1                                                           revive  exported: exported function ShouldPassFilters should have comment or be unexported
models/filter.go:298:1                                                           revive  exported: exported function ShouldTagsPass should have comment or be unexported
models/running_aggregator.go:13:6                                                revive  exported: exported type RunningAggregator should have comment or be unexported
models/running_aggregator.go:27:1                                                revive  exported: exported function NewRunningAggregator should have comment or be unexported
models/running_aggregator.go:88:1                                                revive  exported: exported method RunningAggregator.LogName should have comment or be unexported
models/running_aggregator.go:92:1                                                revive  exported: exported method RunningAggregator.Init should have comment or be unexported
models/running_aggregator.go:102:1                                               revive  exported: exported method RunningAggregator.ID should have comment or be unexported
models/running_aggregator.go:109:1                                               revive  exported: exported method RunningAggregator.Period should have comment or be unexported
models/running_aggregator.go:113:1                                               revive  exported: exported method RunningAggregator.EndPeriod should have comment or be unexported
models/running_aggregator.go:117:1                                               revive  exported: exported method RunningAggregator.UpdateWindow should have comment or be unexported
models/running_aggregator.go:123:1                                               revive  exported: exported method RunningAggregator.MakeMetric should have comment or be unexported
models/running_aggregator.go:173:1                                               revive  exported: exported method RunningAggregator.Push should have comment or be unexported
models/running_aggregator.go:188:1                                               revive  exported: exported method RunningAggregator.Log should have comment or be unexported
models/running_input.go:15:2                                                     revive  exported: exported var GlobalMetricsGathered should have comment or be unexported
models/running_input.go:20:6                                                     revive  exported: exported type RunningInput should have comment or be unexported
models/running_input.go:37:1                                                     revive  exported: exported function NewRunningInput should have comment or be unexported
models/running_input.go:106:1                                                    revive  exported: exported method RunningInput.LogName should have comment or be unexported
models/running_input.go:110:1                                                    revive  exported: exported method RunningInput.Init should have comment or be unexported
models/running_input.go:123:1                                                    revive  exported: exported method RunningInput.Start should have comment or be unexported
models/running_input.go:162:1                                                    revive  exported: exported method RunningInput.Stop should have comment or be unexported
models/running_input.go:168:1                                                    revive  exported: exported method RunningInput.ID should have comment or be unexported
models/running_input.go:175:1                                                    revive  exported: exported method RunningInput.MakeMetric should have comment or be unexported
models/running_input.go:214:1                                                    revive  exported: exported method RunningInput.Gather should have comment or be unexported
models/running_input.go:238:1                                                    revive  exported: exported method RunningInput.SetDefaultTags should have comment or be unexported
models/running_input.go:242:1                                                    revive  exported: exported method RunningInput.Log should have comment or be unexported
models/running_input.go:246:1                                                    revive  exported: exported method RunningInput.IncrGatherTimeouts should have comment or be unexported
models/running_output.go:17:2                                                    revive  exported: comment on exported const DefaultMetricBatchSize should be of the form "DefaultMetricBatchSize ..."
models/running_output.go:20:2                                                    revive  exported: comment on exported const DefaultMetricBufferLimit should be of the form "DefaultMetricBufferLimit ..."
models/running_output.go:73:1                                                    revive  exported: exported function NewRunningOutput should have comment or be unexported
models/running_output.go:140:1                                                   revive  exported: exported method RunningOutput.LogName should have comment or be unexported
models/running_output.go:149:1                                                   revive  exported: exported method RunningOutput.ID should have comment or be unexported
models/running_output.go:156:1                                                   revive  exported: exported method RunningOutput.Init should have comment or be unexported
models/running_output.go:172:1                                                   revive  exported: exported method RunningOutput.Connect should have comment or be unexported
models/running_output.go:353:1                                                   revive  exported: exported method RunningOutput.LogBufferStatus should have comment or be unexported
models/running_output.go:362:1                                                   revive  exported: exported method RunningOutput.Log should have comment or be unexported
models/running_output.go:366:1                                                   revive  exported: exported method RunningOutput.BufferLength should have comment or be unexported
models/running_parsers.go:11:6                                                   revive  exported: exported type RunningParser should have comment or be unexported
models/running_parsers.go:20:1                                                   revive  exported: exported function NewRunningParser should have comment or be unexported
models/running_parsers.go:62:1                                                   revive  exported: exported method RunningParser.LogName should have comment or be unexported
models/running_parsers.go:66:1                                                   revive  exported: exported method RunningParser.Init should have comment or be unexported
models/running_parsers.go:76:1                                                   revive  exported: exported method RunningParser.Parse should have comment or be unexported
models/running_parsers.go:86:1                                                   revive  exported: exported method RunningParser.ParseLine should have comment or be unexported
models/running_parsers.go:96:1                                                   revive  exported: exported method RunningParser.SetDefaultTags should have comment or be unexported
models/running_parsers.go:100:1                                                  revive  exported: exported method RunningParser.Log should have comment or be unexported
models/running_processor.go:11:6                                                 revive  exported: exported type RunningProcessor should have comment or be unexported
models/running_processor.go:18:6                                                 revive  exported: exported type RunningProcessors should have comment or be unexported
models/running_processor.go:34:1                                                 revive  exported: exported function NewRunningProcessor should have comment or be unexported
models/running_processor.go:61:1                                                 revive  exported: exported method RunningProcessor.Init should have comment or be unexported
models/running_processor.go:71:1                                                 revive  exported: exported method RunningProcessor.ID should have comment or be unexported
models/running_processor.go:78:1                                                 revive  exported: exported method RunningProcessor.Log should have comment or be unexported
models/running_processor.go:82:1                                                 revive  exported: exported method RunningProcessor.LogName should have comment or be unexported
models/running_processor.go:86:1                                                 revive  exported: exported method RunningProcessor.MakeMetric should have comment or be unexported
models/running_processor.go:90:1                                                 revive  exported: exported method RunningProcessor.Start should have comment or be unexported
models/running_processor.go:94:1                                                 revive  exported: exported method RunningProcessor.Add should have comment or be unexported
models/running_processor.go:114:1                                                revive  exported: exported method RunningProcessor.Stop should have comment or be unexported
models/running_serializer.go:21:6                                                revive  exported: exported type RunningSerializer should have comment or be unexported
models/running_serializer.go:31:1                                                revive  exported: exported function NewRunningSerializer should have comment or be unexported
models/running_serializer.go:69:1                                                revive  exported: exported method RunningSerializer.LogName should have comment or be unexported
models/running_serializer.go:73:1                                                revive  exported: exported method RunningSerializer.Init should have comment or be unexported
models/running_serializer.go:83:1                                                revive  exported: exported method RunningSerializer.Serialize should have comment or be unexported
models/running_serializer.go:94:1                                                revive  exported: exported method RunningSerializer.SerializeBatch should have comment or be unexported
models/running_serializer.go:105:1                                               revive  exported: exported method RunningSerializer.Log should have comment or be unexported
output.go:3:6                                                                    revive  exported: exported type Output should have comment or be unexported
parser.go:25:6                                                                   revive  exported: exported type ParserFunc should have comment or be unexported
persister/persister.go:12:6                                                      revive  exported: exported type Persister should have comment or be unexported
persister/persister.go:18:1                                                      revive  exported: exported method Persister.Init should have comment or be unexported
persister/persister.go:24:1                                                      revive  exported: exported method Persister.Register should have comment or be unexported
persister/persister.go:33:1                                                      revive  exported: exported method Persister.Load should have comment or be unexported
persister/persister.go:72:1                                                      revive  exported: exported method Persister.Store should have comment or be unexported
plugins/aggregators/basicstats/basicstats.go:16:6                                revive  exported: exported type BasicStats should have comment or be unexported
plugins/aggregators/basicstats/basicstats.go:41:1                                revive  exported: exported function NewBasicStats should have comment or be unexported
plugins/aggregators/basicstats/basicstats.go:68:1                                revive  exported: exported method BasicStats.SampleConfig should have comment or be unexported
plugins/aggregators/basicstats/basicstats.go:72:1                                revive  exported: exported method BasicStats.Add should have comment or be unexported
plugins/aggregators/basicstats/basicstats.go:162:1                               revive  exported: exported method BasicStats.Push should have comment or be unexported
plugins/aggregators/basicstats/basicstats.go:288:1                               revive  exported: exported method BasicStats.Reset should have comment or be unexported
plugins/aggregators/basicstats/basicstats.go:305:1                               revive  exported: exported method BasicStats.Init should have comment or be unexported
plugins/aggregators/derivative/derivative.go:16:6                                revive  exported: exported type Derivative should have comment or be unexported
plugins/aggregators/derivative/derivative.go:39:1                                revive  exported: exported function NewDerivative should have comment or be unexported
plugins/aggregators/derivative/derivative.go:46:1                                revive  exported: exported method Derivative.SampleConfig should have comment or be unexported
plugins/aggregators/derivative/derivative.go:50:1                                revive  exported: exported method Derivative.Add should have comment or be unexported
plugins/aggregators/derivative/derivative.go:118:1                               revive  exported: exported method Derivative.Push should have comment or be unexported
plugins/aggregators/derivative/derivative.go:159:1                               revive  exported: exported method Derivative.Reset should have comment or be unexported
plugins/aggregators/derivative/derivative.go:173:1                               revive  exported: exported method Derivative.Init should have comment or be unexported
plugins/aggregators/final/final.go:17:6                                          revive  exported: exported type Final should have comment or be unexported
plugins/aggregators/final/final.go:26:1                                          revive  exported: exported function NewFinal should have comment or be unexported
plugins/aggregators/final/final.go:32:1                                          revive  exported: exported method Final.SampleConfig should have comment or be unexported
plugins/aggregators/final/final.go:36:1                                          revive  exported: exported method Final.Init should have comment or be unexported
plugins/aggregators/final/final.go:53:1                                          revive  exported: exported method Final.Add should have comment or be unexported
plugins/aggregators/final/final.go:58:1                                          revive  exported: exported method Final.Push should have comment or be unexported
plugins/aggregators/final/final.go:83:1                                          revive  exported: exported method Final.Reset should have comment or be unexported
plugins/aggregators/histogram/histogram.go:31:6                                  revive  exported: type name will be used as histogram.HistogramAggregator by other packages, and that stutters; consider calling this Aggregator
plugins/aggregators/histogram/histogram.go:90:1                                  revive  exported: exported method HistogramAggregator.SampleConfig should have comment or be unexported
plugins/aggregators/merge/merge.go:17:6                                          revive  exported: exported type Merge should have comment or be unexported
plugins/aggregators/merge/merge.go:22:1                                          revive  exported: exported method Merge.SampleConfig should have comment or be unexported
plugins/aggregators/merge/merge.go:26:1                                          revive  exported: exported method Merge.Init should have comment or be unexported
plugins/aggregators/merge/merge.go:31:1                                          revive  exported: exported method Merge.Add should have comment or be unexported
plugins/aggregators/merge/merge.go:45:1                                          revive  exported: exported method Merge.Push should have comment or be unexported
plugins/aggregators/merge/merge.go:55:1                                          revive  exported: exported method Merge.Reset should have comment or be unexported
plugins/aggregators/minmax/minmax.go:14:6                                        revive  exported: exported type MinMax should have comment or be unexported
plugins/aggregators/minmax/minmax.go:18:1                                        revive  exported: exported function NewMinMax should have comment or be unexported
plugins/aggregators/minmax/minmax.go:35:1                                        revive  exported: exported method MinMax.SampleConfig should have comment or be unexported
plugins/aggregators/minmax/minmax.go:39:1                                        revive  exported: exported method MinMax.Add should have comment or be unexported
plugins/aggregators/minmax/minmax.go:82:1                                        revive  exported: exported method MinMax.Push should have comment or be unexported
plugins/aggregators/minmax/minmax.go:93:1                                        revive  exported: exported method MinMax.Reset should have comment or be unexported
plugins/aggregators/quantile/quantile.go:15:6                                    revive  exported: exported type Quantile should have comment or be unexported
plugins/aggregators/quantile/quantile.go:36:1                                    revive  exported: exported method Quantile.SampleConfig should have comment or be unexported
plugins/aggregators/quantile/quantile.go:40:1                                    revive  exported: exported method Quantile.Add should have comment or be unexported
plugins/aggregators/quantile/quantile.go:79:1                                    revive  exported: exported method Quantile.Push should have comment or be unexported
plugins/aggregators/quantile/quantile.go:91:1                                    revive  exported: exported method Quantile.Reset should have comment or be unexported
plugins/aggregators/quantile/quantile.go:108:1                                   revive  exported: exported method Quantile.Init should have comment or be unexported
plugins/aggregators/registry.go:5:6                                              revive  exported: exported type Creator should have comment or be unexported
plugins/aggregators/registry.go:7:5                                              revive  exported: exported var Aggregators should have comment or be unexported
plugins/aggregators/registry.go:9:1                                              revive  exported: exported function Add should have comment or be unexported
plugins/aggregators/starlark/starlark.go:17:6                                    revive  exported: exported type Starlark should have comment or be unexported
plugins/aggregators/starlark/starlark.go:21:1                                    revive  exported: exported method Starlark.SampleConfig should have comment or be unexported
plugins/aggregators/starlark/starlark.go:25:1                                    revive  exported: exported method Starlark.Init should have comment or be unexported
plugins/aggregators/starlark/starlark.go:53:1                                    revive  exported: exported method Starlark.Add should have comment or be unexported
plugins/aggregators/starlark/starlark.go:67:1                                    revive  exported: exported method Starlark.Push should have comment or be unexported
plugins/aggregators/starlark/starlark.go:98:1                                    revive  exported: exported method Starlark.Reset should have comment or be unexported
plugins/aggregators/valuecounter/valuecounter.go:35:1                            revive  exported: exported method ValueCounter.SampleConfig should have comment or be unexported
plugins/common/auth/basic_auth.go:8:6                                            revive  exported: exported type BasicAuth should have comment or be unexported
plugins/common/auth/basic_auth.go:13:1                                           revive  exported: exported method BasicAuth.Verify should have comment or be unexported
plugins/common/aws/credentials.go:13:1                                           revive  exported: comment on exported type CredentialConfig should be of the form "CredentialConfig ..." (with optional leading article)
plugins/common/aws/credentials.go:27:1                                           revive  exported: exported method CredentialConfig.Credentials should have comment or be unexported
plugins/common/cookie/cookie.go:19:6                                             revive  exported: type name will be used as cookie.CookieAuthConfig by other packages, and that stutters; consider calling this AuthConfig
plugins/common/cookie/cookie.go:19:6                                             revive  exported: exported type CookieAuthConfig should have comment or be unexported
plugins/common/cookie/cookie.go:36:1                                             revive  exported: exported method CookieAuthConfig.Start should have comment or be unexported
plugins/common/http/config.go:20:1                                               revive  exported: comment on exported type HTTPClientConfig should be of the form "HTTPClientConfig ..." (with optional leading article)
plugins/common/http/config.go:34:1                                               revive  exported: exported method HTTPClientConfig.CreateClient should have comment or be unexported
plugins/common/jolokia2/client.go:16:6                                           revive  exported: exported type Client should have comment or be unexported
plugins/common/jolokia2/client.go:22:6                                           revive  exported: exported type ClientConfig should have comment or be unexported
plugins/common/jolokia2/client.go:31:6                                           revive  exported: exported type ProxyConfig should have comment or be unexported
plugins/common/jolokia2/client.go:37:6                                           revive  exported: exported type ProxyTargetConfig should have comment or be unexported
plugins/common/jolokia2/client.go:43:6                                           revive  exported: exported type ReadRequest should have comment or be unexported
plugins/common/jolokia2/client.go:49:6                                           revive  exported: exported type ReadResponse should have comment or be unexported
plugins/common/jolokia2/client.go:99:1                                           revive  exported: exported function NewClient should have comment or be unexported
plugins/common/jolokia2/gatherer.go:13:6                                         revive  exported: exported type Gatherer should have comment or be unexported
plugins/common/jolokia2/gatherer.go:18:1                                         revive  exported: exported function NewGatherer should have comment or be unexported
plugins/common/jolokia2/metric.go:35:1                                           revive  exported: exported function NewMetric should have comment or be unexported
plugins/common/jolokia2/metric.go:72:1                                           revive  exported: exported method Metric.MatchObjectName should have comment or be unexported
plugins/common/jolokia2/metric.go:100:1                                          revive  exported: exported method Metric.MatchAttributeAndPath should have comment or be unexported
plugins/common/jolokia2/point_builder.go:20:1                                    revive  exported: exported function NewPointBuilder should have comment or be unexported
plugins/common/kafka/config.go:73:6                                              revive  exported: exported type BackoffFunc should have comment or be unexported
plugins/common/kafka/sasl.go:11:6                                                revive  exported: exported type SASLAuth should have comment or be unexported
plugins/common/kafka/sasl.go:99:1                                                revive  exported: exported function SASLVersion should have comment or be unexported
plugins/common/kafka/scram_client.go:11:5                                        revive  exported: exported var SHA256 should have comment or be unexported
plugins/common/kafka/scram_client.go:12:5                                        revive  exported: exported var SHA512 should have comment or be unexported
plugins/common/kafka/scram_client.go:14:6                                        revive  exported: exported type XDGSCRAMClient should have comment or be unexported
plugins/common/kafka/scram_client.go:20:1                                        revive  exported: exported method XDGSCRAMClient.Begin should have comment or be unexported
plugins/common/kafka/scram_client.go:29:1                                        revive  exported: exported method XDGSCRAMClient.Step should have comment or be unexported
plugins/common/kafka/scram_client.go:33:1                                        revive  exported: exported method XDGSCRAMClient.Done should have comment or be unexported
plugins/common/logrus/hook.go:14:6                                               revive  exported: exported type LogHook should have comment or be unexported
plugins/common/logrus/hook.go:27:1                                               revive  exported: exported method LogHook.Fire should have comment or be unexported
plugins/common/logrus/hook.go:33:1                                               revive  exported: exported method LogHook.Levels should have comment or be unexported
plugins/common/mqtt/mqtt.go:15:1                                                 revive  exported: comment on exported type PublishProperties should be of the form "PublishProperties ..." (with optional leading article)
plugins/common/mqtt/mqtt.go:25:6                                                 revive  exported: type name will be used as mqtt.MqttConfig by other packages, and that stutters; consider calling this Config
plugins/common/mqtt/mqtt.go:25:6                                                 revive  exported: exported type MqttConfig should have comment or be unexported
plugins/common/mqtt/mqtt.go:57:1                                                 revive  exported: exported function NewClient should have comment or be unexported
plugins/common/mqtt/mqtt_v3.go:20:1                                              revive  exported: exported function NewMQTTv311Client should have comment or be unexported
plugins/common/mqtt/mqtt_v5.go:30:1                                              revive  exported: exported function NewMQTTv5Client should have comment or be unexported
plugins/common/oauth/config.go:12:6                                              revive  exported: exported type OAuth2Config should have comment or be unexported
plugins/common/oauth/config.go:21:1                                              revive  exported: exported method OAuth2Config.CreateOauth2Client should have comment or be unexported
plugins/common/opcua/client.go:21:6                                              revive  exported: exported type OpcUAWorkarounds should have comment or be unexported
plugins/common/opcua/client.go:21:6                                              revive  exported: type name will be used as opcua.OpcUAWorkarounds by other packages, and that stutters; consider calling this Workarounds
plugins/common/opcua/client.go:25:6                                              revive  exported: exported type ConnectionState should have comment or be unexported
plugins/common/opcua/client.go:28:2                                              revive  exported: exported const Closed should have comment (or a comment on this block) or be unexported
plugins/common/opcua/client.go:39:6                                              revive  exported: exported type OpcUAClientConfig should have comment or be unexported
plugins/common/opcua/client.go:39:6                                              revive  exported: type name will be used as opcua.OpcUAClientConfig by other packages, and that stutters; consider calling this ClientConfig
plugins/common/opcua/client.go:57:1                                              revive  exported: exported method OpcUAClientConfig.Validate should have comment or be unexported
plugins/common/opcua/client.go:95:1                                              revive  exported: exported method OpcUAClientConfig.CreateClient should have comment or be unexported
plugins/common/opcua/client.go:116:6                                             revive  exported: type name will be used as opcua.OpcUAClient by other packages, and that stutters; consider calling this Client
plugins/common/opcua/client.go:116:6                                             revive  exported: exported type OpcUAClient should have comment or be unexported
plugins/common/opcua/client.go:126:1                                             revive  exported: comment on exported method OpcUAClient.SetupOptions should be of the form "SetupOptions ..."
plugins/common/opcua/client.go:169:1                                             revive  exported: exported method OpcUAClient.StatusCodeOK should have comment or be unexported
plugins/common/opcua/client.go:218:1                                             revive  exported: exported method OpcUAClient.Disconnect should have comment or be unexported
plugins/common/opcua/client.go:236:1                                             revive  exported: exported method OpcUAClient.State should have comment or be unexported
plugins/common/opcua/input/input_client.go:21:6                                  revive  exported: exported type Trigger should have comment or be unexported
plugins/common/opcua/input/input_client.go:24:2                                  revive  exported: exported const Status should have comment (or a comment on this block) or be unexported
plugins/common/opcua/input/input_client.go:29:6                                  revive  exported: exported type DeadbandType should have comment or be unexported
plugins/common/opcua/input/input_client.go:32:2                                  revive  exported: exported const Absolute should have comment (or a comment on this block) or be unexported
plugins/common/opcua/input/input_client.go:36:6                                  revive  exported: exported type DataChangeFilter should have comment or be unexported
plugins/common/opcua/input/input_client.go:42:6                                  revive  exported: exported type MonitoringParameters should have comment or be unexported
plugins/common/opcua/input/input_client.go:78:6                                  revive  exported: exported type TimestampSource should have comment or be unexported
plugins/common/opcua/input/input_client.go:81:2                                  revive  exported: exported const TimestampSourceServer should have comment (or a comment on this block) or be unexported
plugins/common/opcua/input/input_client.go:87:6                                  revive  exported: type name will be used as input.InputClientConfig by other packages, and that stutters; consider calling this ClientConfig
plugins/common/opcua/input/input_client.go:96:1                                  revive  exported: exported method InputClientConfig.Validate should have comment or be unexported
plugins/common/opcua/input/input_client.go:122:1                                 revive  exported: exported method InputClientConfig.CreateInputClient should have comment or be unexported
plugins/common/opcua/input/input_client.go:371:1                                 revive  exported: exported method OpcUAInputClient.InitNodeIDs should have comment or be unexported
...
Total: 3009 issues
srebhan commented 2 weeks ago

We can enable this one if (and only if) we exclude the common plugin functions (Init, Start, Stop, etc). Is this possible?

Most of the remaining issues probably are of the type "this function should have never been exported in the first place" and should be fixed by unexporting!

zak-pawel commented 2 weeks ago

We can enable this one if (and only if) we exclude the common plugin functions (Init, Start, Stop, etc). Is this possible? @srebhan

For sure it can be done by filtering out particular messages in issues.exclude global section in .golangci.yml. But probably it is also done by proper setting - interface method should be commented, not the implementation method.

srebhan commented 2 weeks ago

Actually I don't know what is possible in the linter but I don't want to see e.g. Gather documented in 200+ input plugins... ;-) I fully trust you on how to set it up. So +1 on this one from my side.

I guess fixing those will be a challenge... ;-)

zak-pawel commented 2 weeks ago

@srebhan I double checked that. Rule doesn't have such option but filtering out works:

issues:
  exclude:
    - exported method .*\.(Gather|Init|Start|Stop|SampleConfig|Parse|Add|Apply|Serialize|SerializeBatch) should have comment or be unexported

I guess fixing those will be a challenge... ;-)

As you wrote earlier, most of these findings should have been unexported :)

srebhan commented 2 weeks ago

Looking forward to your take on this one.. :-) Maybe do a first sweep (or multiple) with unexporting and then let's document the other ones...