Strider report
Strider corpus: loki
Showing 1000 of 48782 detailed findings. The summary includes all 48782 findings.
clients/cmd/docker-driver/config_test.go1
46:26add-constant
clients/cmd/docker-driver/config_test.go:46:26
model.LabelSet{"swarm_stack": "foo", "bar": "buzz"}, model.LabelSet{"job": "foo", "bar": "buzz"}, false,pkg/limits/store_test.go1
177:19append-to-sized-slice
pkg/limits/store_test.go:177:19
// truncate the expected time to the start of the bucket. expected = append(expected, rateBucket{}) expected[1].timestamp = time3.Truncate(time.Minute).UnixNano()operator/tools/tools.go1
7:2blank-imports
operator/tools/tools.go:7:2
import ( _ "github.com/maxbrunsfeld/counterfeiter/v6")pkg/compression/pool_test.go1
55:5call-to-gc
pkg/compression/pool_test.go:55:5
if !assert.Eventually(t, func() bool { runtime.GC() return runtime.NumGoroutine() <= 50clients/cmd/docker-driver/config.go1
135:6cognitive-complexity
clients/cmd/docker-driver/config.go:135:6
func parseConfig(logCtx logger.Info) (*config, error) { if err := validateDriverOpt(logCtx); err != nil {clients/pkg/logentry/stages/drop.go1
38:2confusing-naming
clients/pkg/logentry/stages/drop.go:38:2
Source interface{} `mapstructure:"source"` source *[]string Value *string `mapstructure:"value"`operator/internal/handlers/internal/networkpolicy/service.go1
85:53confusing-results
operator/internal/handlers/internal/networkpolicy/service.go:85:53
func parseServiceEndpoint(endpoint string) (string, string, int32, bool) { https := strings.HasPrefix(endpoint, "https://")clients/cmd/docker-driver/logdriver/io.go1
19:6constructor-interface-return
clients/cmd/docker-driver/logdriver/io.go:19:6
// NewLogEntryEncoder creates a protobuf stream encoder for log entries.func NewLogEntryEncoder(w io.Writer) LogEntryEncoder { return &logEntryEncoder{pkg/engine/internal/worker/worker_test.go1
315:111context-as-argument
pkg/engine/internal/worker/worker_test.go:315:111
//nolint:revivefunc newTestWorkerWithContext(t *testing.T, logger log.Logger, loc objtest.Location, net *testNetwork, runCtx context.Context) *worker.Worker { t.Helper()pkg/bloomgateway/bloomgateway_test.go1
218:21context-cancel-in-loop
pkg/bloomgateway/bloomgateway_test.go:218:21
ctx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second) ctx = user.InjectOrgID(ctx, tenantID)clients/pkg/util/client.go1
175:2context-stored-in-struct
clients/pkg/util/client.go:175:2
// ctx is used in any upstream calls from the `client`. ctx context.Context cancel context.CancelFuncpkg/storage/chunk/cache/memcached_test.go1
124:48copy-lock-value
pkg/storage/chunk/cache/memcached_test.go:124:48
keys := []string{"k1", "k2", "k3", "k4", "k5", "k6"} client := &delayedMockMemcache{mockMemcache: *newMockMemcache(), delay: 10 * time.Millisecond} for _, k := range keys {clients/cmd/docker-driver/config.go1
91:6cyclomatic-complexity
clients/cmd/docker-driver/config.go:91:6
func validateDriverOpt(loggerInfo logger.Info) error { config := loggerInfo.Configcmd/dataobj-inspect/main.go1
12:2deep-exit
cmd/dataobj-inspect/main.go:12:2
fmt.Fprint(os.Stderr, err.Error()) os.Exit(1)}pkg/querier/queryrange/parquet_test.go1
28:2defer-close-before-error-check
pkg/querier/queryrange/parquet_test.go:28:2
f, err := os.CreateTemp("", "metrics-*.parquet") defer f.Close() // nolint:staticcheckpkg/bloomgateway/client.go1
48:15deprecated-api-usage
pkg/bloomgateway/client.go:48:15
// nolint:staticcheck // grpc.Dial() has been deprecated; we'll address it before upgrading to gRPC 2. conn, err := grpc.Dial(address, opts...) if err != nil {pkg/engine/internal/executor/dataobjscan.go1
320:2discarded-deferred-result
pkg/engine/internal/executor/dataobjscan.go:320:2
defer func() { // Use consistent sort order for columns. While at some point we may wishclients/cmd/docker-driver/driver.go1
46:3discarded-error-result
clients/cmd/docker-driver/driver.go:46:3
if err := l.stream.Close(); err != nil { level.Error(l.logger).Log("msg", "error while closing fifo stream", "err", err) }clients/cmd/docker-driver/loki.go1
33:1doc-comment-period
clients/cmd/docker-driver/loki.go:33:1
// New create a new Loki logger that forward logs to Loki instancefunc New(logCtx logger.Info, logger log.Logger) (logger.Logger, error) {pkg/compactor/deletion/delete_requests_store_test.go1
543:23duration-multiplied-by-duration
pkg/compactor/deletion/delete_requests_store_test.go:543:23
UserID: user1, StartTime: now.Add(-i * time.Hour), EndTime: now.Add(-i * time.Hour).Add(30 * time.Minute),clients/pkg/logentry/stages/drop.go1
171:3early-return
clients/pkg/logentry/stages/drop.go:171:3
if m.cfg.LongerThan != nil { if len(e.Line) > m.cfg.longerThan.Val() { // Too long, droppkg/logql/log/logfmt/jsonstring.go1
74:4enforce-switch-style
pkg/logql/log/logfmt/jsonstring.go:74:4
switch s[r] { default: returnpkg/distributor/ratestore_test.go1
256:5error-naming
pkg/distributor/ratestore_test.go:256:5
var benchErr errorclients/pkg/logentry/metric/counters_test.go1
85:14error-strings
clients/pkg/logentry/metric/counters_test.go:85:14
if ((err != nil) && (err.Error() != tt.err.Error())) || (err == nil && tt.err != nil) { t.Errorf("Metrics stage validation error, expected error = %v, actual error = %v", tt.err, err) returnpkg/chunkenc/interface.go1
26:6error-type-naming
pkg/chunkenc/interface.go:26:6
type errTooFarBehind struct { // original timestamp of the entry itself.operator/internal/handlers/internal/rules/rules_test.go1
131:2excessive-blank-identifiers
operator/internal/handlers/internal/rules/rules_test.go:131:2
_, _, _, _, err := BuildOptions(context.TODO(), logger, k, &stack)clients/cmd/docker-driver/config.go1
87:6exported-declaration-comment
clients/cmd/docker-driver/config.go:87:6
type PipelineConfig struct { PipelineStages stages.PipelineStages `yaml:"pipeline_stages,omitempty"`clients/pkg/logentry/stages/drop_test.go1
1:1file-length-limit
clients/pkg/logentry/stages/drop_test.go:1:1
package stagespkg/logql/log/pattern/lexer.rl.go1
1filename-format
pkg/logql/log/pattern/lexer.rl.go:1
//line pkg/logql/log/pattern/lexer.rl:1clients/pkg/logentry/stages/inspector.go1
17:37flag-parameter
clients/pkg/logentry/stages/inspector.go:17:37
func newInspector(writer io.Writer, disableFormatting bool) *inspector { f := &formatter{clients/cmd/docker-driver/config.go2
1:1format
clients/cmd/docker-driver/config.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/docker-driver/config.go`
135:6function-length
clients/cmd/docker-driver/config.go:135:6
func parseConfig(logCtx logger.Info) (*config, error) { if err := validateDriverOpt(logCtx); err != nil {operator/internal/config/options.go1
23:6function-result-limit
operator/internal/config/options.go:23:6
// from a provided configuration file.func LoadConfig(scheme *runtime.Scheme, configFile string) (*configv1.ProjectConfig, *TokenCCOAuthConfig, ctrl.Options, error) { options := ctrl.Options{Scheme: scheme}pkg/compactor/deletion/request_handler.go1
135:33get-function-return-value
pkg/compactor/deletion/request_handler.go:135:33
// GetAllDeleteRequestsHandler handles get all delete requestsfunc (dm *DeleteRequestHandler) GetAllDeleteRequestsHandler(w http.ResponseWriter, r *http.Request) { if dm == nil {pkg/dataobj/internal/dataset/row_reader_downloader.go1
310:31identical-if-chain-branches
pkg/dataobj/internal/dataset/row_reader_downloader.go:310:31
continue } else if page == requestor { continue // Already added.clients/pkg/logentry/stages/json.go1
163:3identical-switch-branches
clients/pkg/logentry/stages/json.go:163:3
extracted[n] = r case string: extracted[n] = rclients/cmd/docker-driver/config.go2
23:2import-alias-naming
clients/cmd/docker-driver/config.go:23:2
"github.com/grafana/loki/v3/clients/pkg/logentry/stages" clients_util "github.com/grafana/loki/v3/clients/pkg/util"82:2import-shadowing
clients/cmd/docker-driver/config.go:82:2
type config struct { labels model.LabelSet clientConfig clients_util.Configpkg/dataobj/range_reader.go1
112:12impossible-integer-comparison
pkg/dataobj/range_reader.go:112:12
return nil, ctx.Err() } else if length > math.MaxInt { return nil, fmt.Errorf("length too large: %d", length)pkg/compactor/testutil.go1
128:46increment-decrement
pkg/compactor/testutil.go:128:46
commonIndexes[fileName] = "" for j := 0; j < perUserDBsConfig.NumUsers; j = j + 1 { commonIndexes[fileName] = commonIndexes[fileName] + BuildUserID(j) + "\n"operator/internal/manifests/shard_rules_configmap.go1
93:4inefficient-map-lookup
operator/internal/manifests/shard_rules_configmap.go:93:4
tenant.RuleFiles = append(tenant.RuleFiles, ruleFileName) opts.Tenants.Configs[tenantID] = tenant }pkg/bloomgateway/bloomgateway_test.go1
49:73inefficient-sprintf
pkg/bloomgateway/bloomgateway_test.go:49:73
g.Labels = &logproto.IndexSeries{ Labels: logproto.FromLabelsToLabelAdapters(labels.FromStrings("foo", fmt.Sprintf("%d", g.Fingerprint))), }clients/cmd/docker-driver/loki_test.go1
16:16insecure-url-scheme
clients/cmd/docker-driver/loki_test.go:16:16
Config: map[string]string{ "loki-url": "http://localhost:3000", },pkg/bloombuild/planner/config.go1
52:13interface-method-limit
pkg/bloombuild/planner/config.go:52:13
type Limits interface { RetentionLimitsclients/pkg/logentry/stages/pack.go1
59:7marshal-receiver
clients/pkg/logentry/stages/pack.go:59:7
// MarshalJSON creates a Packed struct as JSON where the Labels are flattened into the top level of the objectfunc (w Packed) MarshalJSON() ([]byte, error) { // Marshal the entry to properly escape if it's json or contains quotescmd/migrate/main.go2
324:7max-control-nesting
cmd/migrate/main.go:324:7
finalChks = make([]chunk.Chunk, 0, len(chunks)) for i := range chunks { onechunk := []chunk.Chunk{chunks[i]}275:6max-parameters
cmd/migrate/main.go:275:6
func newChunkMover(ctx context.Context, s config.SchemaConfig, source, dest storage.Store, sourceUser, destUser string, matchers []*labels.Matcher, batch int, syncRanges int) *chunkMover { cm := &chunkMover{integration/client/client.go1
477:6max-public-structs
integration/client/client.go:477:6
// VectorValues holds a label key value pairs for the metric and single timestamp and valuetype VectorValues struct { Metric map[string]string `json:"metric"`clients/cmd/docker-driver/driver.go1
75:2modifies-parameter
clients/cmd/docker-driver/driver.go:75:2
folder := fmt.Sprintf("/var/log/docker/%s/", logCtx.ContainerID) logCtx.LogPath = filepath.Join(folder, "json.log") level.Info(d.logger).Log("msg", "starting logging driver for container", "id", logCtx.ContainerID, "config", fmt.Sprintf("%+v", logCtx.Config), "file", file, "logpath", logCtx.LogPath)cmd/chunks-inspect/labels.go1
17:40modifies-value-receiver
cmd/chunks-inspect/labels.go:17:40
func (ls Labels) Len() int { return len(ls) }func (ls Labels) Swap(i, j int) { ls[i], ls[j] = ls[j], ls[i] }func (ls Labels) Less(i, j int) bool { return ls[i].Name < ls[j].Name }clients/cmd/docker-driver/config_test.go1
28:13nested-structs
clients/cmd/docker-driver/config_test.go:28:13
tests := []struct { name stringclients/cmd/fluent-bit/loki.go1
254:6nil-error-return
clients/cmd/fluent-bit/loki.go:254:6
if err != nil { return "", nil }pkg/analytics/reporter.go1
84:3nil-value-with-nil-error
pkg/analytics/reporter.go:84:3
if !config.Enabled { return nil, nil }pkg/bloombuild/builder/builder.go1
404:3no-defer-in-loop
pkg/bloombuild/builder/builder.go:404:3
}) defer closeBlocksIter()operator/internal/manifests/shard_rules_configmap.go1
53:4no-else-after-return
operator/internal/manifests/shard_rules_configmap.go:53:4
} } else { return RuleName{clients/cmd/fluent-bit/config.go1
22:6no-init
clients/cmd/fluent-bit/config.go:22:6
func init() { // Init everything with default values.pkg/bloomgateway/stats.go1
61:2no-naked-return
pkg/bloomgateway/stats.go:61:2
dur += s.PostProcessingTime.Load() return}clients/cmd/docker-driver/config.go1
69:2no-package-var
clients/cmd/docker-driver/config.go:69:2
var ( defaultClientConfig = clients_util.Config{ BatchWait: clients_util.BatchWait,pkg/ingester/recalculate_owned_streams.go1
132:22non-pointer-sync-pool-value
pkg/ingester/recalculate_owned_streams.go:132:22
defer func() { s.descsBufPool.Put(descsBuf[:0]) s.hostsBufPool.Put(hostsBuf[:0])clients/pkg/logentry/stages/eventlogmessage_test.go1
353:4overwritten-before-use
clients/pkg/logentry/stages/eventlogmessage_test.go:353:4
if len(resultKey) > 1 { val = resultKey[1] }clients/cmd/docker-driver/config.go1
1:9package-comments
clients/cmd/docker-driver/config.go:1:9
package mainpkg/dataobj/compaction/binpacking.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/binpacking.go:1:9
package plannerclients/cmd/fluent-bit/dque.go1
148:29range-value-address
clients/cmd/fluent-bit/dque.go:148:29
for e := range c.entries { if err := c.queue.Enqueue(&dqueEntry{e.Labels, e.Timestamp, e.Line}); err != nil { level.Warn(c.logger).Log("msg", fmt.Sprintf("cannot enqueue record %s:", e.Line), "err", err)operator/api/loki/v1beta1/alertingrule_types.go1
177:7receiver-naming
operator/api/loki/v1beta1/alertingrule_types.go:177:7
// ConvertFrom converts from the Hub version (v1) to this version (v1beta1).func (dst *AlertingRule) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*v1.AlertingRule)pkg/analytics/stats.go1
257:2redefines-builtin-id
pkg/analytics/stats.go:257:2
type Statistics struct { min *atomic.Float64 max *atomic.Float64operator/tools/tools.go1
2:1redundant-build-tag
operator/tools/tools.go:2:1
//go:build tools// +build toolsclients/cmd/docker-driver/config.go1
65:26redundant-conversion
clients/cmd/docker-driver/config.go:65:26
defaultExternalLabels = "container_name={{.Name}}" defaultHostLabelName = model.LabelName("host"))integration/bloom_building_test.go1
20:2redundant-import-alias
integration/bloom_building_test.go:20:2
"github.com/grafana/loki/v3/pkg/storage" v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1" "github.com/grafana/loki/v3/pkg/storage/chunk/cache"operator/internal/controller/loki/internal/lokistack/update.go1
26:3redundant-switch-break
operator/internal/controller/loki/internal/lokistack/update.go:26:3
// break into retry logic below on conflict break case err != nil:- Fix (safe): remove the redundant break
pkg/storage/stores/shipper/indexshipper/tsdb/compactor_test.go1
896:20separate-byte-string-map-key
pkg/storage/stores/shipper/indexshipper/tsdb/compactor_test.go:896:20
err = compactedIndex.ForEachSeries(context.Background(), func(series retention.Series) error { seriesIDStr := string(series.SeriesID()) foundChunkEntries[seriesIDStr] = append(foundChunkEntries[seriesIDStr], series.Chunks()...)integration/client/client.go1
83:3single-case-switch
integration/client/client.go:83:3
for _, opt := range opts { switch opt.Type() { case "headerinject":pkg/storage/store.go1
432:4single-iteration-loop
pkg/storage/store.go:432:4
matchers = append(matchers, shardMatcher) break // nolint:staticcheck }pkg/bloombuild/builder/builder.go1
366:3slice-preallocation
pkg/bloombuild/builder/builder.go:366:3
blockOpts = v1.NewBlockOptions(blockEnc, maxBlockSize, maxBloomSize) created []bloomshipper.Meta totalSeries intclients/pkg/util/client.go1
443:46standard-http-method-constant
clients/pkg/util/client.go:443:46
defer cancel() req, err := http.NewRequestWithContext(ctx, "POST", c.cfg.URL.String(), bytes.NewReader(buf)) if err != nil {clients/pkg/logentry/stages/eventlogmessage.go1
151:1task-comment
clients/pkg/logentry/stages/eventlogmessage.go:151:1
// Sanitize a input string to convert it into a valid prometheus label// TODO: switch to prometheus/prometheus/util/strutil/SanitizeFullLabelNamefunc SanitizeFullLabelName(input string) string {pkg/logql/rangemapper_test.go1
137:35time-date
pkg/logql/rangemapper_test.go:137:35
)`, queryTime: time.Date(0, 0, 0, 12, 54, 0, 0, time.UTC), // 1970 12:54:00 splityByInterval: 1 * time.Hour,pkg/canary/writer/writer.go1
43:17time-naming
pkg/canary/writer/writer.go:43:17
sentChan chan time.Time, entryInterval, outOfOrderMin, outOfOrderMax time.Duration, outOfOrderPercentage, entrySize int,pkg/dataobj/sections/logs/table_build.go1
107:5time-value-equality
pkg/dataobj/sections/logs/table_build.go:107:5
} if a.Timestamp != b.Timestamp { return falseclients/cmd/docker-driver/config_test.go1
62:1top-level-declaration-order
clients/cmd/docker-driver/config_test.go:62:1
var pipelineString = `- regex:clients/cmd/fluent-bit/loki.go1
140:24unchecked-type-assertion
clients/cmd/fluent-bit/loki.go:140:24
for k, v := range kube.(map[string]interface{}) { switch k {clients/pkg/util/client.go1
467:2unclosed-http-response-body
clients/pkg/util/client.go:467:2
resp, err := c.client.Do(req) if err != nil {pkg/logql/log/pattern/lexer.rl.go1
7unexported-naming
pkg/logql/log/pattern/lexer.rl.go:7
//line pkg/logql/log/pattern/lexer.rl.go:7var _pattern_actions []byte = []byte{ 0, 1, 0, 1, 1, 1, 2, 1, 3, clients/pkg/logentry/stages/decolorize.go1
14:46unexported-return
clients/pkg/logentry/stages/decolorize.go:14:46
// Run implements Stagefunc (m *decolorizeStage) Run(in chan Entry) chan Entry { decolorizer, _ := log.NewDecolorizer()pkg/tool/printer/printer.go1
63:2unnecessary-format
pkg/tool/printer/printer.go:63:2
fmt.Printf("\nTemplates:\n") for fn, template := range templates {pkg/logql/log/logfmt/decode.go1
58:1unreachable-code
pkg/logql/log/logfmt/decode.go:58:1
key: const invalidKeyError = "invalid key"pkg/querytee/proxy_backend_test.go1
61:36unsafe-formatted-url-host-port
pkg/querytee/proxy_backend_test.go:61:36
t.Run(testName, func(t *testing.T) { u, err := url.Parse(fmt.Sprintf("http://%s:%s@test", testData.backendUser, testData.backendPass)) require.NoError(t, err)operator/internal/controller/loki/recordingrule_controller.go1
41:66unused-parameter
operator/internal/controller/loki/recordingrule_controller.go:41:66
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcilefunc (r *RecordingRuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { err := lokistack.AnnotateForDiscoveredRules(ctx, r.Client)clients/cmd/docker-driver/loki.go1
91:7unused-receiver
clients/cmd/docker-driver/loki.go:91:7
// Log implements `logger.Logger`func (l *loki) Name() string { return driverNameclients/cmd/docker-driver/config.go1
399:38use-any
clients/cmd/docker-driver/config.go:399:38
// loadConfig read YAML-formatted config from filename into cfg.func loadConfig(filename string, cfg interface{}) error { buf, err := os.ReadFile(filename)cmd/chunks-inspect/loki.go1
191:16use-errors-new
cmd/chunks-inspect/loki.go:191:16
if n <= 0 { return nil, fmt.Errorf("failed to read number of labels in structured metadata") }pkg/querier/queryrange/detected_fields_test.go1
1126:4use-fmt-print
pkg/querier/queryrange/detected_fields_test.go:1126:4
for _, field := range detectedFields { print(field.Label) switch field.Label {clients/pkg/logentry/stages/multiline_test.go1
76:2use-slices-sort
clients/pkg/logentry/stages/multiline_test.go:76:2
sort.Slice(out, func(l, r int) bool { return out[l].Timestamp.Before(out[r].Timestamp)clients/pkg/logentry/stages/util_test.go1
68:11var-naming
clients/pkg/logentry/stages/util_test.go:68:11
func TestGetString(t *testing.T) { var f64, f64_1 float64 var f32 float32clients/pkg/logentry/stages/multiline.go1
128:5waitgroup-add-inside-goroutine
clients/pkg/logentry/stages/multiline.go:128:5
wg.Add(1) go m.runMultiline(s, out, wg)pkg/util/shard.go1
32:12weak-cryptography
pkg/util/shard.go:32:12
// Use the identifier to compute an hash we'll use to seed the random. hasher := md5.New() //#nosec G401 -- This does not require collision resistance, this is an intentionally predictable value -- nosemgrep: use-of-md5 hasher.Write(YoloBuf(identifier)) // nolint:errcheckclients/cmd/docker-driver/driver.go1
55:29add-constant
clients/cmd/docker-driver/driver.go:55:29
if err := l.jsonl.Close(); err != nil { level.Error(l.logger).Log("msg", "error while closing json logger", "err", err) }pkg/logql/bench/discover/pkg/tsdb/reader_test.go1
52:2call-to-gc
pkg/logql/bench/discover/pkg/tsdb/reader_test.go:52:2
runtime.GC() runtime.GC()clients/cmd/docker-driver/driver.go1
67:18cognitive-complexity
clients/cmd/docker-driver/driver.go:67:18
func (d *driver) StartLogging(file string, logCtx logger.Info) error { d.mu.Lock()clients/pkg/logentry/stages/drop.go1
44:2confusing-naming
clients/pkg/logentry/stages/drop.go:44:2
OlderThan *string `mapstructure:"older_than"` olderThan time.Duration LongerThan *string `mapstructure:"longer_than"`operator/internal/handlers/internal/storage/secrets.go1
68:120confusing-results
operator/internal/handlers/internal/storage/secrets.go:68:120
func getSecrets(ctx context.Context, k k8s.Client, stack *lokiv1.LokiStack, fg configv1.FeatureGates) (*corev1.Secret, *corev1.Secret, error) { var (clients/cmd/docker-driver/logdriver/io.go1
52:6constructor-interface-return
clients/cmd/docker-driver/logdriver/io.go:52:6
// NewLogEntryDecoder creates a new stream decoder for log entries.func NewLogEntryDecoder(r io.Reader) LogEntryDecoder { return &logEntryDecoder{pkg/storage/stores/shipper/indexshipper/testutil/testutil.go1
49:37context-as-argument
pkg/storage/stores/shipper/indexshipper/testutil/testutil.go:49:37
// nolintfunc queryIndexes(t *testing.T, ctx context.Context, queries []boltdbcommon.Query, indexIteratorFunc IndexIteratorFunc, callback boltdbcommon.QueryPagesCallback) { userID, err := tenant.TenantID(ctx)pkg/bloomgateway/bloomgateway_test.go1
262:21context-cancel-in-loop
pkg/bloomgateway/bloomgateway_test.go:262:21
ctx, cancelFn := context.WithTimeout(context.Background(), 500*time.Millisecond) ctx = user.InjectOrgID(ctx, tenantID)cmd/migrate/main.go1
264:2context-stored-in-struct
cmd/migrate/main.go:264:2
type chunkMover struct { ctx context.Context schema config.SchemaConfigclients/cmd/docker-driver/config.go1
135:6cyclomatic-complexity
clients/cmd/docker-driver/config.go:135:6
func parseConfig(logCtx logger.Info) (*config, error) { if err := validateDriverOpt(logCtx); err != nil {cmd/logcli/main.go1
727:3deep-exit
cmd/logcli/main.go:727:3
if err != nil { log.Fatalf("Unable to parse time %v", err) }pkg/querier/queryrange/parquet_test.go1
53:2defer-close-before-error-check
pkg/querier/queryrange/parquet_test.go:53:2
f, err := os.CreateTemp("", "logs-*.parquet") defer f.Close() // nolint:staticcheckpkg/compactor/client/grpc.go1
88:21deprecated-api-usage
pkg/compactor/client/grpc.go:88:21
// nolint:staticcheck // grpc.Dial() has been deprecated; we'll address it before upgrading to gRPC 2. client.conn, err = grpc.Dial(addr, dialOpts...) if err != nil {clients/cmd/docker-driver/driver.go1
49:3discarded-error-result
clients/cmd/docker-driver/driver.go:49:3
if err := l.lokil.Close(); err != nil { level.Error(l.logger).Log("msg", "error while closing loki logger", "err", err) }clients/cmd/docker-driver/loki.go1
64:1doc-comment-period
clients/cmd/docker-driver/loki.go:64:1
// Log implements `logger.Logger`func (l *loki) Log(m *logger.Message) error {pkg/compactor/deletion/delete_requests_store_test.go1
544:23duration-multiplied-by-duration
pkg/compactor/deletion/delete_requests_store_test.go:544:23
StartTime: now.Add(-i * time.Hour), EndTime: now.Add(-i * time.Hour).Add(30 * time.Minute), Query: fmt.Sprintf(`{foo="%d", user="%s"}`, i, user1),clients/pkg/logentry/stages/drop.go1
186:3early-return
clients/pkg/logentry/stages/drop.go:186:3
ct := time.Now() if e.Timestamp.Before(ct.Add(-m.cfg.olderThan)) { // Too old, droppkg/logql/syntax/query_scanner.go1
481:2enforce-switch-style
pkg/logql/syntax/query_scanner.go:481:2
switch prefix { default: return "decimal literal"pkg/engine/internal/executor/pipeline.go1
37:2error-naming
pkg/engine/internal/executor/pipeline.go:37:2
errPipelineNotOpen = errors.New("pipeline not opened") EOF = fmt.Errorf("pipeline exhausted: %w", io.EOF) //nolint:revive,staticcheck)clients/pkg/logentry/stages/json_test.go1
143:27error-strings
clients/pkg/logentry/stages/json_test.go:143:27
0, errors.Wrap(errors.New("SyntaxError: Unknown char: '#'"), ErrCouldNotCompileJMES), },pkg/columnar/error.go1
5:6error-type-naming
pkg/columnar/error.go:5:6
type errorSliceBounds struct { i, j intoperator/internal/handlers/internal/rules/rules_test.go1
254:2excessive-blank-identifiers
operator/internal/handlers/internal/rules/rules_test.go:254:2
_, _, _, _, err := BuildOptions(context.TODO(), logger, k, &stack)clients/cmd/docker-driver/http.go1
14:6exported-declaration-comment
clients/cmd/docker-driver/http.go:14:6
type StartLoggingRequest struct { File stringclients/pkg/logentry/stages/metrics_test.go1
1:1file-length-limit
clients/pkg/logentry/stages/metrics_test.go:1:1
package stagescmd/chunks-inspect/main.go1
28:33flag-parameter
cmd/chunks-inspect/main.go:28:33
func printFile(filename string, blockDetails, printLines, storeBlocks bool) { f, err := os.Open(filename)clients/cmd/docker-driver/config_test.go1
1:1format
clients/cmd/docker-driver/config_test.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/docker-driver/config_test.go`
clients/cmd/fluent-bit/config.go1
72:6function-length
clients/cmd/fluent-bit/config.go:72:6
func parseConfig(cfg ConfigGetter) (*config, error) { res := &config{}operator/internal/handlers/internal/networkpolicy/service.go1
85:6function-result-limit
operator/internal/handlers/internal/networkpolicy/service.go:85:6
func parseServiceEndpoint(endpoint string) (string, string, int32, bool) { https := strings.HasPrefix(endpoint, "https://")pkg/compactor/deletion/request_handler.go1
306:33get-function-return-value
pkg/compactor/deletion/request_handler.go:306:33
// GetCacheGenerationNumberHandler handles requests for a user's cache generation numberfunc (dm *DeleteRequestHandler) GetCacheGenerationNumberHandler(w http.ResponseWriter, r *http.Request) { if dm == nil {pkg/dataobj/internal/dataset/row_reader_downloader.go1
334:31identical-if-chain-branches
pkg/dataobj/internal/dataset/row_reader_downloader.go:334:31
continue } else if page == requestor { continue // Already added.clients/pkg/logentry/stages/json.go1
165:3identical-switch-branches
clients/pkg/logentry/stages/json.go:165:3
extracted[n] = r case bool: extracted[n] = rclients/cmd/docker-driver/config_test.go1
16:2import-alias-naming
clients/cmd/docker-driver/config_test.go:16:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/cmd/docker-driver/config.go1
141:2import-shadowing
clients/cmd/docker-driver/config.go:141:2
clientConfig := defaultClientConfig labels := model.LabelSet{}pkg/dataset/file_header.go1
132:5impossible-integer-comparison
pkg/dataset/file_header.go:132:5
} if size > int64(math.MaxInt) { return nil, 0, fmt.Errorf("%s is too large to read: %d bytes", name, size)pkg/distributor/distributor_test.go1
566:5increment-decrement
pkg/distributor/distributor_test.go:566:5
for _, st := range pr.Streams { labels[st.Labels] = labels[st.Labels] + 1 }pkg/bloombuild/planner/retention_test.go1
743:4inefficient-map-lookup
pkg/bloombuild/planner/retention_test.go:743:4
if _, ok := tenants[tenant]; !ok { tenants[tenant] = &validation.Limits{} }pkg/bloomgateway/querier_test.go1
205:34inefficient-sprintf
pkg/bloomgateway/querier_test.go:205:34
for i := 0; i < n; i++ { s := labels.FromStrings("app", fmt.Sprintf("%d", i)) sFP := labels.StableHash(s)clients/cmd/fluent-bit/config.go1
81:9insecure-url-scheme
clients/cmd/fluent-bit/config.go:81:9
if url == "" { url = "http://localhost:3100/loki/api/v1/push" }pkg/chunkenc/interface.go1
52:12interface-method-limit
pkg/chunkenc/interface.go:52:12
// Chunk is the interface for the compressed logs chunk format.type Chunk interface { Bounds() (time.Time, time.Time)cmd/chunks-inspect/labels.go1
74:7marshal-receiver
cmd/chunks-inspect/labels.go:74:7
// UnmarshalJSON implements json.Unmarshaler.func (ls *Labels) UnmarshalJSON(b []byte) error { var m map[string]stringcmd/migrate/main.go1
327:8max-control-nesting
cmd/migrate/main.go:327:8
var retry int for retry = 4; retry >= 0; retry-- { onechunk, err = f.FetchChunks(m.ctx, onechunk)operator/internal/manifests/gateway.go1
645:6max-parameters
operator/internal/manifests/gateway.go:645:6
// configureObsGatewayServerPKI configures PKI for the observatorium gateway.func configureObsGatewayServerPKI( podSpec *corev1.PodSpec,integration/client/client.go1
505:6max-public-structs
integration/client/client.go:505:6
// DataType holds the result type and a list of StreamValuestype DataType struct { ResultType stringclients/cmd/docker-driver/loki.go1
35:2modifies-parameter
clients/cmd/docker-driver/loki.go:35:2
func New(logCtx logger.Info, logger log.Logger) (logger.Logger, error) { logger = log.With(logger, "container_id", logCtx.ContainerID) cfg, err := parseConfig(logCtx)cmd/chunks-inspect/labels.go1
17:47modifies-value-receiver
cmd/chunks-inspect/labels.go:17:47
func (ls Labels) Len() int { return len(ls) }func (ls Labels) Swap(i, j int) { ls[i], ls[j] = ls[j], ls[i] }func (ls Labels) Less(i, j int) bool { return ls[i].Name < ls[j].Name }clients/cmd/docker-driver/config_test.go1
94:13nested-structs
clients/cmd/docker-driver/config_test.go:94:13
} tests := []struct { name stringclients/cmd/fluent-bit/loki.go1
259:5nil-error-return
clients/cmd/fluent-bit/loki.go:259:5
if err != nil { return "", nil }pkg/analytics/seed.go1
26:3nil-value-with-nil-error
pkg/analytics/seed.go:26:3
if mergeable == nil { return nil, nil }pkg/dataobj/consumer/logsobj/builder_test.go1
369:5no-defer-in-loop
pkg/dataobj/consumer/logsobj/builder_test.go:369:5
require.NoError(b, err) defer closer2.Close() }operator/internal/manifests/storage/configure.go1
227:5no-else-after-return
operator/internal/manifests/storage/configure.go:227:5
} } else { return []corev1.EnvVar{clients/cmd/fluent-bit/out_grafana_loki.go1
30:6no-init
clients/cmd/fluent-bit/out_grafana_loki.go:30:6
func init() { var logLevel dslog.Levelpkg/chunkenc/unordered.go1
204:3no-naked-return
pkg/chunkenc/unordered.go:204:3
if hb.IsEmpty() || (maxt < hb.mint || hb.maxt < mint) { return }clients/cmd/docker-driver/config_test.go1
19:5no-package-var
clients/cmd/docker-driver/config_test.go:19:5
var jobRename = `- regex: (.*)pkg/ingester/recalculate_owned_streams.go1
133:22non-pointer-sync-pool-value
pkg/ingester/recalculate_owned_streams.go:133:22
s.descsBufPool.Put(descsBuf[:0]) s.hostsBufPool.Put(hostsBuf[:0]) s.zoneBufPool.Put(zoneBuf[:0])clients/pkg/logentry/stages/eventlogmessage_test.go1
357:4overwritten-before-use
clients/pkg/logentry/stages/eventlogmessage_test.go:357:4
if len(resultKeyValue) > 1 { val = resultKeyValue[1] }clients/cmd/docker-driver/driver.go1
1:9package-comments
clients/cmd/docker-driver/driver.go:1:9
package mainpkg/dataobj/compaction/binpacking_test.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/binpacking_test.go:1:9
package plannerclients/cmd/fluent-bit/loki_test.go1
90:9range-value-address
clients/cmd/fluent-bit/loki_test.go:90:9
rec := util.NewFakeClient(func() {}) l := &loki{ cfg: tt.cfg,operator/api/loki/v1beta1/lokistack_types.go1
1127:7receiver-naming
operator/api/loki/v1beta1/lokistack_types.go:1127:7
// nolint:golintfunc (dst *LokiStack) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*v1.LokiStack)pkg/analytics/stats.go1
258:2redefines-builtin-id
pkg/analytics/stats.go:258:2
min *atomic.Float64 max *atomic.Float64 count *atomic.Int64pkg/logql/sketch/topk_slow_test.go1
2:1redundant-build-tag
pkg/logql/sketch/topk_slow_test.go:2:1
//go:build sketch_slow// +build sketch_slowclients/cmd/fluent-bit/loki_test.go1
127:23redundant-conversion
clients/cmd/fluent-bit/loki_test.go:127:23
{"kv empty", map[string]interface{}{}, kvPairFormat, ``, false}, {"bad format", nil, format(3), "", true}, {"nested json", map[string]interface{}{"log": `{"level":"error"}`}, jsonFormat, `{"log":{"level":"error"}}`, false},operator/api/loki/v1beta1/alertingrule_types.go1
4:2redundant-import-alias
operator/api/loki/v1beta1/alertingrule_types.go:4:2
import ( v1 "github.com/grafana/loki/operator/api/loki/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"operator/internal/controller/loki/internal/lokistack/update.go1
58:3redundant-switch-break
operator/internal/controller/loki/internal/lokistack/update.go:58:3
// break into retry logic below on conflict break case err != nil:- Fix (safe): remove the redundant break
operator/internal/certrotation/build_test.go1
39:3single-case-switch
operator/internal/certrotation/build_test.go:39:3
switch o := obj.(type) { case *corev1.Secret:pkg/bloombuild/planner/versioned_range.go1
215:6slice-preallocation
pkg/bloombuild/planner/versioned_range.go:215:6
var outdated []bloomshipper.Meta var upToDate []bloomshipper.Metaintegration/client/client.go1
154:30standard-http-method-constant
integration/client/client.go:154:30
} req, err := http.NewRequest("POST", apiEndpoint, bytes.NewReader(data)) if err != nil {clients/pkg/logentry/stages/inspector.go1
90:2task-comment
clients/pkg/logentry/stages/inspector.go:90:2
// TODO(dannyk): try using go-cmp to filter this condition out with Equal(), but for now this just makes it work if fmt.Sprintf("%v", vx) == fmt.Sprintf("%v", vy) {pkg/logql/rangemapper_test.go1
137:38time-date
pkg/logql/rangemapper_test.go:137:38
)`, queryTime: time.Date(0, 0, 0, 12, 54, 0, 0, time.UTC), // 1970 12:54:00 splityByInterval: 1 * time.Hour,pkg/logcli/query/query.go1
586:9time-value-equality
pkg/logcli/query/query.go:586:9
func (q *Query) isInstant() bool { return q.Start == q.End && q.Step == 0}clients/cmd/docker-driver/http.go1
85:1top-level-declaration-order
clients/cmd/docker-driver/http.go:85:1
type response struct { Err stringclients/cmd/fluent-bit/loki.go1
143:23unchecked-type-assertion
clients/cmd/fluent-bit/loki.go:143:23
case "labels": for m, n := range v.(map[string]interface{}) { kuberneteslbs[model.LabelName(keyReplacer.Replace(m))] = model.LabelValue(fmt.Sprintf("%v", n))pkg/canary/reader/reader.go1
250:2unclosed-http-response-body
pkg/canary/reader/reader.go:250:2
resp, err := r.httpClient.Do(req) if err != nil {pkg/logql/log/pattern/lexer.rl.go1
12unexported-naming
pkg/logql/log/pattern/lexer.rl.go:12
var _pattern_key_offsets []byte = []byte{ 0, 0, 8, 10, 12, 14, 16, 18, clients/pkg/logentry/stages/drop.go1
149:40unexported-return
clients/pkg/logentry/stages/drop.go:149:40
func (m *dropStage) Run(in chan Entry) chan Entry { out := make(chan Entry)tools/deprecated-config-checker/main.go1
75:2unnecessary-format
tools/deprecated-config-checker/main.go:75:2
fmt.Printf("No deprecated or deleted configs found.\n")}pkg/logql/log/logfmt/decode.go1
106:1unreachable-code
pkg/logql/log/logfmt/decode.go:106:1
equal: dec.pos++operator/internal/handlers/dashboards_create.go1
20:94unused-parameter
operator/internal/handlers/dashboards_create.go:20:94
// CreateDashboards handles the LokiStack dashboards create events.func CreateDashboards(ctx context.Context, log logr.Logger, operatorNs string, k k8s.Client, s *runtime.Scheme) error { objs, err := openshift.BuildDashboards(operatorNs)clients/cmd/fluent-bit/dque.go1
154:7unused-receiver
clients/cmd/fluent-bit/dque.go:154:7
func (c *dqueClient) Name() string { return ""clients/cmd/docker-driver/config_test.go1
69:20use-any
clients/cmd/docker-driver/config_test.go:69:20
var pipeline = PipelineConfig{ PipelineStages: []interface{}{ map[string]interface{}{cmd/chunks-inspect/loki.go1
208:17use-errors-new
cmd/chunks-inspect/loki.go:208:17
if read <= 0 { return nil, fmt.Errorf("expected to find a length for a structured metadata string but did not find one") }integration/loki_micro_services_delete_test.go1
224:3use-slices-sort
integration/loki_micro_services_delete_test.go:224:3
require.Len(t, resp.Data.Stream, len(expectedStreams)) sort.Slice(resp.Data.Stream, func(i, j int) bool { return labels.FromMap(resp.Data.Stream[i].Stream).String() < labels.FromMap(resp.Data.Stream[j].Stream).String()clients/pkg/logentry/stages/util_test.go1
78:2var-naming
clients/pkg/logentry/stages/util_test.go:78:2
} s64_1, err := getString(f64_1) if err != nil {pkg/engine/internal/scheduler/wire/wire_http2_test.go1
257:4waitgroup-add-inside-goroutine
pkg/engine/internal/scheduler/wire/wire_http2_test.go:257:4
serverWg.Add(1) go func(p *wire.Peer) {clients/cmd/docker-driver/driver.go1
55:71add-constant
clients/cmd/docker-driver/driver.go:55:71
if err := l.jsonl.Close(); err != nil { level.Error(l.logger).Log("msg", "error while closing json logger", "err", err) }pkg/logql/bench/discover/pkg/tsdb/reader_test.go1
53:2call-to-gc
pkg/logql/bench/discover/pkg/tsdb/reader_test.go:53:2
runtime.GC() runtime.GC()clients/cmd/docker-driver/driver.go1
137:6cognitive-complexity
clients/cmd/docker-driver/driver.go:137:6
func consumeLog(lf *logPair) { dec := logdriver.NewLogEntryDecoder(lf.stream)clients/pkg/logentry/stages/drop.go1
46:2confusing-naming
clients/pkg/logentry/stages/drop.go:46:2
LongerThan *string `mapstructure:"longer_than"` longerThan flagext.ByteSize}operator/internal/manifests/internal/config/build.go1
34:35confusing-results
operator/internal/manifests/internal/config/build.go:34:35
// Build builds a loki stack configuration filesfunc Build(opts Options) ([]byte, []byte, error) { // Build loki config yamlclients/pkg/logentry/logql/ast.go1
43:6constructor-interface-return
clients/pkg/logentry/logql/ast.go:43:6
// NewFilterExpr wraps an existing Expr with a next filter expression.func NewFilterExpr(left Expr, ty labels.MatchType, match string) Expr { return &filterExpr{production/helm/loki/src/helm-test/canary_test.go1
80:45context-as-argument
production/helm/loki/src/helm-test/canary_test.go:80:45
func testResultPrometheus(t *testing.T, ctx context.Context, query string, test func(model.SampleValue) bool, msg string) error { // TODO (ewelch): if we did a lot of these, we'd want to reuse the client but right now we only run a couple testspkg/compactor/compactor.go1
494:34context-cancel-in-loop
pkg/compactor/compactor.go:494:34
level.Info(util_log.Logger).Log("msg", "this instance has been chosen to run the compactor, starting compactor") runningCtx, runningCancel = context.WithCancel(ctx)pkg/bloombuild/builder/batch.go1
35:2context-stored-in-struct
pkg/bloombuild/builder/batch.go:35:2
batchSize int ctx context.Context fetchers []Fetcher[A, B]clients/cmd/docker-driver/driver.go1
137:6cyclomatic-complexity
clients/cmd/docker-driver/driver.go:137:6
func consumeLog(lf *logPair) { dec := logdriver.NewLogEntryDecoder(lf.stream)cmd/loki/main.go1
41:2deep-exit
cmd/loki/main.go:41:2
util_log.Flush() os.Exit(code)}pkg/compactor/deletion/grpc_request_handler_test.go1
41:15deprecated-api-usage
pkg/compactor/deletion/grpc_request_handler_test.go:41:15
// nolint:staticcheck // grpc.DialContext() has been deprecated; we'll address it before upgrading to gRPC 2. conn, err := grpc.DialContext(context.Background(), "", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {clients/cmd/docker-driver/driver.go1
55:3discarded-error-result
clients/cmd/docker-driver/driver.go:55:3
if err := l.jsonl.Close(); err != nil { level.Error(l.logger).Log("msg", "error while closing json logger", "err", err) }clients/cmd/docker-driver/loki.go1
90:1doc-comment-period
clients/cmd/docker-driver/loki.go:90:1
// Log implements `logger.Logger`func (l *loki) Name() string {pkg/compactor/deletion/delete_requests_store_test.go1
550:23duration-multiplied-by-duration
pkg/compactor/deletion/delete_requests_store_test.go:550:23
UserID: user2, StartTime: now.Add(-i * time.Hour), EndTime: now.Add(-(i + 1) * time.Hour),clients/pkg/logentry/stages/drop.go1
206:3early-return
clients/pkg/logentry/stages/drop.go:206:3
} if match { if Debug {pkg/engine/internal/scheduler/wire/error.go1
16:5error-naming
pkg/engine/internal/scheduler/wire/error.go:16:5
var _ error = (*Error)(nil)clients/pkg/logentry/stages/metrics_test.go1
422:14error-strings
clients/pkg/logentry/stages/metrics_test.go:422:14
if ((err != nil) && (err.Error() != test.err.Error())) || (err == nil && test.err != nil) { t.Errorf("Metrics stage validation error, expected error = %v, actual error = %v", test.err, err) returnpkg/logql/bench/faker.go1
216:6error-type-naming
pkg/logql/bench/faker.go:216:6
// Faker provides methods to generate fake data consistentlytype Faker struct { rnd *rand.Randpkg/distributor/distributor_test.go1
1372:3excessive-blank-identifiers
pkg/distributor/distributor_test.go:1372:3
stream.Labels = `{buzz="f", a="b"}` _, _, _, _, _, err := d.parseStreamLabels(context.Background(), vCtx, stream.Labels, stream, streamResolver, constants.Loki) if err != nil {clients/cmd/docker-driver/http.go1
19:6exported-declaration-comment
clients/cmd/docker-driver/http.go:19:6
type StopLoggingRequest struct { File stringclients/pkg/util/client.go1
1:1file-length-limit
clients/pkg/util/client.go:1:1
package utilcmd/chunks-inspect/main.go1
28:47flag-parameter
cmd/chunks-inspect/main.go:28:47
func printFile(filename string, blockDetails, printLines, storeBlocks bool) { f, err := os.Open(filename)clients/cmd/docker-driver/driver.go1
1:1format
clients/cmd/docker-driver/driver.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/docker-driver/driver.go`
clients/cmd/fluent-bit/config_labels_test.go1
13:6function-length
clients/cmd/fluent-bit/config_labels_test.go:13:6
func Test_externalLabelsFromFluentBitLabelsOption(t *testing.T) { tests := []struct {operator/internal/handlers/internal/rules/rules.go1
25:6function-result-limit
operator/internal/handlers/internal/rules/rules.go:25:6
// - When remote write is enabled and the authorization Secret data is invalid.func BuildOptions( ctx context.Context,pkg/distributor/ratestore.go1
293:21get-function-return-value
pkg/distributor/ratestore.go:293:21
func (s *rateStore) getRatesFromIngesters(ctx context.Context, clients chan ingesterClient, responses chan *logproto.StreamRatesResponse) { for c := range clients {pkg/dataobj/internal/dataset/row_reader_downloader.go1
350:31identical-if-chain-branches
pkg/dataobj/internal/dataset/row_reader_downloader.go:350:31
continue } else if page == requestor { continue // Already added.clients/pkg/logentry/stages/metrics.go1
200:3identical-switch-branches
clients/pkg/logentry/stages/metrics.go:200:3
vec.DeleteAll() case *metric.Gauges: vec.DeleteAll()clients/cmd/docker-driver/loki_test.go1
10:2import-alias-naming
clients/cmd/docker-driver/loki_test.go:10:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/cmd/docker-driver/config.go1
148:2import-shadowing
clients/cmd/docker-driver/config.go:148:2
} url, err := url.Parse(rawURL) if err != nil {pkg/dataset/open.go1
71:6impossible-integer-comparison
pkg/dataset/open.go:71:6
} if posting.Length > int64(math.MaxInt) { errs = append(errs, fmt.Errorf("buffer %d is too large to read: %d bytes", id, posting.Length))pkg/kafka/partition/reader_service.go1
283:3increment-decrement
pkg/kafka/partition/reader_service.go:283:3
// Kafka returns the next empty offset so we must subtract 1 to get the oldest written offset. lastProducedOffset = lastProducedOffset - 1pkg/bloombuild/planner/retention_test.go1
750:4inefficient-map-lookup
pkg/bloombuild/planner/retention_test.go:750:4
if _, ok := tenants[tenant]; !ok { tenants[tenant] = &validation.Limits{} }pkg/compactor/client/http.go1
98:18inefficient-sprintf
pkg/compactor/client/http.go:98:18
if timeRange != nil { q.Set("start", fmt.Sprintf("%d", timeRange.Start.Unix())) q.Set("end", fmt.Sprintf("%d", timeRange.End.Unix()))clients/cmd/fluent-bit/config_test.go1
41:35insecure-url-scheme
clients/cmd/fluent-bit/config_test.go:41:35
clientConfig: util.Config{ URL: mustParseURL("http://localhost:3100/loki/api/v1/push"), BatchSize: defaultClientCfg.BatchSize,pkg/chunkenc/unordered.go1
27:16interface-method-limit
pkg/chunkenc/unordered.go:27:16
type HeadBlock interface { IsEmpty() boolcmd/chunks-inspect/time.go1
33:7marshal-receiver
cmd/chunks-inspect/time.go:33:7
// UnmarshalJSON implements the json.Unmarshaler interface.func (t *Time) UnmarshalJSON(b []byte) error { p := strings.Split(string(b), ".")cmd/migrate/main.go1
329:9max-control-nesting
cmd/migrate/main.go:329:9
onechunk, err = f.FetchChunks(m.ctx, onechunk) if err != nil { if retry == 0 {pkg/bloombuild/builder/builder.go1
57:6max-parameters
pkg/bloombuild/builder/builder.go:57:6
func New( cfg Config,integration/client/client.go1
546:6max-public-structs
integration/client/client.go:546:6
// Response holds the status and datatype Response struct { Status stringclients/cmd/fluent-bit/config.go1
59:3modifies-parameter
clients/cmd/fluent-bit/config.go:59:3
if labels == "" { labels = `{job="fluent-bit"}` }pkg/bloombuild/planner/versioned_range.go1
31:2modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:31:2
func (t tsdbTokenRange) Swap(i, j int) { t[i], t[j] = t[j], t[i]}clients/cmd/fluent-bit/config_labels_test.go1
14:13nested-structs
clients/cmd/fluent-bit/config_labels_test.go:14:13
func Test_externalLabelsFromFluentBitLabelsOption(t *testing.T) { tests := []struct { name stringclients/pkg/logentry/stages/json.go1
128:4nil-error-return
clients/pkg/logentry/stages/json.go:128:4
} return nil }pkg/analytics/seed.go1
33:3nil-value-with-nil-error
pkg/analytics/seed.go:33:3
if other == nil { return nil, nil }pkg/dataobj/internal/dataset/row_reader_test.go1
830:3no-defer-in-loop
pkg/dataobj/internal/dataset/row_reader_test.go:830:3
next, stop := iter.Pull(columnValues(rng, colCfg)) defer stop()operator/internal/manifests/storage/configure.go1
257:5no-else-after-return
operator/internal/manifests/storage/configure.go:257:5
} } else { return []corev1.EnvVar{clients/pkg/logentry/logql/parser.go1
14:6no-init
clients/pkg/logentry/logql/parser.go:14:6
func init() { // Improve the error messages coming out of yacc.pkg/compactor/deletion/delete_requests_db_boltdb.go1
136:3no-naked-return
pkg/compactor/deletion/delete_requests_db_boltdb.go:136:3
_, err = tx.WriteTo(compressedWriter) return })clients/cmd/docker-driver/config_test.go1
62:5no-package-var
clients/cmd/docker-driver/config_test.go:62:5
var pipelineString = `- regex:pkg/ingester/recalculate_owned_streams.go1
134:21non-pointer-sync-pool-value
pkg/ingester/recalculate_owned_streams.go:134:21
s.hostsBufPool.Put(hostsBuf[:0]) s.zoneBufPool.Put(zoneBuf[:0]) }()clients/pkg/logentry/stages/eventlogmessage_test.go1
368:4overwritten-before-use
clients/pkg/logentry/stages/eventlogmessage_test.go:368:4
if len(resultKey) > 1 { val = strings.TrimSpace(resultKey[1]) }clients/cmd/docker-driver/http.go1
1:9package-comments
clients/cmd/docker-driver/http.go:1:9
package mainpkg/dataobj/compaction/planner.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/planner.go:1:9
package plannerclients/pkg/logentry/logql/parser_test.go1
166:25range-value-address
clients/pkg/logentry/logql/parser_test.go:166:25
if matcher.Type == labels.MatchNotRegexp || matcher.Type == labels.MatchRegexp { typed.matchers[i] = &labels.Matcher{Type: matcher.Type, Name: matcher.Name, Value: matcher.Value} }operator/api/loki/v1beta1/recordingrule_types.go1
152:7receiver-naming
operator/api/loki/v1beta1/recordingrule_types.go:152:7
// ConvertFrom converts from the Hub version (v1) to this version (v1beta1).func (dst *RecordingRule) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*v1.RecordingRule)pkg/bloombuild/planner/tableIterator.go1
10:2redefines-builtin-id
pkg/bloombuild/planner/tableIterator.go:10:2
type dayRangeIterator struct { min, max, cur config.DayTime curPeriod config.PeriodConfigpkg/logql/syntax/fuzz.go1
2:1redundant-build-tag
pkg/logql/syntax/fuzz.go:2:1
//go:build gofuzz// +build gofuzzclients/pkg/logentry/stages/geoip.go1
258:10redundant-conversion
clients/pkg/logentry/stages/geoip.go:258:10
if autonomousSystemNumber != 0 { labels[model.LabelName("geoip_autonomous_system_number")] = model.LabelValue(fmt.Sprint(autonomousSystemNumber)) }operator/api/loki/v1beta1/alertingrule_types_test.go1
6:2redundant-import-alias
operator/api/loki/v1beta1/alertingrule_types_test.go:6:2
v1 "github.com/grafana/loki/operator/api/loki/v1" "github.com/grafana/loki/operator/api/loki/v1beta1"operator/internal/status/status.go1
59:3redundant-switch-break
operator/internal/status/status.go:59:3
// break into retry-logic below on conflict break default:- Fix (safe): remove the redundant break
operator/internal/handlers/internal/rules/cleanup_test.go1
167:3single-case-switch
operator/internal/handlers/internal/rules/cleanup_test.go:167:3
k.ListStub = func(_ context.Context, list client.ObjectList, options ...client.ListOption) error { switch list.(type) { case *corev1.ConfigMapList:pkg/bloomgateway/client.go1
217:8slice-preallocation
pkg/bloomgateway/client.go:217:8
level.Error(c.logger).Log("msg", "failed to resolve server address for block", "block", blockWithSeries.block, "err", err) var series [][]*logproto.GroupedChunkRefs for i := range blocks {integration/client/client.go1
202:30standard-http-method-constant
integration/client/client.go:202:30
} req, err := http.NewRequest("POST", apiEndpoint, bytes.NewReader(data)) if err != nil {operator/api/loki/v1/lokistack_types.go1
47:2task-comment
operator/api/loki/v1/lokistack_types.go:47:2
// // FIXME: Add clear description of ingestion/query performance expectations. SizeOneXPico LokiStackSizeType = "1x.pico"pkg/logql/rangemapper_test.go1
150:35time-date
pkg/logql/rangemapper_test.go:150:35
)`, queryTime: time.Date(0, 0, 0, 12, 54, 0, 0, time.UTC), // 1970 12:54:00 splityByInterval: 1 * time.Hour,pkg/storage/batch.go1
255:8time-value-equality
pkg/storage/batch.go:255:8
if from.Equal(it.end) { if it.end != it.start { return nilclients/cmd/docker-driver/logdriver/io.go1
26:1top-level-declaration-order
clients/cmd/docker-driver/logdriver/io.go:26:1
type logEntryEncoder struct { buf []byteclients/cmd/fluent-bit/out_grafana_loki.go1
109:43unchecked-type-assertion
clients/cmd/fluent-bit/out_grafana_loki.go:109:43
func FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, _ *C.char) int { plugin := output.FLBPluginGetContext(ctx).(*loki) if plugin == nil {pkg/canary/reader/reader.go1
341:2unclosed-http-response-body
pkg/canary/reader/reader.go:341:2
resp, err := r.httpClient.Do(req) if err != nil {pkg/logql/log/pattern/lexer.rl.go1
17unexported-naming
pkg/logql/log/pattern/lexer.rl.go:17
var _pattern_trans_keys []byte = []byte{ 62, 95, 48, 57, 65, 90, 97, 122, clients/pkg/logentry/stages/eventlogmessage.go1
69:51unexported-return
clients/pkg/logentry/stages/eventlogmessage.go:69:51
func (m *eventLogMessageStage) Run(in chan Entry) chan Entry { out := make(chan Entry)pkg/logql/log/logfmt/decode.go1
140:1unreachable-code
pkg/logql/log/logfmt/decode.go:140:1
skip_value: for p, c := range line[dec.pos:] {operator/internal/handlers/internal/gateway/cleanup.go1
21:35unused-parameter
operator/internal/handlers/internal/gateway/cleanup.go:21:35
// Cleanup removes external access resources (Routes/Ingress) when external access is disabled.func Cleanup(ctx context.Context, log logr.Logger, k k8s.Client, stack *v1.LokiStack) error { if stack.Spec.Tenants == nil || !stack.Spec.Tenants.DisableIngress {clients/pkg/logentry/logql/ast.go1
28:7unused-receiver
clients/pkg/logentry/logql/ast.go:28:7
func (e *matchersExpr) Filter() (Filter, error) { return nil, nilclients/cmd/docker-driver/config_test.go1
70:14use-any
clients/cmd/docker-driver/config_test.go:70:14
PipelineStages: []interface{}{ map[string]interface{}{ "regex": map[string]interface{}{cmd/chunks-inspect/loki.go1
222:15use-errors-new
cmd/chunks-inspect/loki.go:222:15
if n <= 0 { return nil, fmt.Errorf("failed to read number of blocks") }integration/loki_micro_services_delete_test.go1
228:4use-slices-sort
integration/loki_micro_services_delete_test.go:228:4
for _, stream := range resp.Data.Stream { sort.Slice(stream.Values, func(i, j int) bool { return stream.Values[i][1] < stream.Values[j][1]cmd/chunks-inspect/loki.go1
42:2var-naming
cmd/chunks-inspect/loki.go:42:2
encSnappy = Encoding{code: 4, name: "snappy", readerFn: func(reader io.Reader) (io.Reader, error) { return snappy.NewReader(reader), nil }} enclz4_256k = Encoding{code: 5, name: "lz4-256k", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }} enclz4_1M = Encoding{code: 6, name: "lz4-1M", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }}pkg/engine/internal/scheduler/wire/wire_http2_test.go1
318:4waitgroup-add-inside-goroutine
pkg/engine/internal/scheduler/wire/wire_http2_test.go:318:4
var peerWg sync.WaitGroup peerWg.Add(1) go func() {clients/cmd/docker-driver/driver.go1
164:71add-constant
clients/cmd/docker-driver/driver.go:164:71
if err := lf.lokil.Log(&msg); err != nil { level.Error(lf.logger).Log("msg", "error pushing message to loki", "id", lf.info.ContainerID, "err", err, "message", msg) }pkg/querier/queryrange/detected_fields_test.go1
122:4call-to-gc
pkg/querier/queryrange/detected_fields_test.go:122:4
t.Run("detects fields with huge limit doesn't explode memory", func(t *testing.T) { runtime.GC() var before runtime.MemStatsclients/cmd/fluent-bit/config.go1
72:6cognitive-complexity
clients/cmd/fluent-bit/config.go:72:6
func parseConfig(cfg ConfigGetter) (*config, error) { res := &config{}clients/pkg/util/api.go1
55:23confusing-naming
clients/pkg/util/api.go:55:23
func (e entryHandler) Stop() { e.stop()operator/internal/manifests/internal/config/build_test.go1
21:59confusing-results
operator/internal/manifests/internal/config/build_test.go:21:59
func loadTestData(t *testing.T, testcase string) (string, string) { t.Helper()clients/pkg/logentry/stages/extensions.go1
143:6constructor-interface-return
clients/pkg/logentry/stages/extensions.go:143:6
// NewCRI creates a CRI format specific pipeline stagefunc NewCRI(logger log.Logger, config interface{}, registerer prometheus.Registerer) (Stage, error) { base := PipelineStages{production/helm/loki/src/helm-test/canary_test.go1
112:41context-as-argument
production/helm/loki/src/helm-test/canary_test.go:112:41
func testResultCanary(t *testing.T, ctx context.Context, metric string, test func(model.SampleValue) bool, msg string) error { address := os.Getenv("CANARY_SERVICE_ADDRESS")pkg/engine/internal/worker/scheduler_lookup.go1
90:40context-cancel-in-loop
pkg/engine/internal/worker/scheduler_lookup.go:90:40
var handler handlerContext handler.Context, handler.Cancel = context.WithCancel(ctx) handlers[update.Addr] = handlerpkg/bloombuild/builder/batch.go1
190:2context-stored-in-struct
pkg/bloombuild/builder/batch.go:190:2
// constructor arguments ctx context.Context fetcher Fetcher[bloomshipper.BlockRef, *bloomshipper.CloseableBlockQuerier]clients/cmd/fluent-bit/config.go1
72:6cyclomatic-complexity
clients/cmd/fluent-bit/config.go:72:6
func parseConfig(cfg ConfigGetter) (*config, error) { res := &config{}cmd/migrate/main.go1
405:3deep-exit
cmd/migrate/main.go:405:3
if err != nil { log.Fatalf("Unable to parse time %v", err) }pkg/compactor/jobqueue/queue_test.go1
75:15deprecated-api-usage
pkg/compactor/jobqueue/queue_test.go:75:15
// nolint:staticcheck // compactor_grpc.DialContext() has been deprecated; we'll address it before upgrading to gRPC 2. conn, err := grpc.DialContext(context.Background(), "", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) {clients/cmd/docker-driver/driver.go1
76:2discarded-error-result
clients/cmd/docker-driver/driver.go:76:2
logCtx.LogPath = filepath.Join(folder, "json.log") level.Info(d.logger).Log("msg", "starting logging driver for container", "id", logCtx.ContainerID, "config", fmt.Sprintf("%+v", logCtx.Config), "file", file, "logpath", logCtx.LogPath)clients/cmd/docker-driver/loki.go1
95:1doc-comment-period
clients/cmd/docker-driver/loki.go:95:1
// Log implements `logger.Logger`func (l *loki) Close() error {pkg/compactor/deletion/delete_requests_store_test.go1
551:23duration-multiplied-by-duration
pkg/compactor/deletion/delete_requests_store_test.go:551:23
StartTime: now.Add(-i * time.Hour), EndTime: now.Add(-(i + 1) * time.Hour), Query: fmt.Sprintf(`{foo="%d", user="%s"}`, i, user2),clients/pkg/logentry/stages/match.go1
123:3early-return
clients/pkg/logentry/stages/match.go:123:3
if err != nil { if existing, ok := err.(prometheus.AlreadyRegisteredError); ok { dropCount = existing.ExistingCollector.(*prometheus.CounterVec)pkg/storage/chunk/client/congestion/retry.go1
12:5error-naming
pkg/storage/chunk/client/congestion/retry.go:12:5
var RetriesExceeded = errors.New("retries exceeded")clients/pkg/logentry/stages/regex_test.go1
212:14error-strings
clients/pkg/logentry/stages/regex_test.go:212:14
if (err != nil) != (tt.err != nil) { t.Errorf("RegexConfig.validate() expected error = %v, actual error = %v", tt.err, err) returnpkg/querier/worker/util_test.go1
31:6error-type-naming
pkg/querier/worker/util_test.go:31:6
// error so errors.Is keeps working.type grpcStatusErr struct { code codes.Codepkg/ingester/limiter_test.go1
498:3excessive-blank-identifiers
pkg/ingester/limiter_test.go:498:3
// Expected: 200 (the higher of the two) calculated, _, _, _ := streamCountLimiter.getCurrentLimit("tenant1", noPolicy, fixedLimitSupplier) require.Equal(t, 200, calculated, "Without policy, should use the higher of calculated and fixed limits")clients/cmd/docker-driver/http.go1
23:6exported-declaration-comment
clients/cmd/docker-driver/http.go:23:6
type CapabilitiesResponse struct { Err stringcmd/logcli/main.go1
1:1file-length-limit
cmd/logcli/main.go:1:1
package maincmd/chunks-inspect/main.go1
28:59flag-parameter
cmd/chunks-inspect/main.go:28:59
func printFile(filename string, blockDetails, printLines, storeBlocks bool) { f, err := os.Open(filename)clients/cmd/docker-driver/http.go1
1:1format
clients/cmd/docker-driver/http.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/docker-driver/http.go`
clients/cmd/fluent-bit/config_test.go1
26:6function-length
clients/cmd/fluent-bit/config_test.go:26:6
func Test_parseConfig(t *testing.T) { fileName := createTempLabelMap(t)operator/internal/manifests/gateway.go1
543:6function-result-limit
operator/internal/manifests/gateway.go:543:6
// gatewayConfigObjs creates a configMap for rbac.yaml and a secret for tenants.yamlfunc gatewayConfigObjs(opt Options) (*corev1.ConfigMap, *corev1.Secret, string, error) { cfg := gatewayConfigOptions(opt)pkg/logcli/index/volume.go1
14:6get-function-return-value
pkg/logcli/index/volume.go:14:6
// GetVolume executes a volume query and prints the resultsfunc GetVolume(q *volume.Query, c client.Client, out output.LogOutput, statistics bool) { do(q, false, c, out, statistics)pkg/dataobj/internal/dataset/value_encoding_bitmap_test.go1
168:49identical-if-chain-branches
pkg/dataobj/internal/dataset/value_encoding_bitmap_test.go:168:49
t.Skip() } else if distinct < 1 || distinct*10 > count { // at most 10% of the values can be trueclients/pkg/logentry/stages/metrics.go1
202:3identical-switch-branches
clients/pkg/logentry/stages/metrics.go:202:3
vec.DeleteAll() case *metric.Histograms: vec.DeleteAll()clients/cmd/docker-driver/main.go1
16:2import-alias-naming
clients/cmd/docker-driver/main.go:16:2
_ "github.com/grafana/loki/v3/pkg/util/build" util_log "github.com/grafana/loki/v3/pkg/util/log")clients/cmd/docker-driver/driver.go1
29:2import-shadowing
clients/cmd/docker-driver/driver.go:29:2
idx map[string]*logPair logger log.Logger}pkg/storage/stores/shipper/indexshipper/tsdb/index/index.go1
965:5impossible-integer-comparison
pkg/storage/stores/shipper/indexshipper/tsdb/index/index.go:965:5
// Had to uint32 wrap these for arm32 builds, which we'll remove in the future. if uint32(ln) > uint32(math.MaxUint32) { return errors.Errorf("fingerprint offset size exceeds 4 bytes: %d", ln)pkg/logql/sketch/topk_test.go1
156:3increment-decrement
pkg/logql/sketch/topk_test.go:156:3
} m[s] = m[s] + 1 if _, ok := h.Find(s); ok {pkg/compactor/deletion/deletion_manifest_builder.go1
171:4inefficient-map-lookup
pkg/compactor/deletion/deletion_manifest_builder.go:171:4
d.currentSegment[chunksGroupIdentifier] = deletionproto.ChunksGroup{ Requests: deleteRequests,pkg/compactor/client/http.go1
99:16inefficient-sprintf
pkg/compactor/client/http.go:99:16
q.Set("start", fmt.Sprintf("%d", timeRange.Start.Unix())) q.Set("end", fmt.Sprintf("%d", timeRange.End.Unix())) }clients/cmd/fluent-bit/config_test.go1
54:22insecure-url-scheme
clients/cmd/fluent-bit/config_test.go:54:22
map[string]string{ "URL": "http://somewhere.com:3100/loki/api/v1/push", "TenantID": "my-tenant-id",pkg/compactor/deletion/delete_requests_store.go1
32:26interface-method-limit
pkg/compactor/deletion/delete_requests_store.go:32:26
type DeleteRequestsStore interface { AddDeleteRequest(ctx context.Context, userID, query string, startTime, endTime model.Time, shardByInterval time.Duration) (string, error)pkg/chunkenc/facade.go1
60:7marshal-receiver
pkg/chunkenc/facade.go:60:7
// UnmarshalFromBuf implements chunk.Chunk.func (f *Facade) UnmarshalFromBuf(buf []byte) error { var err errorcmd/migrate/main.go1
330:10max-control-nesting
cmd/migrate/main.go:330:10
if err != nil { if retry == 0 { log.Println(threadID, "Final error retrieving chunks, giving up:", err)pkg/bloombuild/builder/spec.go1
44:6max-parameters
pkg/bloombuild/builder/spec.go:44:6
// Blocks which are incompatible with the schema are skipped and will have their chunks reindexedfunc NewSimpleBloomGenerator( userID string,integration/client/client.go1
551:6max-public-structs
integration/client/client.go:551:6
type RulesResponse struct { Status stringclients/cmd/fluent-bit/loki.go1
144:5modifies-parameter
clients/cmd/fluent-bit/loki.go:144:5
for m, n := range v.(map[string]interface{}) { kuberneteslbs[model.LabelName(keyReplacer.Replace(m))] = model.LabelValue(fmt.Sprintf("%v", n)) }pkg/bloombuild/planner/versioned_range.go1
31:8modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:31:8
func (t tsdbTokenRange) Swap(i, j int) { t[i], t[j] = t[j], t[i]}clients/cmd/fluent-bit/config_test.go1
30:13nested-structs
clients/cmd/fluent-bit/config_test.go:30:13
tests := []struct { name stringclients/pkg/logentry/stages/metrics.go1
367:3nil-error-return
clients/pkg/logentry/stages/metrics.go:367:3
} return dur.Seconds(), nil }pkg/analytics/seed.go1
37:3nil-value-with-nil-error
pkg/analytics/seed.go:37:3
if c.CreatedAt.Before(other.CreatedAt) { return nil, nil }pkg/logcli/query/query.go1
315:3no-defer-in-loop
pkg/logcli/query/query.go:315:3
} defer f.Close()pkg/canary/reader/reader.go1
503:6no-else-after-return
pkg/canary/reader/reader.go:503:6
return nil } else if _, ok := err.(net.Error); ok { return nilclients/pkg/logentry/stages/regex_test.go1
55:6no-init
clients/pkg/logentry/stages/regex_test.go:55:6
func init() { Debug = truepkg/compactor/retention/util_test.go1
264:2no-naked-return
pkg/compactor/retention/util_test.go:264:2
} return}clients/cmd/docker-driver/config_test.go1
68:5no-package-var
clients/cmd/docker-driver/config_test.go:68:5
`var pipeline = PipelineConfig{ PipelineStages: []interface{}{pkg/logproto/timeseries.go1
79:16non-pointer-sync-pool-value
pkg/logproto/timeseries.go:79:16
slicePool.Put(ts[:0]) //nolint:staticcheck //see comment on slicePool for more details}clients/pkg/logentry/stages/eventlogmessage_test.go1
372:4overwritten-before-use
clients/pkg/logentry/stages/eventlogmessage_test.go:372:4
if len(resultKey) > 1 { val = strings.TrimSpace(resultKeyValue[1]) }clients/cmd/docker-driver/logdriver/io.go1
1:9package-comments
clients/cmd/docker-driver/logdriver/io.go:1:9
package logdriverpkg/dataobj/compaction/planner_test.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/planner_test.go:1:9
package plannerclients/pkg/logentry/metric/counters_test.go1
83:33range-value-address
clients/pkg/logentry/metric/counters_test.go:83:33
t.Parallel() err := validateCounterConfig(&tt.config) if ((err != nil) && (err.Error() != tt.err.Error())) || (err == nil && tt.err != nil) {operator/api/loki/v1beta1/rulerconfig_types.go1
779:7receiver-naming
operator/api/loki/v1beta1/rulerconfig_types.go:779:7
// ConvertFrom converts from the Hub version (v1) to this version (v1beta1).func (dst *RulerConfig) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*v1.RulerConfig)pkg/bloombuild/planner/tableIterator.go1
10:7redefines-builtin-id
pkg/bloombuild/planner/tableIterator.go:10:7
type dayRangeIterator struct { min, max, cur config.DayTime curPeriod config.PeriodConfigpkg/logql/syntax/fuzz_test.go1
2:1redundant-build-tag
pkg/logql/syntax/fuzz_test.go:2:1
//go:build gofuzz// +build gofuzzclients/pkg/logentry/stages/geoip.go1
261:10redundant-conversion
clients/pkg/logentry/stages/geoip.go:261:10
if autonomousSystemOrganization != "" { labels[model.LabelName("geoip_autonomous_system_organization")] = model.LabelValue(autonomousSystemOrganization) }operator/api/loki/v1beta1/lokistack_types.go1
4:2redundant-import-alias
operator/api/loki/v1beta1/lokistack_types.go:4:2
import ( v1 "github.com/grafana/loki/operator/api/loki/v1" corev1 "k8s.io/api/core/v1"pkg/logql/syntax/query_scanner.go1
691:4redundant-switch-break
pkg/logql/syntax/query_scanner.go:691:4
case EOF: break case '"':- Fix (safe): remove the redundant break
operator/internal/handlers/internal/rules/rules_test.go1
362:3single-case-switch
operator/internal/handlers/internal/rules/rules_test.go:362:3
k.ListStub = func(_ context.Context, ol client.ObjectList, opt ...client.ListOption) error { switch ol.(type) { case *lokiv1.RecordingRuleList:pkg/bloomgateway/querier.go1
146:6slice-preallocation
pkg/bloomgateway/querier.go:146:6
var skippedGrps [][]*logproto.GroupedChunkRefs responses := make([][]*logproto.GroupedChunkRefs, 0, 2)integration/client/client.go1
230:30standard-http-method-constant
integration/client/client.go:230:30
url := fmt.Sprintf("%s%s", c.baseURL, path) req, err := http.NewRequest("GET", url, nil) if err != nil {operator/api/loki/v1/lokistack_types.go1
55:2task-comment
operator/api/loki/v1/lokistack_types.go:55:2
// // FIXME: Add clear description of ingestion/query performance expectations. SizeOneXExtraSmall LokiStackSizeType = "1x.extra-small"pkg/logql/rangemapper_test.go1
150:38time-date
pkg/logql/rangemapper_test.go:150:38
)`, queryTime: time.Date(0, 0, 0, 12, 54, 0, 0, time.UTC), // 1970 12:54:00 splityByInterval: 1 * time.Hour,pkg/storage/chunk/cache/resultscache/cache.go1
370:7time-value-equality
pkg/storage/chunk/cache/resultscache/cache.go:370:7
// This means the extent's start and end time would be same, even if the timerange covers several hours. if (req.GetStart() != req.GetEnd()) && ((end - start) > s.minCacheExtent) && (extent.End-extent.Start < s.minCacheExtent) { continueclients/cmd/fluent-bit/buffer.go1
17:1top-level-declaration-order
clients/cmd/fluent-bit/buffer.go:17:1
var defaultBufferConfig = bufferConfig{ buffer: false,clients/cmd/fluent-bit/out_grafana_loki.go1
131:18unchecked-type-assertion
clients/cmd/fluent-bit/out_grafana_loki.go:131:18
case output.FLBTime: timestamp = ts.(output.FLBTime).Time case uint64:pkg/compactor/client/http.go1
112:2unclosed-http-response-body
pkg/compactor/client/http.go:112:2
resp, err := c.httpClient.Do(req) if err != nil {pkg/logql/log/pattern/lexer.rl.go1
26unexported-naming
pkg/logql/log/pattern/lexer.rl.go:26
var _pattern_single_lengths []byte = []byte{ 0, 2, 0, 0, 0, 0, 0, 0, clients/pkg/logentry/stages/extensions.go1
66:37unexported-return
clients/pkg/logentry/stages/extensions.go:66:37
// implements Stage interfacefunc (c *cri) Run(entry chan Entry) chan Entry { entry = c.base.Run(entry)pkg/logql/log/logfmt/decode.go1
151:1unreachable-code
pkg/logql/log/logfmt/decode.go:151:1
qvalue: const (pkg/columnar/columnartest/equality.go1
96:43unused-parameter
pkg/columnar/columnartest/equality.go:96:43
func requireNullArraysEqual(t testing.TB, left, right *columnar.Null, mask memory.Bitmap) { // Nothing to do here; the base checks in RequireArraysEqual coversclients/pkg/logentry/metric/metricvec.go1
34:7unused-receiver
clients/pkg/logentry/metric/metricvec.go:34:7
// see https://godoc.org/github.com/prometheus/client_golang/prometheus#hdr-Custom_Collectors_and_constant_Metrics search for "unchecked"func (c *metricVec) Describe(_ chan<- *prometheus.Desc) {}clients/cmd/docker-driver/config_test.go1
71:24use-any
clients/cmd/docker-driver/config_test.go:71:24
map[string]interface{}{ "regex": map[string]interface{}{ "expression": "(level|lvl|severity)=(?P<level>\\w+)",integration/parse_metrics.go1
15:25use-errors-new
integration/parse_metrics.go:15:25
var ( ErrNoMetricFound = fmt.Errorf("metric not found") ErrInvalidMetricType = fmt.Errorf("invalid metric type")integration/loki_micro_services_delete_test.go1
433:2use-slices-sort
integration/loki_micro_services_delete_test.go:433:2
sort.Slice(svs, func(i, j int) bool { return labels.FromMap(svs[i].Stream).String() < labels.FromMap(svs[j].Stream).String()cmd/chunks-inspect/loki.go1
43:2var-naming
cmd/chunks-inspect/loki.go:43:2
enclz4_256k = Encoding{code: 5, name: "lz4-256k", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }} enclz4_1M = Encoding{code: 6, name: "lz4-1M", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }} enclz4_4M = Encoding{code: 7, name: "lz4-4M", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }}clients/cmd/fluent-bit/config_labels_test.go1
35:54add-constant
clients/cmd/fluent-bit/config_labels_test.go:35:54
labels: `{job="fluent-bit",env="prod"}`, want: flagext.LabelSet{LabelSet: model.LabelSet{"job": "fluent-bit", "env": "prod"}}, },pkg/querier/queryrange/detected_fields_test.go1
129:4call-to-gc
pkg/querier/queryrange/detected_fields_test.go:129:4
runtime.GC() var after runtime.MemStatsclients/cmd/fluent-bit/config_test.go1
160:6cognitive-complexity
clients/cmd/fluent-bit/config_test.go:160:6
func assertConfig(t *testing.T, expected, actual *config) { if expected.clientConfig.BatchSize != actual.clientConfig.BatchSize {integration/client/client.go1
124:18confusing-naming
integration/client/client.go:124:18
// pushLogLine creates a new loglinefunc (c *Client) pushLogLine(line string, timestamp time.Time, structuredMetadata labels.Labels, extraLabelList ...map[string]string) error { apiEndpoint := fmt.Sprintf("%s/loki/api/v1/push", c.baseURL)pkg/bloombuild/planner/versioned_range.go1
213:69confusing-results
pkg/bloombuild/planner/versioned_range.go:213:69
func outdatedMetas(metas []bloomshipper.Meta) ([]bloomshipper.Meta, []bloomshipper.Meta) { var outdated []bloomshipper.Metaclients/pkg/util/api.go1
60:6constructor-interface-return
clients/pkg/util/api.go:60:6
// NewEntryHandler creates a new EntryHandler using a input channel and a stop function.func NewEntryHandler(entries chan<- Entry, stop func()) EntryHandler { return entryHandler{pkg/logql/bench/bench_test.go1
499:7context-cancel-in-loop
pkg/logql/bench/bench_test.go:499:7
ctx, cancel := context.WithTimeout(ctx, time.Minute) defer cancel()pkg/bloombuild/builder/batch_test.go1
31:3context-stored-in-struct
pkg/bloombuild/builder/batch_test.go:31:3
desc string ctx context.Context batchSize intclients/cmd/fluent-bit/config_test.go1
160:6cyclomatic-complexity
clients/cmd/fluent-bit/config_test.go:160:6
func assertConfig(t *testing.T, expected, actual *config) { if expected.clientConfig.BatchSize != actual.clientConfig.BatchSize {cmd/querytee/main.go1
86:2deep-exit
cmd/querytee/main.go:86:2
util_log.Flush() os.Exit(code)}pkg/indexgateway/client_pool.go1
27:15deprecated-api-usage
pkg/indexgateway/client_pool.go:27:15
// nolint:staticcheck // grpc.Dial() has been deprecated; we'll address it before upgrading to gRPC 2. conn, err := grpc.Dial(address, opts...) if err != nil {clients/cmd/docker-driver/driver.go1
120:2discarded-error-result
clients/cmd/docker-driver/driver.go:120:2
func (d *driver) StopLogging(file string) { level.Debug(d.logger).Log("msg", "Stop logging", "file", file) d.mu.Lock()clients/cmd/fluent-bit/dque.go1
120:1doc-comment-period
clients/cmd/fluent-bit/dque.go:120:1
// Stop the clientfunc (c *dqueClient) Stop() {clients/pkg/logentry/stages/pack.go1
42:4early-return
clients/pkg/logentry/stages/pack.go:42:4
if k == logqlmodel.PackedEntryKey { if s, ok := v.(string); ok { w.Entry = sclients/pkg/logentry/stages/regex_test.go1
216:14error-strings
clients/pkg/logentry/stages/regex_test.go:216:14
if (err != nil) && (err.Error() != tt.err.Error()) { t.Errorf("RegexConfig.validate() expected error = %v, actual error = %v", tt.err, err) returnpkg/ruler/storage/instance/errors.go1
12:6error-type-naming
pkg/ruler/storage/instance/errors.go:12:6
// with the new config.type ErrInvalidUpdate struct { Inner errorpkg/ingester/limiter_test.go1
505:3excessive-blank-identifiers
pkg/ingester/limiter_test.go:505:3
// Expected: 100 (policy limit takes precedence) calculated, _, _, _ = streamCountLimiter.getCurrentLimit("tenant1", "finance", fixedLimitSupplier) require.Equal(t, 100, calculated, "With policy, policy limit should take precedence over fixed limit")clients/cmd/docker-driver/http.go1
28:6exported-declaration-comment
clients/cmd/docker-driver/http.go:28:6
type ReadLogsRequest struct { Info logger.Infointegration/client/client.go1
1:1file-length-limit
integration/client/client.go:1:1
package clientcmd/logcli/main.go1
656:15flag-parameter
cmd/logcli/main.go:656:15
func newQuery(instant bool, cmd *kingpin.CmdClause) *query.Query { // calculate query range from cli paramsclients/cmd/docker-driver/loki.go1
1:1format
clients/cmd/docker-driver/loki.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/docker-driver/loki.go`
clients/cmd/fluent-bit/loki_test.go1
21:6function-length
clients/cmd/fluent-bit/loki_test.go:21:6
func Test_loki_sendRecord(t *testing.T) { simpleRecordFixture := map[interface{}]interface{}{operator/internal/manifests/internal/gateway/build.go1
45:6function-result-limit
operator/internal/manifests/internal/gateway/build.go:45:6
// Build builds a loki gateway configuration filesfunc Build(opts Options) (rbacCfg []byte, tenantsCfg []byte, regoCfg []byte, err error) { // Build loki gateway rbac yamlpkg/logcli/index/volume.go1
20:6get-function-return-value
pkg/logcli/index/volume.go:20:6
// be a collection of data points over time.func GetVolumeRange(q *volume.Query, c client.Client, out output.LogOutput, statistics bool) { do(q, true, c, out, statistics)pkg/logql/bench/metadata_resolver.go1
152:46identical-if-chain-branches
pkg/logql/bench/metadata_resolver.go:152:46
rangeFiltered = append(rangeFiltered, sel) } else if !isInstant && meta.MinRange > 0 { rangeFiltered = append(rangeFiltered, sel)clients/pkg/logentry/stages/metrics.go1
329:2identical-switch-branches
clients/pkg/logentry/stages/metrics.go:329:2
return float64(i), nil case int64: return float64(i), nilclients/cmd/fluent-bit/config.go1
11:2import-alias-naming
clients/cmd/fluent-bit/config.go:11:2
dskit_flagext "github.com/grafana/dskit/flagext" "github.com/grafana/dskit/log"clients/cmd/docker-driver/driver.go1
37:2import-shadowing
clients/cmd/docker-driver/driver.go:37:2
info logger.Info logger log.Logger // folder where json log files will be created.pkg/storage/stores/shipper/indexshipper/tsdb/index/index.go1
1150:6impossible-integer-comparison
pkg/storage/stores/shipper/indexshipper/tsdb/index/index.go:1150:6
for _, off := range offs { if off > (1<<32)-1 { return errors.Errorf("series offset %d exceeds 4 bytes", off)pkg/logql/sketch/topk_test.go1
237:3increment-decrement
pkg/logql/sketch/topk_test.go:237:3
} m[s] = m[s] + 1 if _, ok := h.Find(s); ok {pkg/compactor/deletion/job_builder_test.go1
27:3inefficient-map-lookup
pkg/compactor/deletion/job_builder_test.go:27:3
if _, ok := t.updates[tableName]; !ok { t.updates[tableName] = map[string]map[string]deletionproto.StorageUpdates{ userID: {pkg/compactor/compactor_test.go1
161:10inefficient-sprintf
pkg/compactor/compactor_test.go:161:10
indexFromTime := func(t time.Time) string { return fmt.Sprintf("%d", t.Unix()/int64(24*time.Hour/time.Second)) }clients/cmd/fluent-bit/config_test.go1
72:35insecure-url-scheme
clients/cmd/fluent-bit/config_test.go:72:35
clientConfig: util.Config{ URL: mustParseURL("http://somewhere.com:3100/loki/api/v1/push"), TenantID: "my-tenant-id",pkg/distributor/limits.go1
13:13interface-method-limit
pkg/distributor/limits.go:13:13
// Limits is an interface for distributor limits/related configstype Limits interface { retention.Limitspkg/dataobj/internal/dataset/value.go1
211:7marshal-receiver
pkg/dataobj/internal/dataset/value.go:211:7
// [Value.MarshalBinary] for the encoding format.func (v *Value) UnmarshalBinary(data []byte) error { if len(data) == 0 {cmd/migrate/main.go1
341:8max-control-nesting
cmd/migrate/main.go:341:8
if retry < 0 { continuepkg/canary/comparator/comparator.go1
148:6max-parameters
pkg/canary/comparator/comparator.go:148:6
func NewComparator(writer io.Writer, wait time.Duration,integration/client/client.go1
556:6max-public-structs
integration/client/client.go:556:6
type RulesData struct { Groups []Rulesclients/cmd/fluent-bit/loki.go1
150:4modifies-parameter
clients/cmd/fluent-bit/loki.go:150:4
default: kuberneteslbs[model.LabelName(k)] = model.LabelValue(fmt.Sprintf("%v", v)) }pkg/bloombuild/planner/versioned_range.go1
119:4modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:119:4
if bounds.Equal(preExisting) { t[i].version = version return t, trueclients/cmd/fluent-bit/loki_test.go1
25:22nested-structs
clients/cmd/fluent-bit/loki_test.go:25:22
"bar": 500, "error": make(chan struct{}), }integration/cluster/cluster.go1
153:4nil-error-return
integration/cluster/cluster.go:153:4
if errors.As(err, &aErr) { return nil }pkg/analytics/seed.go1
46:3nil-value-with-nil-error
pkg/analytics/seed.go:46:3
} return nil, nil }pkg/logql/bench/bench_test.go1
499:7no-defer-in-loop
pkg/logql/bench/bench_test.go:499:7
ctx, cancel := context.WithTimeout(ctx, time.Minute) defer cancel()pkg/chunkenc/memchunk_test.go1
2423:6no-else-after-return
pkg/chunkenc/memchunk_test.go:2423:6
return -1 } else if a.Timestamp.After(b.Timestamp) { return 1clients/pkg/logentry/stages/template.go1
59:6no-init
clients/pkg/logentry/stages/template.go:59:6
func init() { for k, v := range extraFunctionMap {pkg/compactor/retention/util_test.go1
417:3no-naked-return
pkg/compactor/retention/util_test.go:417:3
m.End = m.Start + millisecondsInDay - 1 return }clients/cmd/docker-driver/loki.go1
19:5no-package-var
clients/cmd/docker-driver/loki.go:19:5
var jobName = "docker"pkg/ruler/storage/wal/wal.go1
571:18non-pointer-sync-pool-value
pkg/ruler/storage/wal/wal.go:571:18
//nolint:staticcheck a.w.bufPool.Put(buf)clients/pkg/logentry/stages/eventlogmessage_test.go1
383:4overwritten-before-use
clients/pkg/logentry/stages/eventlogmessage_test.go:383:4
if len(resultKey) > 1 && len(resultKey[1]) > 0 { val = resultKey[1][1:] }clients/cmd/docker-driver/loki.go1
1:9package-comments
clients/cmd/docker-driver/loki.go:1:9
package mainpkg/dataobj/compaction/v2/calculator.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/calculator.go:1:9
package compactionv2clients/pkg/logentry/stages/geoip.go1
115:37range-value-address
clients/pkg/logentry/stages/geoip.go:115:37
for e := range in { g.process(e.Labels, e.Extracted, &e.Timestamp, &e.Line) out <- epkg/loghttp/query.go1
276:7receiver-naming
pkg/loghttp/query.go:276:7
func (s Streams) ToProto() []logproto.Stream { if len(s) == 0 {pkg/compactor/deletion/request_handler_test.go1
146:48redefines-builtin-id
pkg/compactor/deletion/request_handler_test.go:146:48
for _, tc := range []struct { orgID, query, startTime, endTime, interval, error string }{production/helm/loki/src/helm-test/canary_test.go1
2:1redundant-build-tag
production/helm/loki/src/helm-test/canary_test.go:2:1
//go:build helm_test// +build helm_testclients/pkg/logentry/stages/json_test.go1
66:17redundant-conversion
clients/pkg/logentry/stages/json_test.go:66:17
"nested": "{\"child\":\"value\"}", "duration": float64(125), "unknown": nil,operator/api/loki/v1beta1/lokistack_types_test.go1
10:2redundant-import-alias
operator/api/loki/v1beta1/lokistack_types_test.go:10:2
v1 "github.com/grafana/loki/operator/api/loki/v1" "github.com/grafana/loki/operator/api/loki/v1beta1"operator/internal/handlers/internal/rules/rules_test.go1
536:3single-case-switch
operator/internal/handlers/internal/rules/rules_test.go:536:3
k.ListStub = func(_ context.Context, ol client.ObjectList, opt ...client.ListOption) error { switch ol.(type) { case *lokiv1.AlertingRuleList:pkg/bloomgateway/util_test.go1
102:8slice-preallocation
pkg/bloomgateway/util_test.go:102:8
result := daysForRange(from, through) var collected []string for _, d := range result {integration/client/client.go1
375:30standard-http-method-constant
integration/client/client.go:375:30
req, err := http.NewRequest("POST", apiEndpoint, nil) if err != nil {operator/api/loki/v1/lokistack_types.go1
63:2task-comment
operator/api/loki/v1/lokistack_types.go:63:2
// // FIXME: Add clear description of ingestion/query performance expectations. SizeOneXSmall LokiStackSizeType = "1x.small"clients/cmd/fluent-bit/config.go1
27:1top-level-declaration-order
clients/cmd/fluent-bit/config.go:27:1
type ConfigGetter interface { Get(key string) stringclients/pkg/logentry/logql/parser.go1
25:26unchecked-type-assertion
clients/pkg/logentry/logql/parser.go:25:26
l := lexer{ parser: exprNewParser().(*exprParserImpl), }pkg/lokifrontend/frontend/downstream_roundtripper.go1
66:2unclosed-http-response-body
pkg/lokifrontend/frontend/downstream_roundtripper.go:66:2
httpResp, err := d.transport.RoundTrip(r) if err != nil {pkg/logql/log/pattern/lexer.rl.go1
31unexported-naming
pkg/logql/log/pattern/lexer.rl.go:31
var _pattern_range_lengths []byte = []byte{ 0, 3, 1, 1, 1, 1, 1, 1, clients/pkg/logentry/stages/geoip.go1
109:41unexported-return
clients/pkg/logentry/stages/geoip.go:109:41
// Run implements Stagefunc (g *geoIPStage) Run(in chan Entry) chan Entry { out := make(chan Entry)pkg/storage/stores/shipper/indexshipper/tsdb/index/index.go1
2482:1unreachable-code
pkg/storage/stores/shipper/indexshipper/tsdb/index/index.go:2482:1
iterate: for i := 0; i < chunksRemaining; i++ {pkg/columnar/columnartest/equality.go1
96:49unused-parameter
pkg/columnar/columnartest/equality.go:96:49
func requireNullArraysEqual(t testing.TB, left, right *columnar.Null, mask memory.Bitmap) { // Nothing to do here; the base checks in RequireArraysEqual coversclients/pkg/logentry/stages/decolorize.go1
14:7unused-receiver
clients/pkg/logentry/stages/decolorize.go:14:7
// Run implements Stagefunc (m *decolorizeStage) Run(in chan Entry) chan Entry { decolorizer, _ := log.NewDecolorizer()clients/cmd/docker-driver/config_test.go1
75:14use-any
clients/cmd/docker-driver/config_test.go:75:14
}, map[string]interface{}{ "labels": map[string]interface{}{integration/parse_metrics.go1
16:25use-errors-new
integration/parse_metrics.go:16:25
ErrNoMetricFound = fmt.Errorf("metric not found") ErrInvalidMetricType = fmt.Errorf("invalid metric type"))operator/internal/manifests/storage/schema.go1
43:2use-slices-sort
operator/internal/manifests/storage/schema.go:43:2
sort.SliceStable(sortedSchemas, func(i, j int) bool { iDate, _ := sortedSchemas[i].EffectiveDate.UTCTime()cmd/chunks-inspect/loki.go1
44:2var-naming
cmd/chunks-inspect/loki.go:44:2
enclz4_1M = Encoding{code: 6, name: "lz4-1M", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }} enclz4_4M = Encoding{code: 7, name: "lz4-4M", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }} encFlate = Encoding{code: 8, name: "flate", readerFn: func(reader io.Reader) (io.Reader, error) { return flate.NewReader(reader), nil }}clients/cmd/fluent-bit/config_labels_test.go1
35:61add-constant
clients/cmd/fluent-bit/config_labels_test.go:35:61
labels: `{job="fluent-bit",env="prod"}`, want: flagext.LabelSet{LabelSet: model.LabelSet{"job": "fluent-bit", "env": "prod"}}, },pkg/querier/queryrange/downstreamer_test.go1
619:2call-to-gc
pkg/querier/queryrange/downstreamer_test.go:619:2
// Record baseline goroutine count. runtime.GC() time.Sleep(50 * time.Millisecond)clients/cmd/fluent-bit/dque.go1
88:22cognitive-complexity
clients/cmd/fluent-bit/dque.go:88:22
func (c *dqueClient) dequeuer() { defer c.wg.Done()integration/client/client.go1
181:18confusing-naming
integration/client/client.go:181:18
// pushOTLPLogLine creates a new loglinefunc (c *Client) pushOTLPLogLine(line string, timestamp time.Time, logAttributes map[string]any) error { apiEndpoint := fmt.Sprintf("%s/otlp/v1/logs", c.baseURL)pkg/bloomgateway/multiplexing.go1
98:37confusing-results
pkg/bloomgateway/multiplexing.go:98:37
// see pkg/storage/stores/shipper/indexshipper/tsdb.Boundedfunc (t Task) Bounds() (model.Time, model.Time) { return t.interval.Start, t.interval.Endclients/pkg/util/client.go1
243:6constructor-interface-return
clients/pkg/util/client.go:243:6
// NewWithTripperware creates a new Loki client with a custom tripperware.func NewWithTripperware(metrics *Metrics, cfg Config, maxStreams, maxLineSize int, maxLineSizeTruncate bool, logger log.Logger, tp Tripperware) (Client, error) { c, err := newClient(metrics, cfg, maxStreams, maxLineSize, maxLineSizeTruncate, logger)pkg/pattern/tee_service.go1
427:7context-cancel-in-loop
pkg/pattern/tee_service.go:427:7
) defer cancel()pkg/bloombuild/builder/spec.go1
146:2context-stored-in-struct
pkg/bloombuild/builder/spec.go:146:2
type LazyBlockBuilderIterator struct { ctx context.Context opts v1.BlockOptionsclients/cmd/fluent-bit/loki.go1
221:16cyclomatic-complexity
clients/cmd/fluent-bit/loki.go:221:16
func (l *loki) createLine(records map[string]interface{}, f format) (string, error) { switch f {operator/cmd/loki-broker/main.go1
70:3deep-exit
operator/cmd/loki-broker/main.go:70:3
log.Info("-custom.resource.path flag is required") os.Exit(1) }pkg/ingester/checkpoint_test.go1
38:3deprecated-api-usage
pkg/ingester/checkpoint_test.go:38:3
err := i.Query(&logproto.QueryRequest{ Selector: `{foo="bar"}`, Limit: 100,clients/cmd/docker-driver/driver.go1
132:4discarded-error-result
clients/cmd/docker-driver/driver.go:132:4
if err := os.RemoveAll(lf.folder); err != nil { level.Debug(d.logger).Log("msg", "error deleting folder", "folder", lf.folder) }clients/cmd/fluent-bit/dque.go1
135:1doc-comment-period
clients/cmd/fluent-bit/dque.go:135:1
// Stop the clientfunc (c *dqueClient) StopNow() {clients/pkg/logentry/stages/pack.go1
48:4early-return
clients/pkg/logentry/stages/pack.go:48:4
} else { if s, ok := v.(string); ok { w.Labels[k] = sclients/pkg/logentry/stages/replace_test.go1
260:14error-strings
clients/pkg/logentry/stages/replace_test.go:260:14
if (err != nil) != (tt.err != nil) { t.Errorf("ReplaceConfig.validate() expected error = %v, actual error = %v", tt.err, err) returnpkg/ruler/storage/instance/errors.go1
43:6error-type-naming
pkg/ruler/storage/instance/errors.go:43:6
// is wrapped inside of a ErrInvalidUpdate.type errImmutableField struct{ Field string }pkg/ingester/owned_streams.go1
78:2excessive-blank-identifiers
pkg/ingester/owned_streams.go:78:2
func (s *ownedStreamService) updateFixedLimit() (old, newVal int32) { newLimit, _, _, _ := s.limiter.GetStreamCountLimit(s.tenantID, noPolicy) return s.fixedLimit.Swap(int32(newLimit)), int32(newLimit)clients/cmd/docker-driver/logdriver/io.go1
14:6exported-declaration-comment
clients/cmd/docker-driver/logdriver/io.go:14:6
// The stream format is [uint32 big-endian size][protobuf message].type LogEntryEncoder interface { Encode(*LogEntry) errorintegration/cluster/cluster.go1
1:1file-length-limit
integration/cluster/cluster.go:1:1
package clustercmd/logcli/main.go1
769:21flag-parameter
cmd/logcli/main.go:769:21
func newVolumeQuery(rangeQuery bool, cmd *kingpin.CmdClause) *volume.Query { // calculate query range from cli paramsclients/cmd/fluent-bit/config.go1
1:1format
clients/cmd/fluent-bit/config.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/fluent-bit/config.go`
clients/pkg/logentry/logql/parser_test.go1
47:6function-length
clients/pkg/logentry/logql/parser_test.go:47:6
func TestParse(t *testing.T) { for _, tc := range []struct {pkg/bloombuild/planner/queue/queue.go1
198:17function-result-limit
pkg/bloombuild/planner/queue/queue.go:198:17
// Dequeue takes a task from the queue. The task is not removed from the filesystem until Release is called.func (q *Queue) Dequeue(ctx context.Context, last Index, consumerID string) (*protos.ProtoTask, any, Index, error) { item, idx, err := q.queue.Dequeue(ctx, last, consumerID)pkg/ruler/base/api.go1
559:15get-function-return-value
pkg/ruler/base/api.go:559:15
func (a *API) GetRuleGroup(w http.ResponseWriter, req *http.Request) { logger := util_log.WithContext(req.Context(), a.logger)pkg/scratch/filesystem.go1
90:22identical-if-chain-branches
pkg/scratch/filesystem.go:90:22
return nil } else if d == nil { // Ignore errors (d == nil only if there's an error); process whatclients/pkg/logentry/stages/metrics.go1
331:2identical-switch-branches
clients/pkg/logentry/stages/metrics.go:331:2
return float64(i), nil case int32: return float64(i), nilclients/pkg/logentry/stages/decolorize_test.go1
10:2import-alias-naming
clients/pkg/logentry/stages/decolorize_test.go:10:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/cmd/docker-driver/driver.go1
59:16import-shadowing
clients/cmd/docker-driver/driver.go:59:16
func newDriver(logger log.Logger) *driver { return &driver{pkg/compactor/deletion/job_builder_test.go1
36:3inefficient-map-lookup
pkg/compactor/deletion/job_builder_test.go:36:3
if _, ok := t.updates[tableName][userID]; !ok { t.updates[tableName][userID] = map[string]deletionproto.StorageUpdates{ labels: {pkg/compactor/retention/marker_test.go1
57:35inefficient-sprintf
pkg/compactor/retention/marker_test.go:57:35
for i := 0; i <= 2000; i++ { require.NoError(t, w.Put([]byte(fmt.Sprintf("%d", i)))) }clients/cmd/fluent-bit/config_test.go1
88:22insecure-url-scheme
clients/cmd/fluent-bit/config_test.go:88:22
map[string]string{ "URL": "http://somewhere.com:3100/loki/api/v1/push", "LineFormat": "key_value",pkg/engine/handler.go1
37:13interface-method-limit
pkg/engine/handler.go:37:13
type Limits interface { querier_limits.Limitspkg/engine/internal/proto/ulid/ulid.go1
23:7marshal-receiver
pkg/engine/internal/proto/ulid/ulid.go:23:7
// buffer must be at least [ULID.Size] bytes, otherwise MarshalTo panics.func (id *ULID) MarshalTo(data []byte) (int, error) { pb := ProtoULID{Value: id[:]}cmd/migrate/main.go1
355:7max-control-nesting
cmd/migrate/main.go:355:7
for i, chk := range finalChks { if enc, err := chk.Encoded(); err == nil { totalBytes += uint64(len(enc))pkg/canary/reader/reader.go1
98:6max-parameters
pkg/canary/reader/reader.go:98:6
func NewReader(writer io.Writer, receivedChan chan time.Time,integration/client/client.go1
560:6max-public-structs
integration/client/client.go:560:6
type Rules struct { Name stringclients/cmd/fluent-bit/loki.go1
194:6modifies-parameter
clients/cmd/fluent-bit/loki.go:194:6
if lValue.IsValid() && model.UTF8Validation.IsValidLabelName(string(lName)) { res[lName] = lValue }pkg/bloombuild/planner/versioned_range.go1
128:5modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:128:5
tok := tsdbToken{through: bounds.Max, version: version} t = append(t, tsdbToken{}) copy(t[i+1:], t[i:])clients/cmd/fluent-bit/loki_test.go1
67:13nested-structs
clients/cmd/fluent-bit/loki_test.go:67:13
tests := []struct { name stringpkg/bloombuild/builder/builder.go1
104:4nil-error-return
pkg/bloombuild/builder/builder.go:104:4
level.Error(b.logger).Log("msg", "failed to inject orgID into context", "err", err) return nil }pkg/analytics/stats.go1
198:4nil-value-with-nil-error
pkg/analytics/stats.go:198:4
} return nil, nil },pkg/pattern/tee_service.go1
427:7no-defer-in-loop
pkg/pattern/tee_service.go:427:7
) defer cancel()pkg/compactor/deletion/deletion_manifest_builder.go1
250:5no-else-after-return
pkg/compactor/deletion/deletion_manifest_builder.go:250:5
return -1 } else if len(a.Requests) > len(b.Requests) { return 1cmd/chunks-inspect/loki.go1
32:6no-init
cmd/chunks-inspect/loki.go:32:6
func init() { castagnoliTable = crc32.MakeTable(crc32.Castagnoli)pkg/compactor/table_test.go1
443:2no-naked-return
pkg/compactor/table_test.go:443:2
return}clients/cmd/docker-driver/main.go1
21:5no-package-var
clients/cmd/docker-driver/main.go:21:5
var logLevel dslog.Levelpkg/storage/stores/shipper/indexshipper/tsdb/index/pool.go1
33:13non-pointer-sync-pool-value
pkg/storage/stores/shipper/indexshipper/tsdb/index/pool.go:33:13
//nolint:staticcheck p.pool.Put(xs)}clients/pkg/logentry/stages/eventlogmessage_test.go1
387:4overwritten-before-use
clients/pkg/logentry/stages/eventlogmessage_test.go:387:4
if len(resultKey) > 1 && len(resultKey[1]) > 0 { val = resultKeyValue[1][1:] }clients/cmd/docker-driver/main.go1
1:9package-comments
clients/cmd/docker-driver/main.go:1:9
package mainpkg/dataobj/compaction/v2/calculator_test.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/calculator_test.go:1:9
package compactionv2clients/pkg/logentry/stages/geoip.go1
115:51range-value-address
clients/pkg/logentry/stages/geoip.go:115:51
for e := range in { g.process(e.Labels, e.Extracted, &e.Timestamp, &e.Line) out <- epkg/storage/chunk/cache/snappy.go1
53:7receiver-naming
pkg/storage/chunk/cache/snappy.go:53:7
func (c *snappyCache) GetCacheType() stats.CacheType { return c.next.GetCacheType()pkg/dataobj/internal/dataset/value.go1
60:2redefines-builtin-id
pkg/dataobj/internal/dataset/value.go:60:2
// cap holds the capacity of the underlying memory in data. cap uint64clients/pkg/logentry/stages/metrics.go1
345:11redundant-conversion
clients/pkg/logentry/stages/metrics.go:345:11
if i { return float64(1), nil }operator/api/loki/v1beta1/recordingrule_types.go1
4:2redundant-import-alias
operator/api/loki/v1beta1/recordingrule_types.go:4:2
import ( v1 "github.com/grafana/loki/operator/api/loki/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"operator/internal/manifests/gateway_tenants.go1
108:3single-case-switch
operator/internal/manifests/gateway_tenants.go:108:3
for _, o := range objs { switch o.(type) { // Drop Ingress in favor of Route in OpenShift.pkg/canary/reader/reader.go2
78:7slice-preallocation
pkg/canary/reader/reader.go:78:7
if labels != "" { var lbls []string for _, label := range strings.Split(labels, ",") {234:46standard-http-method-constant
pkg/canary/reader/reader.go:234:46
req, err := http.NewRequestWithContext(ctx, "GET", u.String(), nil) if err != nil {operator/api/loki/v1/lokistack_types.go1
71:2task-comment
operator/api/loki/v1/lokistack_types.go:71:2
// // FIXME: Add clear description of ingestion/query performance expectations. SizeOneXMedium LokiStackSizeType = "1x.medium"clients/cmd/fluent-bit/dque.go1
27:1top-level-declaration-order
clients/cmd/fluent-bit/dque.go:27:1
var defaultDqueConfig = dqueConfig{ queueDir: filepath.Join(os.TempDir(), "flb-storage/loki"),clients/pkg/logentry/metric/counters.go1
92:33unchecked-type-assertion
clients/pkg/logentry/metric/counters.go:92:33
func (c *Counters) With(labels model.LabelSet) prometheus.Counter { return c.metricVec.With(labels).(prometheus.Counter)}pkg/lokifrontend/frontend/transport/handler.go1
131:2unclosed-http-response-body
pkg/lokifrontend/frontend/transport/handler.go:131:2
startTime := time.Now() resp, err := f.roundTripper.RoundTrip(r) queryResponseTime := time.Since(startTime)pkg/logql/log/pattern/lexer.rl.go1
36unexported-naming
pkg/logql/log/pattern/lexer.rl.go:36
var _pattern_index_offsets []byte = []byte{ 0, 0, 6, 8, 10, 12, 14, 16, clients/pkg/logentry/stages/json.go1
95:40unexported-return
clients/pkg/logentry/stages/json.go:95:40
func (j *jsonStage) Run(in chan Entry) chan Entry { out := make(chan Entry)pkg/columnar/columnartest/equality.go1
96:71unused-parameter
pkg/columnar/columnartest/equality.go:96:71
func requireNullArraysEqual(t testing.TB, left, right *columnar.Null, mask memory.Bitmap) { // Nothing to do here; the base checks in RequireArraysEqual coversclients/pkg/logentry/stages/decolorize.go1
33:7unused-receiver
clients/pkg/logentry/stages/decolorize.go:33:7
// Name implements Stagefunc (m *decolorizeStage) Name() string { return StageTypeDecolorizeclients/cmd/docker-driver/config_test.go1
76:25use-any
clients/cmd/docker-driver/config_test.go:76:25
map[string]interface{}{ "labels": map[string]interface{}{ "level": nil,pkg/bloombuild/builder/config.go1
30:10use-errors-new
pkg/bloombuild/builder/config.go:30:10
if cfg.PlannerAddress == "" { return fmt.Errorf("planner address is required") }pkg/bloombuild/planner/strategies/chunksize.go1
156:2use-slices-sort
pkg/bloombuild/planner/strategies/chunksize.go:156:2
// ensure we sort blocks so deduping iterator works as expected sort.Slice(blocks, func(i, j int) bool { return blocks[i].Bounds.Less(blocks[j].Bounds)operator/internal/manifests/rules_config_test.go1
15:2var-naming
operator/internal/manifests/rules_config_test.go:15:2
func TestRulesConfigMap_ReturnsDataEntriesPerRule(t *testing.T) { cm_shards, err := RulesConfigMapShards(testOptions()) require.NoError(t, err)clients/cmd/fluent-bit/config_test.go1
88:22add-constant
clients/cmd/fluent-bit/config_test.go:88:22
map[string]string{ "URL": "http://somewhere.com:3100/loki/api/v1/push", "LineFormat": "key_value",pkg/querier/queryrange/downstreamer_test.go1
650:2call-to-gc
pkg/querier/queryrange/downstreamer_test.go:650:2
// Allow goroutines to settle. runtime.GC() require.Eventually(t, func() bool {clients/cmd/fluent-bit/loki.go1
49:16cognitive-complexity
clients/cmd/fluent-bit/loki.go:49:16
// sendRecord send fluentbit records to loki as an entry.func (l *loki) sendRecord(r map[interface{}]interface{}, ts time.Time) error { records := toStringMap(r)integration/loki_rule_eval_test.go1
40:6confusing-naming
integration/loki_rule_eval_test.go:40:6
// Both the local and the remote rule evaluation modes should produce the same result.func testRuleEval(t *testing.T, mode string, useThanosObjstore bool) { clu := cluster.New(nil, cluster.SchemaWithTSDB, func(c *cluster.Cluster) {pkg/bloomgateway/processor.go1
196:37confusing-results
pkg/bloomgateway/processor.go:196:37
// It assumes an ascending sorted list of fingerprints.func getFirstLast[T any](s []T) (T, T) { var zero Tpkg/bloomgateway/resolver.go1
146:6constructor-interface-return
pkg/bloomgateway/resolver.go:146:6
func NewBlockResolver(store bloomshipper.StoreBase, logger log.Logger) BlockResolver { return &defaultBlockResolver{pkg/querier/worker/processor_manager.go1
71:18context-cancel-in-loop
pkg/querier/worker/processor_manager.go:71:18
workerID := len(pm.cancels) + 1 ctx, cancel := context.WithCancel(pm.ctx) pm.cancels = append(pm.cancels, cancel)pkg/bloombuild/planner/planner_test.go1
661:2context-stored-in-struct
pkg/bloombuild/planner/planner_test.go:661:2
wait atomic.Bool ctx context.Context ctxCancel context.CancelFuncclients/pkg/logentry/metric/counters.go1
31:6cyclomatic-complexity
clients/pkg/logentry/metric/counters.go:31:6
func validateCounterConfig(config *CounterConfig) error { if config.Action == "" {operator/cmd/loki-broker/main.go1
74:3deep-exit
operator/cmd/loki-broker/main.go:74:3
log.Info("-name flag is required") os.Exit(1) }pkg/ingester/client/client.go1
81:15deprecated-api-usage
pkg/ingester/client/client.go:81:15
// nolint:staticcheck // grpc.Dial() has been deprecated; we'll address it before upgrading to gRPC 2. conn, err := grpc.Dial(addr, opts...) if err != nil {clients/cmd/docker-driver/driver.go1
143:5discarded-error-result
clients/cmd/docker-driver/driver.go:143:5
if err == io.EOF || err == os.ErrClosed || strings.Contains(err.Error(), "file already closed") { level.Debug(lf.logger).Log("msg", "shutting down log logger", "id", lf.info.ContainerID, "err", err) returnclients/cmd/fluent-bit/out_grafana_loki.go1
44:1doc-comment-period
clients/cmd/fluent-bit/out_grafana_loki.go:44:1
//export FLBPluginRegisterfunc FLBPluginRegister(ctx unsafe.Pointer) int {cmd/migrate/main.go1
329:9early-return
cmd/migrate/main.go:329:9
onechunk, err = f.FetchChunks(m.ctx, onechunk) if err != nil { if retry == 0 {clients/pkg/logentry/stages/replace_test.go1
264:14error-strings
clients/pkg/logentry/stages/replace_test.go:264:14
if (err != nil) && (err.Error() != tt.err.Error()) { t.Errorf("ReplaceConfig.validate() expected error = %v, actual error = %v", tt.err, err) returnpkg/util/errors/errors.go1
97:6error-type-naming
pkg/util/errors/errors.go:97:6
// grouped by the error message.type GroupedErrors struct { MultiErrorpkg/ingester/replay_controller.go1
84:2excessive-blank-identifiers
pkg/ingester/replay_controller.go:84:2
// Use singleflight to ensure only one flush happens at a time _, _, _ = c.flushSF.Do("flush", func() (interface{}, error) { c.flush()clients/cmd/docker-driver/logdriver/io.go1
31:27exported-declaration-comment
clients/cmd/docker-driver/logdriver/io.go:31:27
func (e *logEntryEncoder) Encode(l *LogEntry) error { payload, err := proto.Marshal(l)integration/loki_micro_services_test.go1
1:1file-length-limit
integration/loki_micro_services_test.go:1:1
//go:build integrationintegration/cluster/cluster.go1
244:24flag-parameter
integration/cluster/cluster.go:244:24
func (c *Cluster) stop(cleanupFiles bool) error { _, cancelFunc := context.WithTimeout(context.Background(), time.Second*3)clients/cmd/fluent-bit/config_labels_test.go1
1:1format
clients/cmd/fluent-bit/config_labels_test.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/fluent-bit/config_labels_test.go`
clients/pkg/logentry/stages/drop.go1
164:21function-length
clients/pkg/logentry/stages/drop.go:164:21
func (m *dropStage) shouldDrop(e Entry) bool { // There are many options for dropping a log and if multiple are defined it's treated like an AND conditionpkg/bloombuild/planner/retention_test.go1
659:6function-result-limit
pkg/bloombuild/planner/retention_test.go:659:6
func NewMockBloomStore(t *testing.T, logger log.Logger) (*bloomshipper.BloomStore, storageconfig.SchemaConfig, string, error) { workDir := t.TempDir()clients/pkg/logentry/stages/metrics.go1
333:2identical-switch-branches
clients/pkg/logentry/stages/metrics.go:333:2
return float64(i), nil case int: return float64(i), nilclients/pkg/logentry/stages/drop_test.go1
15:2import-alias-naming
clients/pkg/logentry/stages/drop_test.go:15:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/cmd/docker-driver/loki.go1
25:2import-shadowing
clients/cmd/docker-driver/loki.go:25:2
labels model.LabelSet logger log.Loggerpkg/compactor/jobqueue/queue.go1
225:4inefficient-map-lookup
pkg/compactor/jobqueue/queue.go:225:4
if _, ok := q.processingJobs[job.Id]; !ok { q.processingJobs[job.Id] = &processingJob{ job: job,pkg/compactor/retention/marker_test.go1
143:40inefficient-sprintf
pkg/compactor/retention/marker_test.go:143:40
{"happy path", func(dir string) ([]string, []time.Time) { _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.UnixNano()))) _, _ = os.Create(filepath.Join(dir, "foo"))clients/cmd/fluent-bit/config_test.go1
106:35insecure-url-scheme
clients/cmd/fluent-bit/config_test.go:106:35
clientConfig: util.Config{ URL: mustParseURL("http://somewhere.com:3100/loki/api/v1/push"), TenantID: "", // empty as not set in fluent-bit plugin config mappkg/indexgateway/gateway.go1
40:19interface-method-limit
pkg/indexgateway/gateway.go:40:19
type IndexQuerier interface { stores.ChunkFetcherpkg/engine/internal/proto/ulid/ulid.go1
29:7marshal-receiver
pkg/engine/internal/proto/ulid/ulid.go:29:7
// Unmarshal unmarshals a [ProtoULID] from the given data slice.func (id *ULID) Unmarshal(data []byte) error { pb := ProtoULID{}cmd/migrate/main.go1
362:7max-control-nesting
cmd/migrate/main.go:362:7
} if m.sourceUser != m.destUser { // Because the incoming chunks are already encoded, to change the username we have to make a new chunkpkg/canary/writer/push.go1
67:6max-parameters
pkg/canary/writer/push.go:67:6
// instance which sends log lines to Loki in batches.func NewPush( lokiAddr, tenantID string,integration/client/client.go1
566:6max-public-structs
integration/client/client.go:566:6
type Header struct { Name, Value stringclients/cmd/fluent-bit/loki.go1
233:5modifies-parameter
clients/cmd/fluent-bit/loki.go:233:5
} records[k] = data }pkg/bloombuild/planner/versioned_range.go1
130:5modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:130:5
copy(t[i+1:], t[i:]) t[i] = tok return t, trueclients/cmd/fluent-bit/loki_test.go1
110:13nested-structs
clients/cmd/fluent-bit/loki_test.go:110:13
func Test_createLine(t *testing.T) { tests := []struct { name stringpkg/bloombuild/builder/builder.go1
156:4nil-error-return
pkg/bloombuild/builder/builder.go:156:4
// Edge case when the builder is shutting down while we check for retries return nil }pkg/analytics/stats.go1
218:4nil-value-with-nil-error
pkg/analytics/stats.go:218:4
} return nil, nil },pkg/querytee/proxy_test.go1
162:5no-defer-in-loop
pkg/querytee/proxy_test.go:162:5
s := httptest.NewServer(b.handler) defer s.Close()pkg/compactor/deletion/deletion_manifest_builder.go1
360:4no-else-after-return
pkg/compactor/deletion/deletion_manifest_builder.go:360:4
return true, nil } else if objectClient.IsObjectNotFoundErr(err) { return false, niloperator/api/config/v1/projectconfig_types.go1
227:6no-init
operator/api/config/v1/projectconfig_types.go:227:6
func init() { SchemeBuilder.Register(&ProjectConfig{})pkg/dataobj/decoder_metadata.go1
28:2no-naked-return
pkg/dataobj/decoder_metadata.go:28:2
} return}clients/cmd/fluent-bit/buffer.go1
17:5no-package-var
clients/cmd/fluent-bit/buffer.go:17:5
var defaultBufferConfig = bufferConfig{ buffer: false,pkg/storage/stores/shipper/indexshipper/tsdb/index/postings.go1
245:30non-pointer-sync-pool-value
pkg/storage/stores/shipper/indexshipper/tsdb/index/postings.go:245:30
job = job[:0] ensureOrderBatchPool.Put(job) //nolint:staticcheck // Ignore SA6002 safe to ignore and actually fixing it has some performance penalty. }pkg/compute/equality_bench_test.go1
39:5overwritten-before-use
pkg/compute/equality_bench_test.go:39:5
benchAlloc.Reclaim() result, err := compute.Equals(benchAlloc, left, right, selection) if err != nil {clients/cmd/fluent-bit/buffer.go1
1:9package-comments
clients/cmd/fluent-bit/buffer.go:1:9
package mainpkg/dataobj/compaction/v2/doc.go1
5:9package-directory-mismatch
pkg/dataobj/compaction/v2/doc.go:5:9
// batches P runs into ceil(P/K) tasks that each produce one output sequence.package compactionv2clients/pkg/logentry/stages/geoip_test.go1
47:30range-value-address
clients/pkg/logentry/stages/geoip_test.go:47:30
for _, tt := range tests { err := validateGeoIPConfig(&tt.config) if err != nil {pkg/dataobj/internal/util/bitmask/bitmask.go1
7:2redefines-builtin-id
pkg/dataobj/internal/util/bitmask/bitmask.go:7:2
type Mask struct { len int b []uint64clients/pkg/logentry/stages/metrics.go1
347:10redundant-conversion
clients/pkg/logentry/stages/metrics.go:347:10
} return float64(0), nil default:operator/api/loki/v1beta1/recordingrule_types_test.go1
6:2redundant-import-alias
operator/api/loki/v1beta1/recordingrule_types_test.go:6:2
v1 "github.com/grafana/loki/operator/api/loki/v1" "github.com/grafana/loki/operator/api/loki/v1beta1"operator/internal/manifests/gateway_tenants.go1
146:4single-case-switch
operator/internal/manifests/gateway_tenants.go:146:4
for _, o := range objs { switch sa := o.(type) { case *corev1.ServiceAccount:pkg/chunkenc/memchunk_test.go1
1449:10slice-preallocation
pkg/chunkenc/memchunk_test.go:1449:10
} var iters []iter.EntryIterator for _, lbs := range labelsSet {pkg/canary/reader/reader.go1
328:46standard-http-method-constant
pkg/canary/reader/reader.go:328:46
req, err := http.NewRequestWithContext(ctx, "GET", u.String(), nil) if err != nil {operator/api/loki/v1beta1/lokistack_types.go1
39:2task-comment
operator/api/loki/v1beta1/lokistack_types.go:39:2
// // FIXME: Add clear description of ingestion/query performance expectations. SizeOneXExtraSmall LokiStackSizeType = "1x.extra-small"clients/cmd/fluent-bit/out_grafana_loki.go1
36:1top-level-declaration-order
clients/cmd/fluent-bit/out_grafana_loki.go:36:1
type pluginConfig struct { ctx unsafe.Pointerclients/pkg/logentry/metric/gauges.go1
85:33unchecked-type-assertion
clients/pkg/logentry/metric/gauges.go:85:33
func (g *Gauges) With(labels model.LabelSet) prometheus.Gauge { return g.metricVec.With(labels).(prometheus.Gauge)}tools/querycomparator/compare.go1
220:2unclosed-http-response-body
tools/querycomparator/compare.go:220:2
resp, err := http.DefaultClient.Do(req) if err != nil {pkg/logql/log/pattern/lexer.rl.go1
41unexported-naming
pkg/logql/log/pattern/lexer.rl.go:41
var _pattern_indicies []byte = []byte{ 2, 1, 1, 1, 1, 0, 3, 4, clients/pkg/logentry/stages/limit.go1
95:41unexported-return
clients/pkg/logentry/stages/limit.go:95:41
func (m *limitStage) Run(in chan Entry) chan Entry { out := make(chan Entry)pkg/storage/chunk/dummy.go1
20:28unused-parameter
pkg/storage/chunk/dummy.go:20:28
func (chk *dummyChunk) Add(sample model.SamplePair) (Data, error) { return nil, nilclients/pkg/logentry/stages/drop.go1
266:7unused-receiver
clients/pkg/logentry/stages/drop.go:266:7
// Name implements Stagefunc (m *dropStage) Name() string { return StageTypeDropclients/cmd/fluent-bit/config.go1
52:34use-any
clients/cmd/fluent-bit/config.go:52:34
dropSingleKey bool labelMap map[string]interface{}}pkg/bloombuild/planner/queue/config.go1
27:10use-errors-new
pkg/bloombuild/planner/queue/config.go:27:10
if cfg.StoreTasksOnDisk && cfg.TasksDiskDirectory == "" { return fmt.Errorf("tasks_disk_directory must be set when store_tasks_on_disk is true") }pkg/bloombuild/planner/versioned_range.go1
219:2use-slices-sort
pkg/bloombuild/planner/versioned_range.go:219:2
// for outdated metas (older metas are discarded if they don't change the range). sort.Slice(metas, func(i, j int) bool { a, aExists := metas[i].MostRecentSource()operator/internal/manifests/rules_config_test.go1
30:2var-naming
operator/internal/manifests/rules_config_test.go:30:2
opts := testOptions() cm_shards, err := RulesConfigMapShards(opts) require.NoError(t, err)clients/cmd/fluent-bit/config_test.go1
90:22add-constant
clients/cmd/fluent-bit/config_test.go:90:22
"LineFormat": "key_value", "LogLevel": "warn", "Labels": `{app="foo"}`,pkg/querier/queryrange/split_by_interval_test.go1
1923:2call-to-gc
pkg/querier/queryrange/split_by_interval_test.go:1923:2
} runtime.GC() endingGoroutines := runtime.NumGoroutine()clients/cmd/fluent-bit/loki.go1
134:6cognitive-complexity
clients/cmd/fluent-bit/loki.go:134:6
func autoLabels(records map[string]interface{}, kuberneteslbs model.LabelSet) error { kube, ok := records["kubernetes"]operator/internal/manifests/storage/configure.go1
80:6confusing-naming
operator/internal/manifests/storage/configure.go:80:6
// With this, the deployment will expose credentials specific environment variables.func configureDeployment(d *appsv1.Deployment, opts Options) error { p := ensureObjectStoreCredentials(&d.Spec.Template.Spec, opts)pkg/bloomgateway/util.go1
135:106confusing-results
pkg/bloomgateway/util.go:135:106
func overlappingChunks(from, through, minTs, maxTs model.Time, chunks []*logproto.ShortRef) (model.Time, model.Time, []*logproto.ShortRef) {pkg/chunkenc/dumb_chunk.go1
21:6constructor-interface-return
pkg/chunkenc/dumb_chunk.go:21:6
// NewDumbChunk returns a new chunk that isn't very good.func NewDumbChunk() Chunk { return &dumbChunk{}pkg/bloombuild/planner/task.go1
18:2context-stored-in-struct
pkg/bloombuild/planner/task.go:18:2
queueTime time.Time ctx context.Context}clients/pkg/logentry/stages/drop.go1
50:6cyclomatic-complexity
clients/pkg/logentry/stages/drop.go:50:6
// validateDropConfig validates the DropConfig for the dropStagefunc validateDropConfig(cfg *DropConfig) error { if cfg == nil ||operator/cmd/loki-broker/main.go1
78:3deep-exit
operator/cmd/loki-broker/main.go:78:3
log.Info("-namespace flag is required") os.Exit(1) }pkg/ingester/ingester.go1
1076:42deprecated-api-usage
pkg/ingester/ingester.go:1076:42
if req.Plan == nil { parsed, err := syntax.ParseLogSelector(req.Selector, true) if err != nil {clients/cmd/docker-driver/driver.go1
164:4discarded-error-result
clients/cmd/docker-driver/driver.go:164:4
if err := lf.lokil.Log(&msg); err != nil { level.Error(lf.logger).Log("msg", "error pushing message to loki", "id", lf.info.ContainerID, "err", err, "message", msg) }clients/cmd/fluent-bit/out_grafana_loki.go1
52:1doc-comment-period
clients/cmd/fluent-bit/out_grafana_loki.go:52:1
////export FLBPluginInitfunc FLBPluginInit(ctx unsafe.Pointer) int {cmd/migrate/main.go1
355:7early-return
cmd/migrate/main.go:355:7
for i, chk := range finalChks { if enc, err := chk.Encoded(); err == nil { totalBytes += uint64(len(enc))clients/pkg/logentry/stages/stage.go1
222:29error-strings
clients/pkg/logentry/stages/stage.go:222:29
if !ok { return nil, errors.Errorf("Unknown stage type: %s", stageType) }pkg/util/server/error_test.go1
30:6error-type-naming
pkg/util/server/error_test.go:30:6
// keeps working.type grpcStatusWrappedErr struct { code codes.Codepkg/limits/store_bench_test.go1
65:5excessive-blank-identifiers
pkg/limits/store_bench_test.go:65:5
_, _, _, err := s.UpdateCond(tenant, metadata, updateTime) require.NoError(b, err)clients/cmd/docker-driver/logdriver/io.go1
66:27exported-declaration-comment
clients/cmd/docker-driver/logdriver/io.go:66:27
func (d *logEntryDecoder) Decode(l *LogEntry) error { if _, err := io.ReadFull(d.r, d.lenBuf); err != nil {operator/api/loki/v1/lokistack_types.go1
1:1file-length-limit
operator/api/loki/v1/lokistack_types.go:1:1
package v1operator/internal/handlers/internal/gateway/gateway.go1
97:28flag-parameter
operator/internal/handlers/internal/gateway/gateway.go:97:28
func validatePassthroughCA(httpEncryption bool, stack *lokiv1.LokiStack) *status.DegradedError { if !httpEncryption {clients/cmd/fluent-bit/config_test.go1
1:1format
clients/cmd/fluent-bit/config_test.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/fluent-bit/config_test.go`
clients/pkg/logentry/stages/drop_test.go1
41:6function-length
clients/pkg/logentry/stages/drop_test.go:41:6
func Test_dropStage_Process(t *testing.T) { // Enable debug loggingpkg/bloombuild/planner/retention_test.go1
664:6function-result-limit
pkg/bloombuild/planner/retention_test.go:664:6
func NewMockBloomStoreWithWorkDir(t *testing.T, workDir string, logger log.Logger) (*bloomshipper.BloomStore, storageconfig.SchemaConfig, string, error) { schemaCfg := storageconfig.SchemaConfig{clients/pkg/logentry/stages/metrics.go1
335:2identical-switch-branches
clients/pkg/logentry/stages/metrics.go:335:2
return float64(i), nil case uint64: return float64(i), nilclients/pkg/logentry/stages/eventlogmessage_test.go1
14:2import-alias-naming
clients/pkg/logentry/stages/eventlogmessage_test.go:14:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/cmd/docker-driver/loki.go1
34:30import-shadowing
clients/cmd/docker-driver/loki.go:34:30
// New create a new Loki logger that forward logs to Loki instancefunc New(logCtx logger.Info, logger log.Logger) (logger.Logger, error) { logger = log.With(logger, "container_id", logCtx.ContainerID)pkg/compactor/retention/util_test.go1
216:3inefficient-map-lookup
pkg/compactor/retention/util_test.go:216:3
if _, ok := t.chunks[chk.UserID]; !ok { t.chunks[chk.UserID] = make(map[string][]logproto.ChunkRef) }pkg/compactor/retention/marker_test.go1
145:40inefficient-sprintf
pkg/compactor/retention/marker_test.go:145:40
_, _ = os.Create(filepath.Join(dir, "foo")) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-30*time.Minute).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-1*time.Hour).UnixNano())))cmd/logcli/main.go1
577:87insecure-url-scheme
cmd/logcli/main.go:577:87
app.Flag("addr", "Server address. Can also be set using LOKI_ADDR env var.").Default("http://localhost:3100").Envar("LOKI_ADDR").Action(addressAction).StringVar(&client.Address) app.Flag("username", "Username for HTTP basic auth. Can also be set using LOKI_USERNAME env var.").Default("").Envar("LOKI_USERNAME").StringVar(&client.Username)pkg/ingester/ingester.go1
215:12interface-method-limit
pkg/ingester/ingester.go:215:12
// Store is the store interface we need on the ingester.type Store interface { stores.ChunkWriterpkg/engine/internal/proto/ulid/ulid.go1
57:7marshal-receiver
pkg/engine/internal/proto/ulid/ulid.go:57:7
// UnmarshalJSON unmarshals a JSON string into a ULID.func (id *ULID) UnmarshalJSON(data []byte) error { var text stringcmd/migrate/main.go1
366:8max-control-nesting
cmd/migrate/main.go:366:8
err := nc.Encode() if err != nil { log.Println(threadID, "Failed to encode new chunk with new user:", err)pkg/dataobj/consumer/service.go1
54:6max-parameters
pkg/dataobj/consumer/service.go:54:6
func New(kafkaCfg kafka.Config, cfg Config, mCfg metastore.Config, bucket objstore.Bucket, scratchStore scratch.Store, _ string, _ ring.PartitionRingReader, reg prometheus.Registerer, logger log.Logger, overrides logsobj.TenantOverrides) (*Service, error) { logger = log.With(logger, "component", "dataobj-consumer")integration/client/client.go1
797:6max-public-structs
integration/client/client.go:797:6
type TailResult struct { Response loghttp.TailResponseclients/pkg/logentry/logql/parser.go1
82:3modifies-parameter
clients/pkg/logentry/logql/parser.go:82:3
var err error lval.str, err = strconv.Unquote(l.TokenText()) if err != nil {pkg/bloombuild/planner/versioned_range.go1
135:5modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:135:5
if bounds.Max == preExisting.Max { t[i].through = bounds.Min - 1 tok := tsdbToken{through: bounds.Max, version: version}clients/cmd/fluent-bit/loki_test.go1
174:13nested-structs
clients/cmd/fluent-bit/loki_test.go:174:13
func Test_removeKeys(t *testing.T) { tests := []struct { name stringpkg/compactor/deletion/delete_requests_store_boltdb.go1
365:3nil-error-return
pkg/compactor/deletion/delete_requests_store_boltdb.go:365:3
if err != nil { return deletionproto.DeleteRequest{}, nil }pkg/analytics/stats.go1
238:4nil-value-with-nil-error
pkg/analytics/stats.go:238:4
} return nil, nil },pkg/querytee/proxy_test.go1
319:5no-defer-in-loop
pkg/querytee/proxy_test.go:319:5
s := httptest.NewServer(router) defer s.Close()pkg/compactor/deletion/job_builder_test.go1
547:7no-else-after-return
pkg/compactor/deletion/job_builder_test.go:547:7
return -1 } else if len(a.RequestID) > len(b.RequestID) { return 1operator/api/loki/v1/alertingrule_types.go1
133:6no-init
operator/api/loki/v1/alertingrule_types.go:133:6
func init() { SchemeBuilder.Register(&AlertingRule{}, &AlertingRuleList{})pkg/dataobj/explorer/inspect.go1
52:2no-naked-return
pkg/dataobj/explorer/inspect.go:52:2
} return}clients/cmd/fluent-bit/config.go1
20:5no-package-var
clients/cmd/fluent-bit/config.go:20:5
var defaultClientCfg = util.Config{}pkg/storage/stores/shipper/indexshipper/tsdb/pool.go1
30:13non-pointer-sync-pool-value
pkg/storage/stores/shipper/indexshipper/tsdb/pool.go:30:13
//nolint:staticcheck p.pool.Put(xs)}pkg/compute/equality_bench_test.go1
62:5overwritten-before-use
pkg/compute/equality_bench_test.go:62:5
benchAlloc.Reclaim() result, err := compute.Equals(benchAlloc, left, right, selection) if err != nil {clients/cmd/fluent-bit/client.go1
1:9package-comments
clients/cmd/fluent-bit/client.go:1:9
package mainpkg/dataobj/compaction/v2/output_naming.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/output_naming.go:1:9
package compactionv2clients/pkg/logentry/stages/json.go1
100:39range-value-address
clients/pkg/logentry/stages/json.go:100:39
for e := range in { err := j.processEntry(e.Extracted, &e.Line) if err != nil && j.cfg.DropMalformed {pkg/dataobj/sections/logs/row_predicate_order_test.go1
402:2redefines-builtin-id
pkg/dataobj/sections/logs/row_predicate_order_test.go:402:2
size int min int64 max int64clients/pkg/logentry/stages/multiline_test.go1
83:19redundant-conversion
clients/pkg/logentry/stages/multiline_test.go:83:19
require.Equal(t, "START line 1\nnot a start line 1\nnot a start line 2", out[0].Line) require.Equal(t, model.LabelValue("one"), out[0].Labels["value"])operator/api/loki/v1beta1/rulerconfig_types.go1
4:2redundant-import-alias
operator/api/loki/v1beta1/rulerconfig_types.go:4:2
import ( v1 "github.com/grafana/loki/operator/api/loki/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"operator/internal/manifests/gateway_test.go1
1592:5single-case-switch
operator/internal/manifests/gateway_test.go:1592:5
for _, obj := range objs { switch obj.(type) { case *networkingv1.Ingress:pkg/chunkenc/memchunk_test.go1
1488:10slice-preallocation
pkg/chunkenc/memchunk_test.go:1488:10
} var iters []iter.SampleIterator for _, lbs := range labelsSet {pkg/canary/writer/push.go1
267:46standard-http-method-constant
pkg/canary/writer/push.go:267:46
defer cancel() req, err := http.NewRequestWithContext(ctx, "POST", p.lokiURL, bytes.NewReader(payload)) if err != nil {operator/api/loki/v1beta1/lokistack_types.go1
47:2task-comment
operator/api/loki/v1beta1/lokistack_types.go:47:2
// // FIXME: Add clear description of ingestion/query performance expectations. SizeOneXSmall LokiStackSizeType = "1x.small"clients/pkg/logentry/logql/ast.go1
32:1top-level-declaration-order
clients/pkg/logentry/logql/ast.go:32:1
type filterExpr struct { left Exprclients/pkg/logentry/metric/histograms.go1
62:33unchecked-type-assertion
clients/pkg/logentry/metric/histograms.go:62:33
func (h *Histograms) With(labels model.LabelSet) prometheus.Histogram { return h.metricVec.With(labels).(prometheus.Histogram)}pkg/logql/log/pattern/lexer.rl.go1
49unexported-naming
pkg/logql/log/pattern/lexer.rl.go:49
var _pattern_trans_targs []byte = []byte{ 9, 1, 9, 9, 0, 2, 4, 10, clients/pkg/logentry/stages/match.go1
143:43unexported-return
clients/pkg/logentry/stages/match.go:143:43
func (m *matcherStage) Run(in chan Entry) chan Entry { switch m.action {pkg/storage/factory.go1
351:111unused-parameter
pkg/storage/factory.go:351:111
// NewChunkClient makes a new chunk.Client of the desired types.func NewChunkClient(name, component string, cfg Config, schemaCfg config.SchemaConfig, p config.PeriodConfig, registerer prometheus.Registerer, clientMetrics ClientMetrics, logger log.Logger) (client.Client, error) { var cc congestion.Controllerclients/pkg/logentry/stages/eventlogmessage.go1
141:7unused-receiver
clients/pkg/logentry/stages/eventlogmessage.go:141:7
func (m *eventLogMessageStage) Name() string { return StageTypeEventLogMessageclients/cmd/fluent-bit/config_test.go1
118:26use-any
clients/cmd/fluent-bit/config_test.go:118:26
dropSingleKey: false, labelMap: map[string]interface{}{ "kubernetes": map[string]interface{}{pkg/canary/reader/reader.go1
287:14use-errors-new
pkg/canary/reader/reader.go:287:14
if len(series) == 0 { return 0, fmt.Errorf("expected to receive one sample in the result vector, received 0") }pkg/bloombuild/planner/versioned_range.go1
266:2use-slices-sort
pkg/bloombuild/planner/versioned_range.go:266:2
// We need to re-sort them by their FP to match the original order. sort.Slice(upToDate, func(i, j int) bool { return upToDate[i].Bounds.Less(upToDate[j].Bounds)operator/internal/manifests/rules_config_test.go1
43:2var-naming
operator/internal/manifests/rules_config_test.go:43:2
func TestRulesConfigMapSharding(t *testing.T) { cm_shards, err := RulesConfigMapShards(testOptions_withSharding()) require.NoError(t, err)clients/cmd/fluent-bit/config_test.go1
94:22add-constant
clients/cmd/fluent-bit/config_test.go:94:22
"BatchWait": "30s", "Timeout": "1s", "RemoveKeys": "buzz,fuzz",pkg/storage/detected/fields_test.go1
93:3call-to-gc
pkg/storage/detected/fields_test.go:93:3
t.Run("huge limit doesn't explode the heap", func(t *testing.T) { runtime.GC() var before runtime.MemStatsclients/cmd/fluent-bit/loki.go1
157:6cognitive-complexity
clients/cmd/fluent-bit/loki.go:157:6
func extractLabels(records map[string]interface{}, keys []string) model.LabelSet { res := model.LabelSet{}operator/internal/manifests/storage/configure.go1
112:6confusing-naming
operator/internal/manifests/storage/configure.go:112:6
// With this, the statefulset will expose credentials specific environment variable.func configureStatefulSet(s *appsv1.StatefulSet, opts Options) error { p := ensureObjectStoreCredentials(&s.Spec.Template.Spec, opts)pkg/chunkenc/dumb_chunk.go1
29:42confusing-results
pkg/chunkenc/dumb_chunk.go:29:42
func (c *dumbChunk) Bounds() (time.Time, time.Time) { if len(c.entries) == 0 {pkg/compactor/client/grpc.go1
42:6constructor-interface-return
pkg/compactor/client/grpc.go:42:6
// loading delete requests, cache gen numbers for query time filtering and interacting with job queue for horizontal scaling of compactor.func NewGRPCClient(addr string, cfg GRPCConfig, r prometheus.Registerer) (CompactorClient, error) { client := &compactorGRPCClient{pkg/bloomgateway/multiplexing.go1
68:2context-stored-in-struct
pkg/bloomgateway/multiplexing.go:68:2
// the context from the request ctx context.Contextclients/pkg/logentry/stages/drop.go1
164:21cyclomatic-complexity
clients/pkg/logentry/stages/drop.go:164:21
func (m *dropStage) shouldDrop(e Entry) bool { // There are many options for dropping a log and if multiple are defined it's treated like an AND conditionoperator/cmd/loki-broker/main.go1
83:3deep-exit
operator/cmd/loki-broker/main.go:83:3
log.Info("-object-storage.s3.endpoint flag is required") os.Exit(1) }pkg/ingester/ingester.go1
1106:4deprecated-api-usage
pkg/ingester/ingester.go:1106:4
storeReq := logql.SelectLogParams{QueryRequest: &logproto.QueryRequest{ Selector: req.Selector, Direction: req.Direction,clients/cmd/docker-driver/driver.go1
168:5discarded-error-result
clients/cmd/docker-driver/driver.go:168:5
if err := lf.jsonl.Log(&msg); err != nil { level.Error(lf.logger).Log("msg", "error writing log message", "id", lf.info.ContainerID, "err", err, "message", msg) continueclients/cmd/fluent-bit/out_grafana_loki.go1
107:1doc-comment-period
clients/cmd/fluent-bit/out_grafana_loki.go:107:1
//export FLBPluginFlushCtxfunc FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, _ *C.char) int {cmd/migrate/main.go1
379:7early-return
cmd/migrate/main.go:379:7
err = m.dest.Put(m.ctx, output) if err != nil { if retry == 0 {clients/pkg/logentry/stages/util_test.go1
75:12error-strings
clients/pkg/logentry/stages/util_test.go:75:12
if err != nil { t.Errorf("Failed to get string from float... this shouldn't have happened: %v", err) returnpkg/validation/validate.go1
85:6error-type-naming
pkg/validation/validate.go:85:6
type ErrStreamRateLimit struct { RateLimit flagext.ByteSizepkg/limits/store_bench_test.go1
85:5excessive-blank-identifiers
pkg/limits/store_bench_test.go:85:5
_, _, _, err := s.UpdateCond(tenant, metadata, updateTime) require.NoError(b, err)clients/cmd/fluent-bit/config.go1
27:6exported-declaration-comment
clients/cmd/fluent-bit/config.go:27:6
type ConfigGetter interface { Get(key string) stringoperator/api/loki/v1/rulerconfig_types.go1
1:1file-length-limit
operator/api/loki/v1/rulerconfig_types.go:1:1
package v1operator/internal/manifests/internal/sizes.go1
303:65flag-parameter
operator/internal/manifests/internal/sizes.go:303:65
// ResourceRequirementsForSize returns the resource configuration for a specific LokiStack size.func ResourceRequirementsForSize(size lokiv1.LokiStackSizeType, useRequestsAsLimits bool) ComponentResources { resources := resourceRequirementsTable[size].DeepCopy()clients/cmd/fluent-bit/dque.go1
1:1format
clients/cmd/fluent-bit/dque.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/fluent-bit/dque.go`
clients/pkg/logentry/stages/eventlogmessage_test.go1
46:6function-length
clients/pkg/logentry/stages/eventlogmessage_test.go:46:6
func TestEventLogMessage_simple(t *testing.T) { t.Parallel()pkg/bloomgateway/util_test.go1
470:6function-result-limit
pkg/bloomgateway/util_test.go:470:6
func createBlocks(t *testing.T, tenant string, n int, from, through model.Time, minFp, maxFp model.Fingerprint) ([]bloomshipper.BlockRef, []bloomshipper.Meta, []*v1.Block, [][]v1.SeriesWithBlooms) { t.Helper()clients/pkg/logentry/stages/metrics.go1
337:2identical-switch-branches
clients/pkg/logentry/stages/metrics.go:337:2
return float64(i), nil case uint32: return float64(i), nilclients/pkg/logentry/stages/extensions_test.go1
12:2import-alias-naming
clients/pkg/logentry/stages/extensions_test.go:12:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/pkg/logentry/stages/stage.go1
52:67import-shadowing
clients/pkg/logentry/stages/stage.go:52:67
type Processor interface { Process(labels model.LabelSet, extracted map[string]interface{}, time *time.Time, entry *string) Name() stringpkg/compactor/retention/util_test.go1
220:3inefficient-map-lookup
pkg/compactor/retention/util_test.go:220:3
if _, ok := t.chunks[chk.UserID][seriesID]; !ok { t.chunks[chk.UserID][seriesID] = []logproto.ChunkRef{} }pkg/compactor/retention/marker_test.go1
146:40inefficient-sprintf
pkg/compactor/retention/marker_test.go:146:40
_, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-30*time.Minute).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-1*time.Hour).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-3*time.Hour).UnixNano())))cmd/loki/health.go1
13:21insecure-url-scheme
cmd/loki/health.go:13:21
healthFlag = "health" defaultHealthURL = "http://localhost:3100/ready" healthTimeout = 5 * time.Secondpkg/ingester/ingester.go1
225:16interface-method-limit
pkg/ingester/ingester.go:225:16
// Interface is an interface for the Ingestertype Interface interface { services.Servicepkg/loghttp/push/otlplabels/config.go1
160:7marshal-receiver
pkg/loghttp/push/otlplabels/config.go:160:7
func (c AttributesConfig) MarshalJSON() ([]byte, error) { aux := getMarshableAttributesConfig(c)cmd/migrate/main.go1
379:7max-control-nesting
cmd/migrate/main.go:379:7
err = m.dest.Put(m.ctx, output) if err != nil { if retry == 0 {pkg/dataobj/index/indexobj/builder.go1
159:19max-parameters
pkg/dataobj/index/indexobj/builder.go:159:19
// AppendStat records a per-sort-key aggregate for a data object section.func (b *Builder) AppendStat(tenantID, objectPath string, sectionIdx int64, sortSchema string, labels map[string]string, minTs, maxTs time.Time, rows int, uncompressedSize int64) error {operator/api/config/v1/projectconfig_types.go1
184:6max-public-structs
operator/api/config/v1/projectconfig_types.go:184:6
// ControllerHealth defines the health configs.type ControllerHealth struct { // HealthProbeBindAddress is the TCP address that the controller should bind toclients/pkg/logentry/logql/parser.go1
99:2modifies-parameter
clients/pkg/logentry/logql/parser.go:99:2
lval.str = l.TokenText() return IDENTIFIERpkg/bloombuild/planner/versioned_range.go1
137:5modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:137:5
tok := tsdbToken{through: bounds.Max, version: version} t = append(t, tsdbToken{}) copy(t[i+2:], t[i+1:])clients/cmd/fluent-bit/loki_test.go1
196:13nested-structs
clients/cmd/fluent-bit/loki_test.go:196:13
func Test_extractLabels(t *testing.T) { tests := []struct { name stringpkg/compactor/deletion/deletion_manifest_builder.go1
361:3nil-error-return
pkg/compactor/deletion/deletion_manifest_builder.go:361:3
} else if objectClient.IsObjectNotFoundErr(err) { return false, nil }pkg/analytics/stats.go1
289:4nil-value-with-nil-error
pkg/analytics/stats.go:289:4
} return nil, nil },pkg/querytee/proxy_test.go1
349:5no-defer-in-loop
pkg/querytee/proxy_test.go:349:5
defer res.Body.Close() body, err := io.ReadAll(res.Body)pkg/compactor/index_set.go1
387:5no-else-after-return
pkg/compactor/index_set.go:387:5
return nil } else { return erroperator/api/loki/v1/lokistack_types.go1
1610:6no-init
operator/api/loki/v1/lokistack_types.go:1610:6
func init() { SchemeBuilder.Register(&LokiStack{}, &LokiStackList{})pkg/dataobj/internal/dataset/page_compress_writer.go1
53:2no-naked-return
pkg/dataobj/internal/dataset/page_compress_writer.go:53:2
c.rawBytes += n return}clients/cmd/fluent-bit/dque.go1
27:5no-package-var
clients/cmd/fluent-bit/dque.go:27:5
var defaultDqueConfig = dqueConfig{ queueDir: filepath.Join(os.TempDir(), "flb-storage/loki"),pkg/storage/stores/shipper/indexshipper/tsdb/pool.go1
47:13non-pointer-sync-pool-value
pkg/storage/stores/shipper/indexshipper/tsdb/pool.go:47:13
//nolint:staticcheck p.pool.Put(xs)}pkg/compute/filter_bench_test.go1
30:5overwritten-before-use
pkg/compute/filter_bench_test.go:30:5
benchAlloc.Reclaim() result, err := compute.Filter(benchAlloc, input, mask) if err != nil {clients/cmd/fluent-bit/config.go1
1:9package-comments
clients/cmd/fluent-bit/config.go:1:9
package mainpkg/dataobj/compaction/v2/output_naming_test.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/output_naming_test.go:1:9
package compactionv2clients/pkg/logentry/stages/metrics.go1
151:37range-value-address
clients/pkg/logentry/stages/metrics.go:151:37
for e := range in { m.Process(e.Labels, e.Extracted, &e.Timestamp, &e.Line) out <- epkg/dataobj/sections/logs/row_predicate_order_test.go1
403:2redefines-builtin-id
pkg/dataobj/sections/logs/row_predicate_order_test.go:403:2
min int64 max int64}clients/pkg/logentry/stages/multiline_test.go1
86:19redundant-conversion
clients/pkg/logentry/stages/multiline_test.go:86:19
require.Equal(t, "START line 1", out[1].Line) require.Equal(t, model.LabelValue("two"), out[1].Labels["value"])operator/api/loki/v1beta1/rulerconfig_types_test.go1
6:2redundant-import-alias
operator/api/loki/v1beta1/rulerconfig_types_test.go:6:2
v1 "github.com/grafana/loki/operator/api/loki/v1" "github.com/grafana/loki/operator/api/loki/v1beta1"operator/internal/manifests/openshift/dashboards_test.go1
16:3single-case-switch
operator/internal/manifests/openshift/dashboards_test.go:16:3
for _, d := range objs { switch d.(type) { case *corev1.ConfigMap:pkg/columnar/concat_test.go1
18:6slice-preallocation
pkg/columnar/concat_test.go:18:6
var in []columnar.Array for _, l := range []int{10, 5, 32} {pkg/labelaccess/aggregated_metrics_test.go1
144:32standard-http-method-constant
pkg/labelaccess/aggregated_metrics_test.go:144:32
// Create a request with the query req, err := http.NewRequest("GET", "/loki/api/v1/query_range", nil) require.NoError(t, err)operator/api/loki/v1beta1/lokistack_types.go1
55:2task-comment
operator/api/loki/v1beta1/lokistack_types.go:55:2
// // FIXME: Add clear description of ingestion/query performance expectations. SizeOneXMedium LokiStackSizeType = "1x.medium"clients/pkg/logentry/logql/parser.go1
53:1top-level-declaration-order
clients/pkg/logentry/logql/parser.go:53:1
var tokens = map[string]int{ ",": COMMA,clients/pkg/logentry/stages/drop.go1
112:15unchecked-type-assertion
clients/pkg/logentry/stages/drop.go:112:15
for i := range s { r[i] = s[i].(string) }pkg/logql/log/pattern/lexer.rl.go1
54unexported-naming
pkg/logql/log/pattern/lexer.rl.go:54
var _pattern_trans_actions []byte = []byte{ 13, 0, 7, 9, 0, 0, 0, 5, clients/pkg/logentry/stages/metrics.go1
145:42unexported-return
clients/pkg/logentry/stages/metrics.go:145:42
func (m *metricStage) Run(in chan Entry) chan Entry { out := make(chan Entry)clients/pkg/logentry/stages/extensions.go1
56:7unused-receiver
clients/pkg/logentry/stages/extensions.go:56:7
// implement Stage interfacefunc (c *cri) Name() string { return "cri"clients/cmd/fluent-bit/config_test.go1
119:31use-any
clients/cmd/fluent-bit/config_test.go:119:31
labelMap: map[string]interface{}{ "kubernetes": map[string]interface{}{ "container_name": "container",pkg/canary/writer/push.go1
87:15use-errors-new
pkg/canary/writer/push.go:87:15
if logBatchSize < 0 { return nil, fmt.Errorf("logBatchSize must be >= 0") }pkg/bloomgateway/bloomgateway.go1
385:2use-slices-sort
pkg/bloomgateway/bloomgateway.go:385:2
// sort responses by fingerprint sort.Slice(responses, func(i, j int) bool { return responses[i].Fp < responses[j].Fp })pkg/compression/codec.go1
19:2var-naming
pkg/compression/codec.go:19:2
Dumb // not supported LZ4_64k Snappyclients/cmd/fluent-bit/config_test.go1
98:22add-constant
clients/cmd/fluent-bit/config_test.go:98:22
"DropSingleKey": "false", "MinBackoff": "1ms", "MaxBackoff": "5m",pkg/storage/detected/fields_test.go1
100:3call-to-gc
pkg/storage/detected/fields_test.go:100:3
runtime.GC() var after runtime.MemStatsclients/cmd/fluent-bit/loki.go1
179:6cognitive-complexity
clients/cmd/fluent-bit/loki.go:179:6
// mapLabels convert records into labels using a json map[string]interface{} mappingfunc mapLabels(records map[string]interface{}, mapping map[string]interface{}, res model.LabelSet) { for k, v := range mapping {pkg/bloombuild/planner/retention_test.go1
734:30confusing-naming
pkg/bloombuild/planner/retention_test.go:734:30
func (m mockRetentionLimits) StreamRetention(tenant string) []validation.StreamRetention { return m.streamRetention[tenant]pkg/chunkenc/facade.go1
44:38confusing-results
pkg/chunkenc/facade.go:44:38
func (f Facade) Bounds() (time.Time, time.Time) { return f.c.Bounds()pkg/compactor/client/http.go1
50:6constructor-interface-return
pkg/compactor/client/http.go:50:6
// It uses provided TLS config which creating HTTP client.func NewHTTPClient(addr string, cfg HTTPConfig) (CompactorClient, error) { u, err := url.Parse(addr)pkg/compactor/deletion/job_builder.go1
506:2context-stored-in-struct
pkg/compactor/deletion/job_builder.go:506:2
type storageUpdatesIterator struct { ctx context.Context manifestPath stringclients/pkg/logentry/stages/eventlogmessage.go1
90:32cyclomatic-complexity
clients/pkg/logentry/stages/eventlogmessage.go:90:32
// entries into the extracted mapfunc (m *eventLogMessageStage) processEntry(extracted map[string]interface{}, key string) error { value, ok := extracted[key]operator/cmd/loki-broker/main.go1
87:3deep-exit
operator/cmd/loki-broker/main.go:87:3
log.Info("-object-storage.s3.buckets flag is required") os.Exit(1) }pkg/ingester/ingester.go1
1106:15deprecated-api-usage
pkg/ingester/ingester.go:1106:15
storeReq := logql.SelectLogParams{QueryRequest: &logproto.QueryRequest{ Selector: req.Selector, Direction: req.Direction,clients/cmd/docker-driver/driver.go1
206:6discarded-error-result
clients/cmd/docker-driver/driver.go:206:6
if !ok { w.Close() returnclients/cmd/fluent-bit/out_grafana_loki.go1
154:1doc-comment-period
clients/cmd/fluent-bit/out_grafana_loki.go:154:1
//export FLBPluginExitfunc FLBPluginExit() int {pkg/bloombuild/planner/planner.go1
550:5early-return
pkg/bloombuild/planner/planner.go:550:5
if err := client.DeleteBlocks(ctx, []bloomshipper.BlockRef{block}); err != nil { if client.IsObjectNotFoundErr(err) { level.Debug(logger).Log("msg", "block not found while attempting delete, continuing")clients/pkg/logentry/stages/util_test.go1
80:12error-strings
clients/pkg/logentry/stages/util_test.go:80:12
if err != nil { t.Errorf("Failed to get string from float... this shouldn't have happened: %v", err) returnpkg/limits/store_bench_test.go1
109:6excessive-blank-identifiers
pkg/limits/store_bench_test.go:109:6
_, _, _, err := s.UpdateCond(tenant, metadata, updateTime) require.NoError(b, err)clients/pkg/logentry/logql/ast.go1
24:24exported-declaration-comment
clients/pkg/logentry/logql/ast.go:24:24
func (e *matchersExpr) Matchers() []*labels.Matcher { return e.matchersoperator/api/loki/v1beta1/lokistack_types.go1
1:1file-length-limit
operator/api/loki/v1beta1/lokistack_types.go:1:1
package v1beta1operator/internal/manifests/networkpolicy.go1
658:51flag-parameter
operator/internal/manifests/networkpolicy.go:658:51
func getEndpointPort(storageOpts storage.Options, openShiftEnabled bool) []int32 { // Many self-hosted object storage solutions use S3 API endpointsclients/cmd/fluent-bit/loki.go1
1:1format
clients/cmd/fluent-bit/loki.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/fluent-bit/loki.go`
clients/pkg/logentry/stages/eventlogmessage_test.go1
174:6function-length
clients/pkg/logentry/stages/eventlogmessage_test.go:174:6
func TestEventLogMessage_Real(t *testing.T) { t.Parallel()pkg/chunkenc/memchunk.go1
1533:29function-result-limit
pkg/chunkenc/memchunk.go:1533:29
// moveNext moves the buffer to the next entryfunc (si *bufferedIterator) moveNext() (int64, []byte, labels.Labels, bool) { var decompressedBytes int64clients/pkg/logentry/stages/metrics.go1
339:2identical-switch-branches
clients/pkg/logentry/stages/metrics.go:339:2
return float64(i), nil case uint: return float64(i), nilclients/pkg/logentry/stages/json_test.go1
13:2import-alias-naming
clients/pkg/logentry/stages/json_test.go:13:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/pkg/logentry/stages/template.go1
106:2import-shadowing
clients/pkg/logentry/stages/template.go:106:2
logger log.Logger template *template.Template}pkg/compactor/retention/util_test.go1
278:5inefficient-map-lookup
pkg/compactor/retention/util_test.go:278:5
if _, ok := t.tables[tableName]; !ok { t.tables[tableName] = newTable(tableName) }pkg/compactor/retention/marker_test.go1
147:40inefficient-sprintf
pkg/compactor/retention/marker_test.go:147:40
_, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-1*time.Hour).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-3*time.Hour).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-2*time.Hour).UnixNano())))integration/cluster/cluster.go1
323:21insecure-url-scheme
integration/cluster/cluster.go:323:21
func (c *Component) HTTPURL() string { return fmt.Sprintf("http://localhost:%s", port(c.loki.Server.HTTPListenAddr().String()))}pkg/ingester/limiter.go1
29:13interface-method-limit
pkg/ingester/limiter.go:29:13
type Limits interface { UseOwnedStreamCount(userID string) boolpkg/loghttp/push/otlplabels/config.go1
165:7marshal-receiver
pkg/loghttp/push/otlplabels/config.go:165:7
func (c AttributesConfig) MarshalYAML() (any, error) { return getMarshableAttributesConfig(c), nilcmd/migrate/main.go1
380:8max-control-nesting
cmd/migrate/main.go:380:8
if err != nil { if retry == 0 { log.Println(threadID, "Final error sending chunks to new store, giving up:", err)pkg/distributor/distributor.go1
346:6max-parameters
pkg/distributor/distributor.go:346:6
// New a distributor creates.func New( cfg Config,operator/api/config/v1/projectconfig_types.go1
193:6max-public-structs
operator/api/config/v1/projectconfig_types.go:193:6
// ControllerWebhook defines the webhook server for the controller.type ControllerWebhook struct { // Port is the port that the webhook server serves at.clients/pkg/logentry/metric/counters.go1
35:2modifies-parameter
clients/pkg/logentry/metric/counters.go:35:2
} config.Action = strings.ToLower(config.Action) if config.Action != CounterInc && config.Action != CounterAdd {pkg/bloombuild/planner/versioned_range.go1
139:5modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:139:5
copy(t[i+2:], t[i+1:]) t[i+1] = tok return t, trueclients/cmd/fluent-bit/loki_test.go1
219:13nested-structs
clients/cmd/fluent-bit/loki_test.go:219:13
func Test_toStringMap(t *testing.T) { tests := []struct { name stringpkg/compactor/deletion/job_runner.go1
98:5nil-error-return
pkg/compactor/deletion/job_runner.go:98:5
level.Warn(util_log.Logger).Log("msg", "skipping processing missing chunk", "chunk_id", chunkID) return nil }pkg/analytics/stats.go1
390:4nil-value-with-nil-error
pkg/analytics/stats.go:390:4
} return nil, nil },pkg/ruler/base/client_pool_test.go1
46:3no-defer-in-loop
pkg/ruler/base/client_pool_test.go:46:3
require.NoError(t, err) defer client.Close() //nolint:errcheckpkg/compactor/index_set_test.go1
92:6no-else-after-return
pkg/compactor/index_set_test.go:92:6
return -1 } else if a.GetFrom() > b.GetFrom() { return 1operator/api/loki/v1/recordingrule_types.go1
118:6no-init
operator/api/loki/v1/recordingrule_types.go:118:6
func init() { SchemeBuilder.Register(&RecordingRule{}, &RecordingRuleList{})pkg/dataobj/internal/dataset/row_reader.go1
961:3no-naked-return
pkg/dataobj/internal/dataset/row_reader.go:961:3
if stats == nil { return }clients/cmd/fluent-bit/loki.go1
26:2no-package-var
clients/cmd/fluent-bit/loki.go:26:2
var ( lineReplacer = strings.NewReplacer(`\n`, "\n", `\t`, "\t") keyReplacer = strings.NewReplacer("/", "_", ".", "_", "-", "_")pkg/compute/filter_bench_test.go1
52:5overwritten-before-use
pkg/compute/filter_bench_test.go:52:5
benchAlloc.Reclaim() result, err := compute.Filter(benchAlloc, input, mask) if err != nil {clients/cmd/fluent-bit/dque.go1
1:9package-comments
clients/cmd/fluent-bit/dque.go:1:9
package mainpkg/dataobj/compaction/v2/plan.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/plan.go:1:9
package compactionv2clients/pkg/logentry/stages/metrics.go1
151:51range-value-address
clients/pkg/logentry/stages/metrics.go:151:51
for e := range in { m.Process(e.Labels, e.Extracted, &e.Timestamp, &e.Line) out <- epkg/engine/internal/scheduler/wire/wire_local.go1
39:2redefines-builtin-id
pkg/engine/internal/scheduler/wire/wire_local.go:39:2
alive context.Context close context.CancelFuncclients/pkg/logentry/stages/multiline_test.go1
89:19redundant-conversion
clients/pkg/logentry/stages/multiline_test.go:89:19
require.Equal(t, "START line 2", out[2].Line) require.Equal(t, model.LabelValue("two"), out[2].Labels["value"])operator/internal/handlers/internal/gateway/cleanup.go1
16:2redundant-import-alias
operator/internal/handlers/internal/gateway/cleanup.go:16:2
v1 "github.com/grafana/loki/operator/api/loki/v1" "github.com/grafana/loki/operator/internal/external/k8s"pkg/dataobj/sections/logs/iter.go1
119:4single-case-switch
pkg/dataobj/sections/logs/iter.go:119:4
if columnValue.IsNil() || columnValue.IsZero() { switch column.Type { case ColumnTypeMessage:pkg/columnar/concat_test.go1
332:7slice-preallocation
pkg/columnar/concat_test.go:332:7
var in []columnar.Array for _, builder := range builders {pkg/labelaccess/aggregated_metrics_test.go1
292:32standard-http-method-constant
pkg/labelaccess/aggregated_metrics_test.go:292:32
// Create a request with the requisite headers for extracting the policy req, err := http.NewRequest("GET", "/loki/api/v1/query_range", nil) require.NoError(t, err)operator/internal/controller/loki/alertingrule_controller.go1
34:1task-comment
operator/internal/controller/loki/alertingrule_controller.go:34:1
// move the current state of the cluster closer to the desired state.// TODO(user): Modify the Reconcile function to compare the state specified by// the AlertingRule object against the actual cluster state, and thenclients/pkg/logentry/metric/counters.go1
61:1top-level-declaration-order
clients/pkg/logentry/metric/counters.go:61:1
// Counters is a vec tor of counters for a each log stream.type Counters struct { *metricVecclients/pkg/logentry/stages/match.go1
124:42unchecked-type-assertion
clients/pkg/logentry/stages/match.go:124:42
if existing, ok := err.(prometheus.AlreadyRegisteredError); ok { dropCount = existing.ExistingCollector.(*prometheus.CounterVec) } else {pkg/logql/log/pattern/lexer.rl.go1
59unexported-naming
pkg/logql/log/pattern/lexer.rl.go:59
var _pattern_to_state_actions []byte = []byte{ 0, 0, 0, 0, 0, 0, 0, 0, clients/pkg/logentry/stages/multiline.go1
101:45unexported-return
clients/pkg/logentry/stages/multiline.go:101:45
func (m *multilineStage) Run(in chan Entry) chan Entry { out := make(chan Entry)clients/pkg/logentry/stages/geoip.go1
123:7unused-receiver
clients/pkg/logentry/stages/geoip.go:123:7
// Name implements Stagefunc (g *geoIPStage) Name() string { return StageTypeGeoIPclients/cmd/fluent-bit/config_test.go1
124:28use-any
clients/cmd/fluent-bit/config_test.go:124:28
"pod_name": "instance", "labels": map[string]interface{}{ "component": "component",pkg/chunkenc/memchunk.go1
1550:14use-errors-new
pkg/chunkenc/memchunk.go:1550:14
if si.readBufValid == lastAttempt { // Got EOF and could not parse same data last time. si.err = fmt.Errorf("invalid data in chunk") return 0, nil, labels.EmptyLabels(), falsepkg/bloomgateway/client.go1
242:3use-slices-sort
pkg/bloomgateway/client.go:242:3
sort.Slice(rs.groups, func(i, j int) bool { return rs.groups[i].Fingerprint < rs.groups[j].Fingerprintpkg/compression/codec.go1
21:2var-naming
pkg/compression/codec.go:21:2
Snappy LZ4_256k LZ4_1Mclients/cmd/fluent-bit/config_test.go1
99:22add-constant
clients/cmd/fluent-bit/config_test.go:99:22
"MinBackoff": "1ms", "MaxBackoff": "5m", "MaxRetries": "10",pkg/storage/detected/fields_test.go1
151:3call-to-gc
pkg/storage/detected/fields_test.go:151:3
t.Run("huge limit doesn't explode the heap", func(t *testing.T) { runtime.GC() var before runtime.MemStatsclients/cmd/fluent-bit/loki.go1
221:16cognitive-complexity
clients/cmd/fluent-bit/loki.go:221:16
func (l *loki) createLine(records map[string]interface{}, f format) (string, error) { switch f {pkg/bloomgateway/multiplexing.go1
102:15confusing-naming
pkg/bloomgateway/multiplexing.go:102:15
func (t Task) Done() <-chan struct{} { return t.donepkg/chunkenc/memchunk.go1
184:39confusing-results
pkg/chunkenc/memchunk.go:184:39
func (hb *headBlock) Bounds() (int64, int64) { return hb.mint, hb.maxt }pkg/compactor/deletion/delete_requests_client.go1
47:6constructor-interface-return
pkg/compactor/deletion/delete_requests_client.go:47:6
func NewDeleteRequestsClient(compactorClient CompactorClient, deleteClientMetrics *DeleteRequestClientMetrics, clientType string, opts ...DeleteRequestsStoreOption) (DeleteRequestsClient, error) { client := &deleteRequestsClient{pkg/compactor/index_set.go1
67:2context-stored-in-struct
pkg/compactor/index_set.go:67:2
type indexSet struct { ctx context.Context tableName, userID stringclients/pkg/logentry/stages/eventlogmessage.go1
152:6cyclomatic-complexity
clients/pkg/logentry/stages/eventlogmessage.go:152:6
// TODO: switch to prometheus/prometheus/util/strutil/SanitizeFullLabelNamefunc SanitizeFullLabelName(input string) string { if len(input) == 0 {operator/cmd/loki-broker/main.go1
92:3deep-exit
operator/cmd/loki-broker/main.go:92:3
log.Info("-with-prometheus-alerts flag requires -with-service-monitors") os.Exit(1) }pkg/ingester/ingester.go1
1143:41deprecated-api-usage
pkg/ingester/ingester.go:1143:41
if req.Plan == nil { parsed, err := syntax.ParseSampleExpr(req.Selector) if err != nil {clients/cmd/docker-driver/driver.go1
216:10discarded-error-result
clients/cmd/docker-driver/driver.go:216:10
if err := enc.Encode(&buf); err != nil { _ = w.CloseWithError(err) returnclients/pkg/logentry/metric/counters.go1
114:1doc-comment-period
clients/pkg/logentry/metric/counters.go:114:1
// HasExpired implements Expirablefunc (e *expiringCounter) HasExpired(currentTimeSec int64, maxAgeSec int64) bool {pkg/bloombuild/planner/planner.go1
564:4early-return
pkg/bloombuild/planner/planner.go:564:4
if err != nil { if client.IsObjectNotFoundErr(err) { level.Debug(logger).Log("msg", "meta not found while attempting delete, continuing", "meta", meta.String())clients/pkg/logentry/stages/util_test.go1
85:12error-strings
clients/pkg/logentry/stages/util_test.go:85:12
if err != nil { t.Errorf("Failed to get string from float... this shouldn't have happened: %v", err) returnpkg/limits/store_bench_test.go1
131:6excessive-blank-identifiers
pkg/limits/store_bench_test.go:131:6
_, _, _, err := s.UpdateCond(tenant, metadata, updateTime) require.NoError(b, err)clients/pkg/logentry/logql/ast.go1
28:24exported-declaration-comment
clients/pkg/logentry/logql/ast.go:28:24
func (e *matchersExpr) Filter() (Filter, error) { return nil, niloperator/api/loki/v1beta1/lokistack_types_test.go1
1:1file-length-limit
operator/api/loki/v1beta1/lokistack_types_test.go:1:1
package v1beta1_testoperator/internal/manifests/openshift/configure.go1
146:70flag-parameter
operator/internal/manifests/openshift/configure.go:146:70
// the sidecar metrics.func ConfigureGatewayServiceMonitor(sm *monitoringv1.ServiceMonitor, withTLS bool) error { var opaEndpoint monitoringv1.Endpointclients/cmd/fluent-bit/loki_test.go1
1:1format
clients/cmd/fluent-bit/loki_test.go:1:1
//go:build cgo- Fix (safe): run `strider fmt clients/cmd/fluent-bit/loki_test.go`
clients/pkg/logentry/stages/extensions_test.go1
96:6function-length
clients/pkg/logentry/stages/extensions_test.go:96:6
func TestCRI_tags(t *testing.T) { cases := []struct {pkg/dataobj/index/builder_test.go1
536:30function-result-limit
pkg/dataobj/index/builder_test.go:536:30
func (c *blockingCalculator) Flush() (*dataobj.Object, io.Closer, []multitenancy.TimeRange, error) { return nil, nil, nil, fmt.Errorf("unexpected flush")clients/pkg/logentry/stages/util.go1
183:2identical-switch-branches
clients/pkg/logentry/stages/util.go:183:2
return strconv.FormatUint(uint64(i), 10), nil case uint: return strconv.FormatUint(uint64(i), 10), nilclients/pkg/logentry/stages/labelallow_test.go1
12:2import-alias-naming
clients/pkg/logentry/stages/labelallow_test.go:12:2
util_log "github.com/grafana/loki/v3/pkg/util/log")clients/pkg/util/client.go1
388:2import-shadowing
clients/pkg/util/client.go:388:2
backoff := backoff.New(c.ctx, c.cfg.BackoffConfig) var status intpkg/dataobj/consumer/logsobj/builder.go1
270:3inefficient-map-lookup
pkg/dataobj/consumer/logsobj/builder.go:270:3
sb.SetTenant(tenant) b.streams[tenant] = sb }pkg/compactor/retention/marker_test.go1
148:40inefficient-sprintf
pkg/compactor/retention/marker_test.go:148:40
_, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-3*time.Hour).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-2*time.Hour).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-48*time.Hour).UnixNano())))integration/cluster/cluster.go1
465:38insecure-url-scheme
integration/cluster/cluster.go:465:38
req := httptest.NewRequest("GET", "http://localhost/ready", nil) w := httptest.NewRecorder()pkg/logcli/client/client.go1
55:13interface-method-limit
pkg/logcli/client/client.go:55:13
// Client contains all the methods to query a Loki instance, it's an interface to allow multiple implementations.type Client interface { Query(queryStr string, limit int, time time.Time, direction logproto.Direction, quiet bool) (*loghttp.QueryResponse, error)pkg/loghttp/query.go1
402:7marshal-receiver
pkg/loghttp/query.go:402:7
func (s *Scalar) UnmarshalJSON(b []byte) error { var v model.Scalaroperator/internal/handlers/internal/networkpolicy/service.go1
133:7max-control-nesting
operator/internal/handlers/internal/networkpolicy/service.go:133:7
case intstr.Int: if p.Port != nil && *p.Port == svcPort.TargetPort.IntVal { return *p.Portpkg/distributor/http_test.go1
173:22max-parameters
pkg/distributor/http_test.go:173:22
func (p *fakeParser) parseRequest( _ string,operator/api/config/v1/projectconfig_types.go1
203:6max-public-structs
operator/api/config/v1/projectconfig_types.go:203:6
// ControllerManagerConfiguration is the Schema for the GenericControllerManagerConfigurations API.type ControllerManagerConfiguration struct { metav1.TypeMeta `json:",inline"`clients/pkg/logentry/metric/gauges.go1
33:2modifies-parameter
clients/pkg/logentry/metric/gauges.go:33:2
} config.Action = strings.ToLower(config.Action) if config.Action != GaugeSet &&pkg/bloombuild/planner/versioned_range.go1
146:4modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:146:4
tok := tsdbToken{through: bounds.Max, version: version} t = append(t, tsdbToken{}, tsdbToken{}) copy(t[i+2:], t[i:])clients/cmd/fluent-bit/loki_test.go1
242:13nested-structs
clients/cmd/fluent-bit/loki_test.go:242:13
func Test_labelMapping(t *testing.T) { tests := []struct { name stringpkg/compactor/deletion/job_runner.go1
136:5nil-error-return
pkg/compactor/deletion/job_runner.go:136:5
updates.RebuiltChunks[chunkID] = nil return nil }pkg/analytics/stats.go1
449:4nil-value-with-nil-error
pkg/analytics/stats.go:449:4
} return nil, nil },pkg/storage/chunk/client/ibmcloud/cos_object_client_test.go1
276:4no-defer-in-loop
pkg/storage/chunk/client/ibmcloud/cos_object_client_test.go:276:4
require.NoError(t, err) defer os.Remove(file.Name())pkg/compactor/table_test.go1
619:8no-else-after-return
pkg/compactor/table_test.go:619:8
return -1 } else if a.GetFrom() > b.GetFrom() { return 1operator/api/loki/v1/rulerconfig_types.go1
555:6no-init
operator/api/loki/v1/rulerconfig_types.go:555:6
func init() { SchemeBuilder.Register(&RulerConfig{}, &RulerConfigList{})pkg/dataobj/internal/dataset/row_reader.go1
969:2no-naked-return
pkg/dataobj/internal/dataset/row_reader.go:969:2
} return}clients/cmd/fluent-bit/loki.go1
27:2no-package-var
clients/cmd/fluent-bit/loki.go:27:2
lineReplacer = strings.NewReplacer(`\n`, "\n", `\t`, "\t") keyReplacer = strings.NewReplacer("/", "_", ".", "_", "-", "_"))pkg/compute/filter_bench_test.go1
74:5overwritten-before-use
pkg/compute/filter_bench_test.go:74:5
benchAlloc.Reclaim() result, err := compute.Filter(benchAlloc, input, mask) if err != nil {clients/cmd/fluent-bit/loki.go1
1:9package-comments
clients/cmd/fluent-bit/loki.go:1:9
package mainpkg/dataobj/compaction/v2/plan_test.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/plan_test.go:1:9
package compactionv2operator/api/loki/v1beta1/alertingrule_types.go1
156:15range-value-address
operator/api/loki/v1beta1/alertingrule_types.go:156:15
for j, r := range sRules { rules[j] = &v1.AlertingRuleGroupSpec{ Alert: r.Alert,pkg/engine/internal/scheduler/wire/wire_local.go1
132:2redefines-builtin-id
pkg/engine/internal/scheduler/wire/wire_local.go:132:2
alive context.Context close context.CancelFuncclients/pkg/logentry/stages/multiline_test.go1
92:19redundant-conversion
clients/pkg/logentry/stages/multiline_test.go:92:19
require.Equal(t, "START line 2\nnot a start line 1", out[3].Line) require.Equal(t, model.LabelValue("one"), out[3].Labels["value"])}operator/internal/handlers/internal/rules/cleanup.go1
14:2redundant-import-alias
operator/internal/handlers/internal/rules/cleanup.go:14:2
v1 "github.com/grafana/loki/operator/api/loki/v1" "github.com/grafana/loki/operator/internal/external/k8s"pkg/distributor/distributor.go1
1539:4single-case-switch
pkg/distributor/distributor.go:1539:4
if e, ok := status.FromError(err); ok { switch e.Code() { case codes.DeadlineExceeded:pkg/compactor/deletion/delete_request.go1
219:6slice-preallocation
pkg/compactor/deletion/delete_request.go:219:6
} var result []string for _, m := range d.matchers {pkg/logcli/client/client.go1
337:30standard-http-method-constant
pkg/logcli/client/client.go:337:30
req, err := http.NewRequest("GET", us, nil) if err != nil {operator/internal/controller/loki/recordingrule_controller.go1
34:1task-comment
operator/internal/controller/loki/recordingrule_controller.go:34:1
// move the current state of the cluster closer to the desired state.// TODO(user): Modify the Reconcile function to compare the state specified by// the RecordingRule object against the actual cluster state, and thenclients/pkg/logentry/metric/gauges.go1
54:1top-level-declaration-order
clients/pkg/logentry/metric/gauges.go:54:1
// Gauges is a vector of gauges for a each log stream.type Gauges struct { *metricVecclients/pkg/logentry/stages/metrics_test.go1
444:52unchecked-type-assertion
clients/pkg/logentry/stages/metrics_test.go:444:52
} assert.Equal(t, int64(5*time.Minute.Seconds()), ms.(*metricStage).cfg["total_keys"].maxIdleSec)}pkg/logql/log/pattern/lexer.rl.go1
64unexported-naming
pkg/logql/log/pattern/lexer.rl.go:64
var _pattern_from_state_actions []byte = []byte{ 0, 0, 0, 0, 0, 0, 0, 0, clients/pkg/logentry/stages/pack.go1
151:40unexported-return
clients/pkg/logentry/stages/pack.go:151:40
func (m *packStage) Run(in chan Entry) chan Entry { out := make(chan Entry)clients/pkg/logentry/stages/geoip.go1
254:7unused-receiver
clients/pkg/logentry/stages/geoip.go:254:7
func (g *geoIPStage) populateLabelsWithASNData(labels model.LabelSet, record *geoip2.ASN) { autonomousSystemNumber := record.AutonomousSystemNumberclients/cmd/fluent-bit/dque.go1
40:25use-any
clients/cmd/fluent-bit/dque.go:40:25
func dqueEntryBuilder() interface{} { return &dqueEntry{}pkg/chunkenc/memchunk.go1
1623:14use-errors-new
pkg/chunkenc/memchunk.go:1623:14
if si.readBufValid == lastAttempt { // Got EOF and could not parse same data last time. si.err = fmt.Errorf("invalid data in chunk") return 0, nil, labels.EmptyLabels(), falsepkg/bloomgateway/client.go1
295:3use-slices-sort
pkg/bloomgateway/client.go:295:3
for _, inp := range input { sort.Slice(inp, func(i, j int) bool { return inp[i].Fingerprint < inp[j].Fingerprint }) iters = append(iters, iter.NewPeekIter(iter.NewSliceIter(inp)))pkg/compression/codec.go1
22:2var-naming
pkg/compression/codec.go:22:2
LZ4_256k LZ4_1M LZ4_4Mclients/cmd/fluent-bit/config_test.go1
109:40add-constant
clients/cmd/fluent-bit/config_test.go:109:40
BatchSize: 100, BatchWait: mustParseDuration("30s"), Timeout: mustParseDuration("1s"),pkg/storage/detected/fields_test.go1
159:3call-to-gc
pkg/storage/detected/fields_test.go:159:3
runtime.GC() var after runtime.MemStatsclients/cmd/fluent-bit/out_grafana_loki.go1
108:6cognitive-complexity
clients/cmd/fluent-bit/out_grafana_loki.go:108:6
//export FLBPluginFlushCtxfunc FLBPluginFlushCtx(ctx, data unsafe.Pointer, length C.int, _ *C.char) int { plugin := output.FLBPluginGetContext(ctx).(*loki)pkg/bloomgateway/multiplexing.go1
106:15confusing-naming
pkg/bloomgateway/multiplexing.go:106:15
func (t Task) Err() error { return t.err.errpkg/chunkenc/unordered.go1
83:48confusing-results
pkg/chunkenc/unordered.go:83:48
func (hb *unorderedHeadBlock) Bounds() (int64, int64) { return hb.mint, hb.maxtpkg/compactor/deletion/delete_requests_client.go1
152:6constructor-interface-return
pkg/compactor/deletion/delete_requests_client.go:152:6
func NewNoOpDeleteRequestsClient() DeleteRequestsClient { return &noOpDeleteRequestsClient{}pkg/compactor/retention/marker.go1
160:2context-stored-in-struct
pkg/compactor/retention/marker.go:160:2
ctx context.Context cancel context.CancelFuncclients/pkg/logentry/stages/geoip.go1
132:22cyclomatic-complexity
clients/pkg/logentry/stages/geoip.go:132:22
func (g *geoIPStage) process(labels model.LabelSet, extracted map[string]interface{}, _ *time.Time, _ *string) { var ip net.IPoperator/internal/controller/loki/lokistack_controller_test.go1
51:2deep-exit
operator/internal/controller/loki/lokistack_controller_test.go:51:2
os.Exit(m.Run())}pkg/ingester/ingester.go1
1172:32deprecated-api-usage
pkg/ingester/ingester.go:1172:32
sp.AddEvent("finished instance query sample", trace.WithAttributes( attribute.String("selector", req.Selector), attribute.String("start", req.Start.String()),clients/cmd/docker-driver/driver.go1
220:9discarded-error-result
clients/cmd/docker-driver/driver.go:220:9
case err := <-watcher.Err: _ = w.CloseWithError(err) returnclients/pkg/logentry/metric/gauges.go1
114:1doc-comment-period
clients/pkg/logentry/metric/gauges.go:114:1
// Add adds the given value to the Gauge. (The value can be negative,// resulting in a decrease of the Gauge.)func (g *expiringGauge) Add(val float64) {pkg/compactor/retention/retention.go1
347:3early-return
pkg/compactor/retention/retention.go:347:3
if err != nil { if errors.Is(err, context.DeadlineExceeded) && errors.Is(iterCtx.Err(), context.DeadlineExceeded) { // Deletes timed out. Don't return an error so compaction can continue and deletes can be retriedintegration/loki_rule_eval_test.go1
126:14error-strings
integration/loki_rule_eval_test.go:126:14
if r.URL.Path != "/api/v1/write" { t.Errorf("Expected to request '/api/v1/write', got: %s", r.URL.Path) }pkg/logqlanalyzer/analyzer.go1
121:2excessive-blank-identifiers
pkg/logqlanalyzer/analyzer.go:121:2
stream := log.NewStreamPipeline(stageRecorders, p.origin.LabelsBuilder().ForLabels(p.streamLabels, labels.StableHash(p.streamLabels))) _, _, _ = stream.ProcessString(time.Now().UnixMilli(), line, labels.EmptyLabels()) return recordsclients/pkg/logentry/logql/ast.go1
38:22exported-declaration-comment
clients/pkg/logentry/logql/ast.go:38:22
func (e *filterExpr) Matchers() []*labels.Matcher { return e.left.Matchers()operator/api/loki/v1beta1/rulerconfig_types.go1
1:1file-length-limit
operator/api/loki/v1beta1/rulerconfig_types.go:1:1
package v1beta1operator/internal/manifests/openshift/configure.go1
249:50flag-parameter
operator/internal/manifests/openshift/configure.go:249:50
// ConfigureOptions applies default configuration for the use of the cluster monitoring alertmanager.func ConfigureOptions(configOpt *config.Options, am, uwam bool, token, caPath, monitorServerName string) error { if am {clients/cmd/fluent-bit/out_grafana_loki.go1
1:1format
clients/cmd/fluent-bit/out_grafana_loki.go:1:1
package main- Fix (safe): run `strider fmt clients/cmd/fluent-bit/out_grafana_loki.go`
clients/pkg/logentry/stages/json.go1
110:21function-length
clients/pkg/logentry/stages/json.go:110:21
func (j *jsonStage) processEntry(extracted map[string]interface{}, entry *string) error { // If a source key is provided, the json stage should process itpkg/dataobj/index/calculate.go1
116:22function-result-limit
pkg/dataobj/index/calculate.go:116:22
// add the reprocessed bytes on top of the stale count.func (c *Calculator) Flush() (*dataobj.Object, io.Closer, []multitenancy.TimeRange, error) { ranges := c.TimeRanges()operator/internal/manifests/build_test.go1
422:3identical-switch-branches
operator/internal/manifests/build_test.go:422:3
lps = o.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Scheme case *appsv1.StatefulSet: name = o.Nameclients/pkg/logentry/stages/labeldrop_test.go1
12:2import-alias-naming
clients/pkg/logentry/stages/labeldrop_test.go:12:2
util_log "github.com/grafana/loki/v3/pkg/util/log")cmd/logcli/main.go1
556:2import-shadowing
cmd/logcli/main.go:556:2
client := &client.DefaultClient{ TLSConfig: config.TLSConfig{},pkg/dataobj/consumer/logsobj/builder.go1
310:3inefficient-map-lookup
pkg/dataobj/consumer/logsobj/builder.go:310:3
lb.SetTenant(tenant) b.logs[tenant] = lb }pkg/compactor/retention/marker_test.go1
149:40inefficient-sprintf
pkg/compactor/retention/marker_test.go:149:40
_, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-2*time.Hour).UnixNano()))) _, _ = os.Create(filepath.Join(dir, fmt.Sprintf("%d", now.Add(-48*time.Hour).UnixNano()))) return []string{operator/api/loki/v1beta1/lokistack_types_test.go1
220:25insecure-url-scheme
operator/api/loki/v1beta1/lokistack_types_test.go:220:25
}, IssuerURL: "http://go-to-issuer", RedirectURL: "http://bring-me-back",pkg/logql/evaluator.go1
40:13interface-method-limit
pkg/logql/evaluator.go:40:13
// Params details the parameters associated with a loki requesttype Params interface { QueryString() stringpkg/logproto/compat.go1
167:7marshal-receiver
pkg/logproto/compat.go:167:7
// UnmarshalJSON implements json.Unmarshaler.func (s *LegacySample) UnmarshalJSON(b []byte) error { var t model.Timeoperator/internal/handlers/internal/networkpolicy/service.go1
137:7max-control-nesting
operator/internal/handlers/internal/networkpolicy/service.go:137:7
case intstr.String: if p.Name != nil && *p.Name == svcPort.TargetPort.StrVal { return *p.Portpkg/distributor/validator.go1
206:20max-parameters
pkg/distributor/validator.go:206:20
func (v Validator) reportDiscardedDataWithTracker(ctx context.Context, reason string, vCtx validationContext, labels labels.Labels, retentionHours string, policy string, entrySize, entryCount int, format string) { v.reportDiscardedData(reason, vCtx, retentionHours, policy, entrySize, entryCount, format)operator/api/config/v1/projectconfig_types.go1
218:6max-public-structs
operator/api/config/v1/projectconfig_types.go:218:6
// ProjectConfig is the Schema for the projectconfigs APItype ProjectConfig struct { metav1.TypeMeta `json:",inline"`clients/pkg/logentry/stages/drop.go1
60:3modifies-parameter
clients/pkg/logentry/stages/drop.go:60:3
} cfg.source = &src }pkg/bloombuild/planner/versioned_range.go1
148:4modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:148:4
copy(t[i+2:], t[i:]) t[i+1] = tok t[i].through = bounds.Min - 1clients/cmd/fluent-bit/loki_test.go1
311:13nested-structs
clients/cmd/fluent-bit/loki_test.go:311:13
func Test_AutoKubernetesLabels(t *testing.T) { tests := []struct { name stringpkg/compactor/retention/retention.go1
512:4nil-error-return
pkg/compactor/retention/retention.go:512:4
level.Info(util_log.Logger).Log("msg", "Delete request filterFunc leaves an empty chunk", "chunk ref", ce.ChunkID) return false, true, nil }pkg/bloombuild/protos/compat.go1
53:3nil-value-with-nil-error
pkg/bloombuild/protos/compat.go:53:3
if task == nil { return nil, nil }pkg/storage/chunk/client/ibmcloud/trusted_profile_authentication_provider_test.go1
61:3no-defer-in-loop
pkg/storage/chunk/client/ibmcloud/trusted_profile_authentication_provider_test.go:61:3
mockAuthServer := mockAuthServer(tt.token, tokenType) defer mockAuthServer.Close()pkg/compactor/table_test.go1
663:8no-else-after-return
pkg/compactor/table_test.go:663:8
return -1 } else if a.GetFrom() > b.GetFrom() { return 1operator/api/loki/v1beta1/alertingrule_types.go1
134:6no-init
operator/api/loki/v1beta1/alertingrule_types.go:134:6
func init() { SchemeBuilder.Register(&AlertingRule{}, &AlertingRuleList{})pkg/dataobj/internal/dataset/value_encoding_bitmap_test.go1
392:2no-naked-return
pkg/dataobj/internal/dataset/value_encoding_bitmap_test.go:392:2
w.n += int64(n) return}clients/cmd/fluent-bit/loki_test.go1
19:5no-package-var
clients/cmd/fluent-bit/loki_test.go:19:5
var now = time.Now()pkg/compute/logical_bench_test.go1
24:5overwritten-before-use
pkg/compute/logical_bench_test.go:24:5
benchAlloc.Reclaim() result, err := compute.And(benchAlloc, left, right, selection) if err != nil {clients/cmd/fluent-bit/out_grafana_loki.go1
1:9package-comments
clients/cmd/fluent-bit/out_grafana_loki.go:1:9
package mainpkg/dataobj/compaction/v2/result_record.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/result_record.go:1:9
package compactionv2operator/api/loki/v1beta1/alertingrule_types.go1
165:24range-value-address
operator/api/loki/v1beta1/alertingrule_types.go:165:24
dst.Spec.Groups[i] = &v1.AlertingRuleGroup{ Name: g.Name,pkg/engine/internal/util/queue/fair/fair.go1
48:2redefines-builtin-id
pkg/engine/internal/util/queue/fair/fair.go:48:2
len int root node[T]clients/pkg/logentry/stages/sampling.go1
18:27redundant-conversion
clients/pkg/logentry/stages/sampling.go:18:27
)const maxRandomNumber = ^(uint64(1) << 63) // i.e. 0x7fffffffffffffffoperator/internal/manifests/ingester_test.go1
12:2redundant-import-alias
operator/internal/manifests/ingester_test.go:12:2
v1 "github.com/grafana/loki/operator/api/config/v1" lokiv1 "github.com/grafana/loki/operator/api/loki/v1"pkg/engine/handler.go1
452:3single-case-switch
pkg/engine/handler.go:452:3
sampleExpr.Walk(func(e syntax.Expr) bool { switch rangeExpr := e.(type) { case *syntax.LogRangeExpr:pkg/compactor/deletion/delete_request_batch.go1
108:6slice-preallocation
pkg/compactor/deletion/delete_request_batch.go:108:6
var filterFuncs []filter.Funcpkg/logcli/client/client.go1
439:30standard-http-method-constant
pkg/logcli/client/client.go:439:30
req, err := http.NewRequest("POST", us, nil) if err != nil {operator/internal/handlers/internal/gateway/gateway.go1
99:3task-comment
operator/internal/handlers/internal/gateway/gateway.go:99:3
if !httpEncryption { // TODO(JoaoBraveCoding): Discuss with @xperimental if this makes sense or if we should always require // mTLS with the clientclients/pkg/logentry/metric/histograms.go1
30:1top-level-declaration-order
clients/pkg/logentry/metric/histograms.go:30:1
// Histograms is a vector of histograms for a each log stream.type Histograms struct { *metricVecclients/pkg/logentry/stages/pipeline_test.go1
88:34unchecked-type-assertion
clients/pkg/logentry/stages/pipeline_test.go:88:34
} return config["pipeline_stages"].([]interface{})}pkg/logql/log/pattern/lexer.rl.go1
69unexported-naming
pkg/logql/log/pattern/lexer.rl.go:69
var _pattern_eof_trans []byte = []byte{ 0, 1, 0, 0, 0, 0, 0, 0, clients/pkg/logentry/stages/pipeline.go1
69:61unexported-return
clients/pkg/logentry/stages/pipeline.go:69:61
// RunWith will reads from the input channel entries, mutate them with the process function and returns them via the output channel.func RunWith(input chan Entry, process func(e Entry) Entry) chan Entry { out := make(chan Entry)clients/pkg/logentry/stages/json.go1
188:7unused-receiver
clients/pkg/logentry/stages/json.go:188:7
// Name implements Stagefunc (j *jsonStage) Name() string { return StageTypeJSONclients/cmd/fluent-bit/loki.go1
49:33use-any
clients/cmd/fluent-bit/loki.go:49:33
// sendRecord send fluentbit records to loki as an entry.func (l *loki) sendRecord(r map[interface{}]interface{}, ts time.Time) error { records := toStringMap(r)pkg/chunkenc/memchunk.go1
1696:15use-errors-new
pkg/chunkenc/memchunk.go:1696:15
if si.readBufValid == lastAttempt { // Got EOF and could not parse same data last time. si.err = fmt.Errorf("invalid data in chunk") return 0, nil, labels.EmptyLabels(), falsepkg/bloomgateway/querier_test.go1
36:2use-slices-sort
pkg/bloomgateway/querier_test.go:36:2
} sort.SliceStable(result, func(i, j int) bool { return result[i].Fingerprint < result[j].Fingerprintpkg/compression/codec.go1
23:2var-naming
pkg/compression/codec.go:23:2
LZ4_1M LZ4_4M Flateclients/cmd/fluent-bit/config_test.go1
111:72add-constant
clients/cmd/fluent-bit/config_test.go:111:72
Timeout: mustParseDuration("1s"), ExternalLabels: lokiflag.LabelSet{LabelSet: model.LabelSet{"app": "foo"}}, BackoffConfig: backoff.Config{MinBackoff: mustParseDuration("1ms"), MaxBackoff: mustParseDuration("5m"), MaxRetries: 10},clients/pkg/logentry/logql/ast.go1
51:22cognitive-complexity
clients/pkg/logentry/logql/ast.go:51:22
func (e *filterExpr) Filter() (Filter, error) { var f func([]byte) boolpkg/chunkenc/memchunk.go1
398:6confusing-naming
pkg/chunkenc/memchunk.go:398:6
func newByteChunk(b []byte, blockSize, targetSize int, fromCheckpoint bool) (*MemChunk, error) { bc := &MemChunk{pkg/compactor/deletion/request_handler.go1
222:68confusing-results
pkg/compactor/deletion/request_handler.go:222:68
func mergeData(deletes []deletionproto.DeleteRequest) (model.Time, model.Time, deletionproto.DeleteRequestStatus) { var (pkg/compactor/deletion/tenant_delete_requests_client.go1
24:6constructor-interface-return
pkg/compactor/deletion/tenant_delete_requests_client.go:24:6
func NewPerTenantDeleteRequestsClient(c DeleteRequestsClient, l Limits) DeleteRequestsClient { return &perTenantDeleteRequestsClient{pkg/compactor/table.go1
100:2context-stored-in-struct
pkg/compactor/table.go:100:2
ctx context.Context}clients/pkg/logentry/stages/geoip.go1
193:22cyclomatic-complexity
clients/pkg/logentry/stages/geoip.go:193:22
func (g *geoIPStage) populateLabelsWithCityData(labels model.LabelSet, record *geoip2.City) { for field, label := range fields {operator/internal/handlers/lokistack_create_or_update_test.go1
92:2deep-exit
operator/internal/handlers/lokistack_create_or_update_test.go:92:2
os.Exit(m.Run())}pkg/ingester/ingester.go1
1181:4deprecated-api-usage
pkg/ingester/ingester.go:1181:4
End: end, Selector: req.Selector, Shards: req.Shards,clients/cmd/docker-driver/http.go1
60:7discarded-error-result
clients/cmd/docker-driver/http.go:60:7
h.HandleFunc("/LogDriver.Capabilities", func(w http.ResponseWriter, _ *http.Request) { _ = json.NewEncoder(w).Encode(&CapabilitiesResponse{ Cap: logger.Capability{ReadLogs: true},clients/pkg/logentry/metric/gauges.go1
121:1doc-comment-period
clients/pkg/logentry/metric/gauges.go:121:1
// Sub subtracts the given value from the Gauge. (The value can be// negative, resulting in an increase of the Gauge.)func (g *expiringGauge) Sub(val float64) {pkg/dataobj/internal/dataset/row_reader.go1
839:2early-return
pkg/dataobj/internal/dataset/row_reader.go:839:2
// Get the wrapped column so that the result of c.ListPages can be cached. if idx, ok := r.origColumnLookup[c]; ok { c = r.allColumns()[idx]operator/api/loki/v1/v1.go1
51:38error-strings
operator/api/loki/v1/v1.go:51:38
// ErrGroupNamesNotUnique is the error type when loki groups have not unique names. ErrGroupNamesNotUnique = errors.New("Group names are not unique") // ErrInvalidRecordMetricName when any loki recording rule has a invalid PromQL metric name.pkg/storage/bloom/v1/versioned_builder_test.go1
44:2excessive-blank-identifiers
pkg/storage/bloom/v1/versioned_builder_test.go:44:2
// we simply create the same data twice. _, unmodifiedData, _, _ := setup(V3)clients/pkg/logentry/logql/ast.go1
51:22exported-declaration-comment
clients/pkg/logentry/logql/ast.go:51:22
func (e *filterExpr) Filter() (Filter, error) { var f func([]byte) booloperator/api/loki/v1beta1/rulerconfig_types_test.go1
1:1file-length-limit
operator/api/loki/v1beta1/rulerconfig_types_test.go:1:1
package v1beta1_testoperator/internal/manifests/openshift/configure.go1
249:54flag-parameter
operator/internal/manifests/openshift/configure.go:249:54
// ConfigureOptions applies default configuration for the use of the cluster monitoring alertmanager.func ConfigureOptions(configOpt *config.Options, am, uwam bool, token, caPath, monitorServerName string) error { if am {clients/pkg/logentry/logql/parser_test.go1
1:1format
clients/pkg/logentry/logql/parser_test.go:1:1
package logql- Fix (safe): run `strider fmt clients/pkg/logentry/logql/parser_test.go`
clients/pkg/logentry/stages/json_test.go1
118:6function-length
clients/pkg/logentry/stages/json_test.go:118:6
func TestJSONConfig_validate(t *testing.T) { t.Parallel()pkg/dataobj/index/indexer_test.go1
325:26function-result-limit
pkg/dataobj/index/indexer_test.go:325:26
func (c *mockCalculator) Flush() (*dataobj.Object, io.Closer, []multitenancy.TimeRange, error) { c.flushCallCount++operator/internal/manifests/build_test.go1
495:3identical-switch-branches
operator/internal/manifests/build_test.go:495:3
lps = o.Spec.Template.Spec.Containers[0].LivenessProbe.HTTPGet.Scheme case *appsv1.StatefulSet: name = o.Nameclients/pkg/logentry/stages/labels_test.go1
16:2import-alias-naming
clients/pkg/logentry/stages/labels_test.go:16:2
util_log "github.com/grafana/loki/v3/pkg/util/log")cmd/loki-canary/main.go1
36:2import-shadowing
cmd/loki-canary/main.go:36:2
writer *writer.Writer reader *reader.Readerpkg/dataobj/consumer/multi_builder.go1
47:4inefficient-map-lookup
pkg/dataobj/consumer/multi_builder.go:47:4
if _, ok := streamsByTimeWindows[w]; !ok { streamsByTimeWindows[w] = logproto.Stream{ Labels: stream.Labels,pkg/compactor/retention/marker_test.go1
151:6inefficient-sprintf
pkg/compactor/retention/marker_test.go:151:6
return []string{ fmt.Sprintf("%d", now.Add(-48*time.Hour).UnixNano()), // oldest should be first fmt.Sprintf("%d", now.Add(-3*time.Hour).UnixNano()),operator/api/loki/v1beta1/lokistack_types_test.go1
221:25insecure-url-scheme
operator/api/loki/v1beta1/lokistack_types_test.go:221:25
IssuerURL: "http://go-to-issuer", RedirectURL: "http://bring-me-back", GroupClaim: "workgroups",pkg/logql/syntax/ast.go1
2491:19interface-method-limit
pkg/logql/syntax/ast.go:2491:19
//sumtype:decltype VariantsExpr interface { Extractors() ([]SampleExtractor, error)pkg/logql/syntax/linefilter.go1
40:7marshal-receiver
pkg/logql/syntax/linefilter.go:40:7
func (lf *LineFilter) Unmarshal(b []byte) error { buf := encoding.DecWith(b)pkg/chunkenc/memchunk_test.go1
940:8max-control-nesting
pkg/chunkenc/memchunk_test.go:940:8
entry.Line = testdata.LogString(i) if withStructuredMetadata { entry.StructuredMetadata = []logproto.LabelAdapter{pkg/engine/internal/proto/testutils/reflect.go1
24:6max-parameters
pkg/engine/internal/proto/testutils/reflect.go:24:6
// to its original value.func CheckEnumLookup[Proto, Native comparable]( t *testing.T,operator/api/loki/v1/alertingrule_types.go1
127:6max-public-structs
operator/api/loki/v1/alertingrule_types.go:127:6
// AlertingRuleList contains a list of AlertingRuletype AlertingRuleList struct { metav1.TypeMeta `json:",inline"`clients/pkg/logentry/stages/drop.go1
63:3modifies-parameter
clients/pkg/logentry/stages/drop.go:63:3
if cfg.DropReason == nil || *cfg.DropReason == "" { cfg.DropReason = &defaultDropReason }pkg/bloombuild/planner/versioned_range.go1
149:4modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:149:4
t[i+1] = tok t[i].through = bounds.Min - 1 return t, trueclients/pkg/logentry/logql/parser_test.go1
13:23nested-structs
clients/pkg/logentry/logql/parser_test.go:13:23
func TestLex(t *testing.T) { for _, tc := range []struct { input stringpkg/compactor/retention/retention.go1
572:4nil-error-return
pkg/compactor/retention/retention.go:572:4
// nothing to migrate return nil }pkg/bloombuild/protos/compat.go1
178:3nil-value-with-nil-error
pkg/bloombuild/protos/compat.go:178:3
if result == nil { return nil, nil }pkg/storage/chunk/client/ibmcloud/trusted_profile_authentication_provider_test.go1
66:4no-defer-in-loop
pkg/storage/chunk/client/ibmcloud/trusted_profile_authentication_provider_test.go:66:4
require.NoError(t, err) defer os.Remove(file.Name()) tt.crTokenFilePath = file.Name()pkg/compactor/table_test.go1
708:8no-else-after-return
pkg/compactor/table_test.go:708:8
return -1 } else if a.GetFrom() > b.GetFrom() { return 1operator/api/loki/v1beta1/lokistack_types.go1
828:6no-init
operator/api/loki/v1beta1/lokistack_types.go:828:6
func init() { SchemeBuilder.Register(&LokiStack{}, &LokiStackList{})pkg/dataobj/sections/indexpointers/reader.go1
295:2no-naked-return
pkg/dataobj/sections/indexpointers/reader.go:295:2
} return}clients/cmd/fluent-bit/out_grafana_loki.go1
26:2no-package-var
clients/cmd/fluent-bit/out_grafana_loki.go:26:2
// registered loki plugin instances, required for disposal during shutdown plugins []*loki logger log.Loggerpkg/compute/logical_bench_test.go1
47:5overwritten-before-use
pkg/compute/logical_bench_test.go:47:5
benchAlloc.Reclaim() result, err := compute.Or(benchAlloc, left, right, selection) if err != nil {clients/pkg/logentry/logql/ast.go1
1:9package-comments
clients/pkg/logentry/logql/ast.go:1:9
package logqlpkg/dataobj/compaction/v2/result_record_test.go1
1:9package-directory-mismatch
pkg/dataobj/compaction/v2/result_record_test.go:1:9
package compactionv2operator/api/loki/v1beta1/alertingrule_types.go1
194:15range-value-address
operator/api/loki/v1beta1/alertingrule_types.go:194:15
for j, r := range sRules { rules[j] = &AlertingRuleGroupSpec{ Alert: r.Alert,pkg/engine/metrics.go1
52:2redefines-builtin-id
pkg/engine/metrics.go:52:2
other *prometheus.HistogramVec // {query_type} close *prometheus.HistogramVec // {query_type}}clients/pkg/logentry/stages/structuredmetadata_test.go1
158:47redundant-conversion
clients/pkg/logentry/stages/structuredmetadata_test.go:158:47
expectedStructuredMetadata: push.LabelsAdapter{push.LabelAdapter{Name: "app", Value: "loki"}}, expectedLabels: model.LabelSet{model.LabelName("component"): model.LabelValue("ingester")}, },pkg/bloombuild/builder/batch.go1
17:2redundant-import-alias
pkg/bloombuild/builder/batch.go:17:2
logql_log "github.com/grafana/loki/v3/pkg/logql/log" v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1" "github.com/grafana/loki/v3/pkg/storage/chunk"pkg/engine/internal/planner/logical/logical.go1
123:3single-case-switch
pkg/engine/internal/planner/logical/logical.go:123:3
for _, inst := range p.Instructions { switch inst := inst.(type) { case *Return:pkg/compactor/deletion/delete_requests_store_boltdb.go1
471:6slice-preallocation
pkg/compactor/deletion/delete_requests_store_boltdb.go:471:6
cacheGenNums := map[string]string{} var userCacheGens []userCacheGen for _, shard := range shards {pkg/logcli/client/client.go1
538:30standard-http-method-constant
pkg/logcli/client/client.go:538:30
req, err := http.NewRequest("DELETE", us, nil) if err != nil {operator/internal/handlers/internal/gateway/gateway.go1
112:2task-comment
operator/internal/handlers/internal/gateway/gateway.go:112:2
// TODO(JoaoBraveCoding): Once we merge https://github.com/grafana/loki/pull/20325 we should rebase // and add a call to validateConfigRef to validate that the CA actually exists in the clusterclients/pkg/logentry/stages/drop.go1
143:1top-level-declaration-order
clients/pkg/logentry/stages/drop.go:143:1
// dropStage applies Label matchers to determine if the include stages should be runtype dropStage struct { logger log.Loggerclients/pkg/logentry/stages/pipeline_test.go1
202:68unchecked-type-assertion
clients/pkg/logentry/stages/pipeline_test.go:202:68
p, err := NewPipeline(util_log.Logger, config["pipeline_stages"].([]interface{}), nil, prometheus.DefaultRegisterer) require.NoError(t, err)pkg/logql/log/pattern/lexer.rl.go1
101unexported-naming
pkg/logql/log/pattern/lexer.rl.go:101
{ var _klen int var _trans intclients/pkg/logentry/stages/pipeline.go1
81:73unexported-return
clients/pkg/logentry/stages/pipeline.go:81:73
// RunWithSkip same as RunWith, except it skip sending it to output channel, if `process` functions returns `skip` true.func RunWithSkip(input chan Entry, process func(e Entry) (Entry, bool)) chan Entry { out := make(chan Entry)clients/pkg/logentry/stages/labelallow.go1
63:7unused-receiver
clients/pkg/logentry/stages/labelallow.go:63:7
// Name implements Stagefunc (l *labelAllowStage) Name() string { return StageTypeLabelAllowclients/cmd/fluent-bit/loki.go1
49:45use-any
clients/cmd/fluent-bit/loki.go:49:45
// sendRecord send fluentbit records to loki as an entry.func (l *loki) sendRecord(r map[interface{}]interface{}, ts time.Time) error { records := toStringMap(r)pkg/chunkenc/symbols.go1
404:18use-errors-new
pkg/chunkenc/symbols.go:404:18
if readBufValid == 0 { // Got EOF and no data in the buffer. return nil, fmt.Errorf("got unexpected EOF") }pkg/chunkenc/memchunk_test.go1
796:2use-slices-sort
pkg/chunkenc/memchunk_test.go:796:2
} sort.Slice(result, func(i, j int) bool { return result[i].ratio > result[j].ratiopkg/compression/pool.go1
40:2var-naming
pkg/compression/pool.go:40:2
// lz4_* are the lz4 compression pools lz4_64k = LZ4Pool{bufferSize: 1 << 16} // lz4_64k is the l4z compression pool, with 64k buffer size lz4_256k = LZ4Pool{bufferSize: 1 << 18} // lz4_256k uses 256k bufferclients/cmd/fluent-bit/config_test.go1
133:33add-constant
clients/cmd/fluent-bit/config_test.go:133:33
false}, {"bad url", map[string]string{"URL": "::doh.com"}, nil, true}, {"bad BatchWait", map[string]string{"BatchWait": "30sa"}, nil, true},clients/pkg/logentry/stages/drop.go1
50:6cognitive-complexity
clients/pkg/logentry/stages/drop.go:50:6
// validateDropConfig validates the DropConfig for the dropStagefunc validateDropConfig(cfg *DropConfig) error { if cfg == nil ||pkg/chunkenc/memchunk.go1
618:20confusing-naming
pkg/chunkenc/memchunk.go:618:20
// they were checkpointed (which would cause new blocks to be cut early).func (c *MemChunk) writeTo(w io.Writer, forCheckpoint bool) (int64, error) { crc32Hash := crc32HashPool.Get().(hash.Hash32)pkg/compactor/retention/retention.go1
147:151confusing-results
pkg/compactor/retention/retention.go:147:151
// FindAndMarkChunksForDeletion finds expired chunks using the ExpirationChecker from the given table and marks them for deletion.func (t *Marker) FindAndMarkChunksForDeletion(ctx context.Context, tableName, userID string, indexProcessor IndexProcessor, logger log.Logger) (bool, bool, error) { start := time.Now()pkg/compactor/retention/expiration.go1
52:6constructor-interface-return
pkg/compactor/retention/expiration.go:52:6
func NewExpirationChecker(limits Limits, r prometheus.Registerer) ExpirationChecker { return &expirationChecker{pkg/compactor/testutil.go1
222:2context-stored-in-struct
pkg/compactor/testutil.go:222:2
type tableCompactor struct { ctx context.Context commonIndexSet IndexSetclients/pkg/logentry/stages/json.go1
110:21cyclomatic-complexity
clients/pkg/logentry/stages/json.go:110:21
func (j *jsonStage) processEntry(extracted map[string]interface{}, entry *string) error { // If a source key is provided, the json stage should process itpkg/distributor/distributor_ring.go1
45:3deep-exit
pkg/distributor/distributor_ring.go:45:3
level.Error(util_log.Logger).Log("msg", "failed to get hostname", "err", err) os.Exit(1) }pkg/ingester/ingester.go1
1181:14deprecated-api-usage
pkg/ingester/ingester.go:1181:14
End: end, Selector: req.Selector, Shards: req.Shards,clients/cmd/docker-driver/http.go1
81:10discarded-error-result
clients/cmd/docker-driver/http.go:81:10
wf := ioutils.NewWriteFlusher(w) _, _ = io.Copy(wf, stream) })clients/pkg/logentry/metric/gauges.go1
133:1doc-comment-period
clients/pkg/logentry/metric/gauges.go:133:1
// HasExpired implements Expirablefunc (g *expiringGauge) HasExpired(currentTimeSec int64, maxAgeSec int64) bool {pkg/distributor/field_detection.go1
224:9early-return
pkg/distributor/field_detection.go:224:9
v = getLevelUsingJSONParser(lineBytes, l.allowedLevelLabelsMap, l.logLevelFromJSONMaxDepth) } else if isLogFmt(lineBytes) { v = getValueUsingLogfmtParser(lineBytes, l.allowedLevelLabels)operator/api/loki/v1/v1.go1
53:42error-strings
operator/api/loki/v1/v1.go:53:42
// ErrInvalidRecordMetricName when any loki recording rule has a invalid PromQL metric name. ErrInvalidRecordMetricName = errors.New("Failed to parse record metric name") // ErrParseAlertForPeriod when any loki alerting rule for period is not a valid PromQL duration.pkg/storage/chunk/cache/memcached_test.go1
50:4excessive-blank-identifiers
pkg/storage/chunk/cache/memcached_test.go:50:4
_, _, _, err = m.Fetch(ctx, keys) // will try to write to `intputChan` and shouldn't panic require.NoError(t, err)clients/pkg/logentry/logql/parser.go1
41:6exported-declaration-comment
clients/pkg/logentry/logql/parser.go:41:6
// anything else it will return an error.func ParseMatchers(input string) ([]*labels.Matcher, error) { expr, err := ParseExpr(input)operator/internal/handlers/internal/gateway/modes_test.go1
1:1file-length-limit
operator/internal/handlers/internal/gateway/modes_test.go:1:1
package gatewayoperator/internal/manifests/openshift/opa_openshift.go1
27:110flag-parameter
operator/internal/manifests/openshift/opa_openshift.go:27:110
func newOPAOpenShiftContainer(mode lokiv1.ModeType, secretVolumeName, tlsDir, minTLSVersion, ciphers string, withTLS bool, adminGroups []string) corev1.Container { var (clients/pkg/logentry/metric/counters.go1
1:1format
clients/pkg/logentry/metric/counters.go:1:1
package metric- Fix (safe): run `strider fmt clients/pkg/logentry/metric/counters.go`
clients/pkg/logentry/stages/json_test.go1
214:6function-length
clients/pkg/logentry/stages/json_test.go:214:6
func TestJSONParser_Parse(t *testing.T) { t.Parallel()pkg/dataobj/sections/logs/table_merge.go1
286:6function-result-limit
pkg/dataobj/sections/logs/table_merge.go:286:6
// valuesForRows returns the streamID and timestamp values from rows a and b.func valuesForRows(a, b dataset.Row) (aStreamID int64, bStreamID int64, aTimestamp int64, bTimestamp int64) { aStreamID = a.Values[0].Int64()operator/internal/manifests/build_test.go1
657:5identical-switch-branches
operator/internal/manifests/build_test.go:657:5
spec = &obj.Spec.Template.Spec case *appsv1.StatefulSet: name = obj.Nameclients/pkg/logentry/stages/limit_test.go1
12:2import-alias-naming
clients/pkg/logentry/stages/limit_test.go:12:2
util_log "github.com/grafana/loki/v3/pkg/util/log")cmd/loki-canary/main.go1
37:2import-shadowing
cmd/loki-canary/main.go:37:2
writer *writer.Writer reader *reader.Reader comparator *comparator.Comparatorpkg/dataobj/index/indexobj/builder.go1
138:3inefficient-map-lookup
pkg/dataobj/index/indexobj/builder.go:138:3
sb.SetTenant(tenantID) b.stats[tenantID] = sb }pkg/compactor/retention/marker_test.go1
152:6inefficient-sprintf
pkg/compactor/retention/marker_test.go:152:6
fmt.Sprintf("%d", now.Add(-48*time.Hour).UnixNano()), // oldest should be first fmt.Sprintf("%d", now.Add(-3*time.Hour).UnixNano()), fmt.Sprintf("%d", now.Add(-2*time.Hour).UnixNano()),operator/api/loki/v1beta1/lokistack_types_test.go1
233:25insecure-url-scheme
operator/api/loki/v1beta1/lokistack_types_test.go:233:25
}, IssuerURL: "http://go-to-issuer", RedirectURL: "http://bring-me-back",pkg/logql/syntax/visit.go1
7:18interface-method-limit
pkg/logql/syntax/visit.go:7:18
type RootVisitor interface { SampleExprVisitorpkg/push/types.go1
78:7marshal-receiver
pkg/push/types.go:78:7
// Should be kept in sync with Prometheus's labels.Labels implementation.func (ls *LabelsAdapter) UnmarshalJSON(b []byte) error { var m map[string]stringpkg/chunkenc/unordered_test.go1
250:9max-control-nesting
pkg/chunkenc/unordered_test.go:250:9
if !dup { // only set dup if it's not already true if tmpdup { // can't examine duplicates until we start getting all the data dup = truepkg/ingester/ingester.go1
313:6max-parameters
pkg/ingester/ingester.go:313:6
// New makes a new Ingester.func New(cfg Config, clientConfig client.Config, store Store, limits Limits, configs *runtime.TenantConfigs, registerer prometheus.Registerer, writeFailuresCfg writefailures.Cfg, metricsNamespace string, logger log.Logger, customStreamsTracker push.UsageTracker, readRing ring.ReadRing, partitionRingWatcher ring.PartitionRingReader) (*Ingester, error) { if cfg.ingesterClientFactory == nil {operator/api/loki/v1/lokistack_types.go1
155:6max-public-structs
operator/api/loki/v1/lokistack_types.go:155:6
// for a secret living in the same namespace as the LokiStack custom resource.type TenantSecretSpec struct { // Name of a secret in the namespace configured for tenant secrets.clients/pkg/logentry/stages/drop.go1
66:3modifies-parameter
clients/pkg/logentry/stages/drop.go:66:3
if cfg.Separator == nil { cfg.Separator = &defaultSeparator }pkg/bloombuild/planner/versioned_range.go1
159:4modifies-value-receiver
pkg/bloombuild/planner/versioned_range.go:159:4
if preExisting.Min == bounds.Min { t[i].version = version bounds.Min = preExisting.Max + 1clients/pkg/logentry/logql/parser_test.go1
48:23nested-structs
clients/pkg/logentry/logql/parser_test.go:48:23
func TestParse(t *testing.T) { for _, tc := range []struct { in stringpkg/compactor/tables_manager.go1
371:4nil-error-return
pkg/compactor/tables_manager.go:371:4
level.Error(util_log.Logger).Log("msg", "skipping compaction since we can't find schema for table", "table", tableName) return nil }pkg/bloomgateway/processor_test.go1
77:2nil-value-with-nil-error
pkg/bloomgateway/processor_test.go:77:2
func (s *dummyStore) Fetcher(_ model.Time) (*bloomshipper.Fetcher, error) { return nil, nil}pkg/storage/stores/shipper/indexshipper/tsdb/head_manager.go1
876:3no-defer-in-loop
pkg/storage/stores/shipper/indexshipper/tsdb/head_manager.go:876:3
t.locks[i].RLock() defer t.locks[i].RUnlock()pkg/compute/compute_test.go1
26:5no-else-after-return
pkg/compute/compute_test.go:26:5
return nil } else if filepath.Ext(d.Name()) != ".test" { return niloperator/api/loki/v1beta1/recordingrule_types.go1
112:6no-init
operator/api/loki/v1beta1/recordingrule_types.go:112:6
func init() { SchemeBuilder.Register(&RecordingRule{}, &RecordingRuleList{})pkg/dataobj/sections/logs/reader.go1
306:2no-naked-return
pkg/dataobj/sections/logs/reader.go:306:2
} return}clients/cmd/fluent-bit/out_grafana_loki.go1
27:2no-package-var
clients/cmd/fluent-bit/out_grafana_loki.go:27:2
plugins []*loki logger log.Logger)pkg/compute/logical_bench_test.go1
69:5overwritten-before-use
pkg/compute/logical_bench_test.go:69:5
benchAlloc.Reclaim() result, err := compute.Not(benchAlloc, input, selection) if err != nil {clients/pkg/logentry/logql/parser.go1
1:9package-comments
clients/pkg/logentry/logql/parser.go:1:9
package logqlpkg/engine/internal/scheduler/wire/arrow/arrow.go1
1:9package-directory-mismatch
pkg/engine/internal/scheduler/wire/arrow/arrow.go:1:9
package arrowcodecoperator/api/loki/v1beta1/alertingrule_types.go1
203:24range-value-address
operator/api/loki/v1beta1/alertingrule_types.go:203:24
dst.Spec.Groups[i] = &AlertingRuleGroup{ Name: g.Name,pkg/ingester/chunk_test.go1
49:3redefines-builtin-id
pkg/ingester/chunk_test.go:49:3
name string new func() chunkenc.Chunk }{clients/pkg/logentry/stages/structuredmetadata_test.go1
158:77redundant-conversion
clients/pkg/logentry/stages/structuredmetadata_test.go:158:77
expectedStructuredMetadata: push.LabelsAdapter{push.LabelAdapter{Name: "app", Value: "loki"}}, expectedLabels: model.LabelSet{model.LabelName("component"): model.LabelValue("ingester")}, },pkg/bloombuild/builder/batch_test.go1
11:2redundant-import-alias
pkg/bloombuild/builder/batch_test.go:11:2
v2 "github.com/grafana/loki/v3/pkg/iter/v2" v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1"pkg/engine/internal/planner/logical/planner.go1
402:2single-case-switch
pkg/engine/internal/planner/logical/planner.go:402:2
switch e.Operation { // case syntax.OpRangeTypeBytesRate:pkg/compactor/deletion/job_builder.go1
278:6slice-preallocation
pkg/compactor/deletion/job_builder.go:278:6
// Filter for manifest directories (they are named with Unix timestamps) var manifests []string for _, commonPrefix := range commonPrefixes {pkg/loki/format_query_handler_test.go1
40:32standard-http-method-constant
pkg/loki/format_query_handler_test.go:40:32
t.Run(tc.name, func(t *testing.T) { req, err := http.NewRequest("GET", fmt.Sprintf("http://localhost:808?query=%s", tc.query), nil) require.NoError(t, err)operator/internal/manifests/compactor.go1
171:8task-comment
operator/internal/manifests/compactor.go:171:8
AccessModes: []corev1.PersistentVolumeAccessMode{ // TODO: should we verify that this is possible with the given storage class first? corev1.ReadWriteOnce,clients/pkg/logentry/stages/drop_test.go1
444:1top-level-declaration-order
clients/pkg/logentry/stages/drop_test.go:444:1
var ( dropInvalidDur = "10y"clients/pkg/logentry/stages/pipeline_test.go1
275:66unchecked-type-assertion
clients/pkg/logentry/stages/pipeline_test.go:275:66
} p, err := NewPipeline(util_log.Logger, config["pipeline_stages"].([]interface{}), nil, prometheus.DefaultRegisterer) if err != nil {pkg/logql/log/pattern/lexer.rl.go1
102unexported-naming
pkg/logql/log/pattern/lexer.rl.go:102
var _klen int var _trans int var _acts intclients/pkg/logentry/stages/pipeline.go1
98:85unexported-return
clients/pkg/logentry/stages/pipeline.go:98:85
// RunWithSkiporSendMany same as RunWithSkip, except it can either skip sending it to output channel, if `process` functions returns `skip` true. Or send many entries.func RunWithSkipOrSendMany(input chan Entry, process func(e Entry) ([]Entry, bool)) chan Entry { out := make(chan Entry)clients/pkg/logentry/stages/labeldrop.go1
56:7unused-receiver
clients/pkg/logentry/stages/labeldrop.go:56:7
// Name implements Stagefunc (l *labelDropStage) Name() string { return StageTypeLabelDropclients/cmd/fluent-bit/loki.go1
95:28use-any
clients/cmd/fluent-bit/loki.go:95:28
// converting them to stringsfunc toStringSlice(slice []interface{}) []interface{} { var s []interface{}pkg/chunkenc/symbols.go1
407:18use-errors-new
pkg/chunkenc/symbols.go:407:18
if readBufValid == lastAttempt { // Got EOF and could not parse same data last time. return nil, fmt.Errorf("invalid structured metadata block in chunk") }pkg/compactor/compactor.go1
635:2use-slices-sort
pkg/compactor/compactor.go:635:2
sort.Slice(tables, func(i, j int) bool { // less than if start time is after produces a most recent first sort orderpkg/compression/pool.go1
41:2var-naming
pkg/compression/pool.go:41:2
lz4_64k = LZ4Pool{bufferSize: 1 << 16} // lz4_64k is the l4z compression pool, with 64k buffer size lz4_256k = LZ4Pool{bufferSize: 1 << 18} // lz4_256k uses 256k buffer lz4_1M = LZ4Pool{bufferSize: 1 << 20} // lz4_1M uses 1M bufferclients/cmd/fluent-bit/config_test.go1
134:39add-constant
clients/cmd/fluent-bit/config_test.go:134:39
{"bad url", map[string]string{"URL": "::doh.com"}, nil, true}, {"bad BatchWait", map[string]string{"BatchWait": "30sa"}, nil, true}, {"bad BatchSize", map[string]string{"BatchSize": "a"}, nil, true},clients/pkg/logentry/stages/drop.go1
164:21cognitive-complexity
clients/pkg/logentry/stages/drop.go:164:21
func (m *dropStage) shouldDrop(e Entry) bool { // There are many options for dropping a log and if multiple are defined it's treated like an AND conditionpkg/chunkenc/memchunk.go1
1294:16confusing-naming
pkg/chunkenc/memchunk.go:1294:16
func (b block) Offset() int { return b.offsetpkg/compactor/retention/retention.go1
164:132confusing-results
pkg/compactor/retention/retention.go:164:132
func (t *Marker) markTable(ctx context.Context, tableName, userID string, indexProcessor IndexProcessor, logger log.Logger) (bool, bool, error) { markerWriter, err := NewMarkerWriter(t.markerStorageClient)pkg/compactor/retention/marker.go1
49:6constructor-interface-return
pkg/compactor/retention/marker.go:49:6
func NewMarkerWriter(markerStorageClient client.ObjectClient) (MarkerStorageWriter, error) { msw := &markerStorageWriter{pkg/dataobj/index/indexer.go1
31:2context-stored-in-struct
pkg/dataobj/index/indexer.go:31:2
trigger triggerType ctx context.Context resultChan chan buildResultclients/pkg/logentry/stages/logfmt.go1
96:23cyclomatic-complexity
clients/pkg/logentry/stages/logfmt.go:96:23
// Process implements Stagefunc (j *logfmtStage) Process(_ model.LabelSet, extracted map[string]interface{}, _ *time.Time, entry *string) { // If a source key is provided, the logfmt stage should process itpkg/logcli/detected/fields.go1
45:3deep-exit
pkg/logcli/detected/fields.go:45:3
if err != nil { log.Fatalf("Error doing request: %+v", err) }pkg/ingester/ingester.go1
1399:6deprecated-api-usage
pkg/ingester/ingester.go:1399:6
QueryRequest: &logproto.QueryRequest{ Selector: group, Limit: 1,clients/cmd/docker-driver/http.go1
94:6discarded-error-result
clients/cmd/docker-driver/http.go:94:6
} _ = json.NewEncoder(w).Encode(&res)}clients/pkg/logentry/metric/histograms.go1
76:1doc-comment-period
clients/pkg/logentry/metric/histograms.go:76:1
// HasExpired implements Expirablefunc (h *expiringHistogram) HasExpired(currentTimeSec int64, maxAgeSec int64) bool {pkg/engine/internal/workflow/workflow_planner.go1
331:4early-return
pkg/engine/internal/workflow/workflow_planner.go:331:4
if err != nil { if errors.Is(err, context.DeadlineExceeded) { level.Debug(logger).Log(