{"record":{"id":"5e829395bef369c1","repo":"slimtoolkit/slim","slug":"bad-params","errorCode":null,"errorMessage":"bad params","messagePattern":"bad params","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/docker/linter/linter.go","lineNumber":18,"sourceCode":"// Package linter implements a Dockerfile linter\npackage linter\n\nimport (\n\t\"errors\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/slimtoolkit/slim/pkg/docker/dockerfile/parser\"\n\t\"github.com/slimtoolkit/slim/pkg/docker/dockerfile/spec\"\n\t\"github.com/slimtoolkit/slim/pkg/docker/dockerignore\"\n\t\"github.com/slimtoolkit/slim/pkg/docker/linter/check\"\n\n\tlog \"github.com/sirupsen/logrus\"\n)\n\nvar (\n\tErrBadParams = errors.New(\"bad params\")\n)\n\nconst (\n\tDockerfileTargetType = \"dockerfile\"\n\tImageTargetType      = \"image\"\n)\n\n//TODO:\n//* support incremental, partial and instruction level linting\n//* support linting from string\n\ntype Options struct {\n\tDockerfilePath   string\n\tDockerfile       *spec.Dockerfile\n\tSkipBuildContext bool\n\tBuildContextDir  string\n\tSkipDockerignore bool //to disable .dockerignore parsing\n\tDockerignore     *dockerignore.Matcher","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/docker/linter/linter.go#L1-L36","documentation":"ErrBadParams is returned by the linter package's Execute when required inputs are missing or inconsistent. Execute needs a valid target (a Dockerfile path or an image reference) and rejects calls where neither/both are supplied correctly. It signals misuse of the linter API rather than a lint finding.","triggerScenarios":"Calling linter Execute with an empty target type, empty target reference, or an unsupported target type; missing the Dockerfile path or image name fields in the options.","commonSituations":"CLI flag not propagated into the linter options struct; config file missing the target key; refactoring changed the target-type constant names ('dockerfile' vs 'image').","solutions":["Ensure Execute options include a non-empty target and a supported type (DockerfileTargetType or ImageTargetType).","Log the constructed options struct right before Execute to spot empty fields.","Wire the CLI/config target flags into the linter options explicitly.","Add a guard test asserting ErrBadParams for empty-target invocations."],"exampleFix":"// before\nlinter.Execute(ctx, nil) // missing target\n// after\nopts := &linter.Options{TargetType: linter.DockerfileTargetType, Target: \"./Dockerfile\"}\nerr := linter.Execute(ctx, opts)","handlingStrategy":"validation","validationCode":"if opts == nil || opts.Target == \"\" ||\n   (opts.TargetType != linter.DockerfileTargetType && opts.TargetType != linter.ImageTargetType) {\n    return linter.ErrBadParams\n}","typeGuard":null,"tryCatchPattern":"err := lnkr.Execute(ctx, opts)\nif errors.Is(err, linter.ErrBadParams) {\n    return fmt.Errorf(\"linter target misconfigured: %+v\", opts)\n}","preventionTips":["Construct linter options via a single validated factory.","Use the package's DockerfileTargetType/ImageTargetType constants, not raw strings.","Assert options completeness in unit tests before Execute.","Log the options struct on failure for fast diagnosis."],"tags":["linter","parameters","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}