mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 00:15:44 +00:00
Add reasons to all staticcheck suppressions
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
This commit is contained in:
parent
d222b0ae07
commit
b294a92a25
11 changed files with 26 additions and 33 deletions
|
|
@ -328,7 +328,7 @@ func (s *BoltState) getVolumeFromDB(name []byte, volume *Volume, volBkt *bolt.Bu
|
|||
// ocicniPortsToNetTypesPorts convert the old port format to the new one
|
||||
// while deduplicating ports into ranges
|
||||
//
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // OCICNIPortMapping is deprecated; kept for backwards-compatible DB migration
|
||||
func ocicniPortsToNetTypesPorts(ports []types.OCICNIPortMapping) []types.PortMapping {
|
||||
if len(ports) == 0 {
|
||||
return nil
|
||||
|
|
@ -377,7 +377,7 @@ func ocicniPortsToNetTypesPorts(ports []types.OCICNIPortMapping) []types.PortMap
|
|||
// 3) hostPort
|
||||
// 4) container port
|
||||
//
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // OCICNIPortMapping is deprecated; kept for backwards-compatible DB migration
|
||||
func compareOCICNIPorts(i, j types.OCICNIPortMapping) bool {
|
||||
if i.HostIP != j.HostIP {
|
||||
return i.HostIP < j.HostIP
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ type ContainerNetworkConfig struct {
|
|||
// namespace. As of podman 4.0 this field is deprecated, use PortMappings
|
||||
// instead. The db will convert the old ports to the new structure for you.
|
||||
// These are not used unless CreateNetNS is true
|
||||
OldPortMappings []types.OCICNIPortMapping `json:"portMappings,omitempty"` //nolint:staticcheck
|
||||
OldPortMappings []types.OCICNIPortMapping `json:"portMappings,omitempty"` //nolint:staticcheck // OCICNIPortMapping is deprecated but kept for backwards-compatible DB migration
|
||||
// ExposedPorts are the ports which are exposed but not forwarded
|
||||
// into the container.
|
||||
// The map key is the port and the string slice contains the protocols,
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ func WaitContainer(w http.ResponseWriter, r *http.Request) {
|
|||
utils.WaitContainerDocker(w, r)
|
||||
}
|
||||
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // LegacyNetworkSettings is deprecated but kept for Docker API compat < v1.52
|
||||
func convertSecondaryIPPrefixLen(input *define.InspectNetworkSettings, output *handlers.LegacyNetworkSettings) {
|
||||
for index, ip := range input.SecondaryIPAddresses {
|
||||
output.SecondaryIPAddresses[index].PrefixLen = ip.PrefixLength
|
||||
|
|
@ -485,7 +485,7 @@ func LibpodToContainer(l *libpod.Container, sz bool, includeHealth bool) (*handl
|
|||
}, nil
|
||||
}
|
||||
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // LegacyImageInspect is deprecated but kept for Docker API compat < v1.52
|
||||
func LibpodToContainerJSON(l *libpod.Container, sz bool) (*handlers.LegacyImageInspect, error) {
|
||||
imageID, imageName := l.Image()
|
||||
inspect, err := l.Inspect(sz)
|
||||
|
|
@ -588,7 +588,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*handlers.LegacyImageI
|
|||
Data: inspect.GraphDriver.Data,
|
||||
}
|
||||
|
||||
cb := handlers.LegacyImageInspect{ //nolint:staticcheck
|
||||
cb := handlers.LegacyImageInspect{ //nolint:staticcheck // LegacyImageInspect is deprecated but kept for Docker API compat < v1.52
|
||||
InspectResponse: container.InspectResponse{
|
||||
ID: l.ID(),
|
||||
Created: l.CreatedTime().UTC().Format(time.RFC3339Nano), // Docker uses UTC
|
||||
|
|
@ -702,7 +702,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*handlers.LegacyImageI
|
|||
return nil, err
|
||||
}
|
||||
|
||||
networkSettings := handlers.LegacyNetworkSettings{} //nolint:staticcheck
|
||||
networkSettings := handlers.LegacyNetworkSettings{} //nolint:staticcheck // LegacyNetworkSettings is deprecated but kept for Docker API compat < v1.52
|
||||
if err := json.Unmarshal(n, &networkSettings); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,24 +98,20 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
|
|||
// Handle these differences for Docker-compat.
|
||||
if !utils.IsLibpodRequest(r) && e.Type == "image" && e.Action == "remove" {
|
||||
// Status is deprecated, but we still like to set it for consumers that might use it.
|
||||
//nolint:staticcheck,nolintlint // we run the linter several times and sometimes it
|
||||
// complains about this and sometimes it doesn't thus the nolintlint
|
||||
e.Status = "delete"
|
||||
e.Status = "delete" //nolint:staticcheck // deprecated field
|
||||
e.Action = "delete"
|
||||
}
|
||||
if !utils.IsLibpodRequest(r) && e.Action == "died" {
|
||||
//nolint:staticcheck,nolintlint // we run the linter several times and sometimes it
|
||||
// complains about this and sometimes it doesn't thus the nolintlint
|
||||
e.Status = "die"
|
||||
e.Status = "die" //nolint:staticcheck // deprecated field
|
||||
e.Action = "die"
|
||||
e.Actor.Attributes["exitCode"] = e.Actor.Attributes["containerExitCode"]
|
||||
}
|
||||
|
||||
// Remove fields which are not set in 1.52 and newer.
|
||||
if _, err := apiutil.SupportedVersion(r, ">=1.52.0"); err == nil && !apiutil.IsLibpodRequest(r) {
|
||||
e.Status = "" //nolint:staticcheck
|
||||
e.ID = "" //nolint:staticcheck
|
||||
e.From = "" //nolint:staticcheck
|
||||
e.Status = "" //nolint:staticcheck // deprecated field, cleared for API >= 1.52
|
||||
e.ID = "" //nolint:staticcheck // deprecated field, cleared for API >= 1.52
|
||||
e.From = "" //nolint:staticcheck // deprecated field, cleared for API >= 1.52
|
||||
}
|
||||
|
||||
if err := coder.Encode(e); err != nil {
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
loop: // break out of for/select infinite loop
|
||||
for {
|
||||
var report handlers.LegacyJSONMessage //nolint:staticcheck
|
||||
var report handlers.LegacyJSONMessage //nolint:staticcheck // LegacyJSONMessage is deprecated but kept for Docker API compat < v1.52
|
||||
|
||||
select {
|
||||
case e := <-options.Progress:
|
||||
|
|
@ -204,9 +204,8 @@ loop: // break out of for/select infinite loop
|
|||
report.Error = &jsonstream.Error{
|
||||
Message: msg,
|
||||
}
|
||||
//nolint:staticcheck // Deprecated field, but because consumers might still read it keep it.
|
||||
if _, err := apiutil.SupportedVersion(r, "<1.52.0"); err == nil {
|
||||
report.ErrorMessage = msg
|
||||
report.ErrorMessage = msg //nolint:staticcheck // deprecated field
|
||||
}
|
||||
if err := enc.Encode(report); err != nil {
|
||||
logrus.Warnf("Failed to json encode error %q", err.Error())
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ func GetDiskUsage(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
utils.WriteResponse(w, http.StatusOK, handlers.LegacyDiskUsage{ //nolint:staticcheck
|
||||
utils.WriteResponse(w, http.StatusOK, handlers.LegacyDiskUsage{ //nolint:staticcheck // LegacyDiskUsage is deprecated but kept for Docker API compat < v1.52
|
||||
LayersSize: df.ImagesSize,
|
||||
Images: legacy,
|
||||
Containers: ctnrs,
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ func CompatPull(r *http.Request, w http.ResponseWriter, runtime *libpod.Runtime,
|
|||
|
||||
loop: // break out of for/select infinite loop
|
||||
for {
|
||||
report := handlers.LegacyJSONMessage{} //nolint:staticcheck
|
||||
report := handlers.LegacyJSONMessage{} //nolint:staticcheck // LegacyJSONMessage is deprecated but kept for Docker API compat < v1.52
|
||||
report.Progress = &jsonstream.Progress{}
|
||||
select {
|
||||
case e := <-progress:
|
||||
|
|
@ -251,9 +251,8 @@ loop: // break out of for/select infinite loop
|
|||
report.Error = &jsonstream.Error{
|
||||
Message: msg,
|
||||
}
|
||||
//nolint:staticcheck // Deprecated field, but because consumers might still read it keep it.
|
||||
if _, err := apiutil.SupportedVersion(r, "<1.52.0"); err == nil {
|
||||
report.ErrorMessage = msg
|
||||
report.ErrorMessage = msg //nolint:staticcheck // deprecated field
|
||||
}
|
||||
} else {
|
||||
pulledImages := pullRes.images
|
||||
|
|
@ -266,9 +265,8 @@ loop: // break out of for/select infinite loop
|
|||
report.Error = &jsonstream.Error{
|
||||
Message: msg,
|
||||
}
|
||||
//nolint:staticcheck // Deprecated field, but because consumers might still read it keep it.
|
||||
if _, err := apiutil.SupportedVersion(r, "<1.52.0"); err == nil {
|
||||
report.ErrorMessage = msg
|
||||
report.ErrorMessage = msg //nolint:staticcheck // deprecated field
|
||||
}
|
||||
writeStatusCode(http.StatusInternalServerError)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1185,7 +1185,7 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
|
|||
// If name is absolute path, then it has to be containerfile outside of build context.
|
||||
// If not, we should check it for being excluded via pattern matcher.
|
||||
if !filepath.IsAbs(name) {
|
||||
excluded, err := pm.Matches(name) //nolint:staticcheck
|
||||
excluded, err := pm.Matches(name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("checking if %q is excluded: %w", name, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ func parseApplyInput(arg string) (string, string, error) {
|
|||
}
|
||||
|
||||
imagePath := imgRef.StringWithinTransport()
|
||||
if transportName == ociTransport { //nolint:staticcheck
|
||||
if transportName == ociTransport {
|
||||
// oci:/tmp/oci-image
|
||||
imagePath, _, _ = strings.Cut(imagePath, ":")
|
||||
} else if transportName == ociArchiveTransport {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func InitializeSeccompPaths(annotations map[string]string, profileRoot string) (
|
|||
// check if it is prefaced with container.seccomp.security.alpha.kubernetes.io/
|
||||
prefixAndCtr := strings.Split(annKeyValue, "/")
|
||||
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // deprecated k8s annotation constant
|
||||
if prefixAndCtr[0]+"/" != v1.SeccompContainerAnnotationKeyPrefix {
|
||||
continue
|
||||
} else if len(prefixAndCtr) != 2 {
|
||||
|
|
@ -55,7 +55,7 @@ func InitializeSeccompPaths(annotations map[string]string, profileRoot string) (
|
|||
seccompPaths.containerPaths[prefixAndCtr[1]] = path
|
||||
}
|
||||
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // deprecated k8s annotation constant
|
||||
podSeccomp, ok := annotations[v1.SeccompPodAnnotationKey]
|
||||
if ok {
|
||||
seccompPaths.podPath, err = verifySeccompPath(podSeccomp, profileRoot)
|
||||
|
|
@ -74,11 +74,11 @@ func InitializeSeccompPaths(annotations map[string]string, profileRoot string) (
|
|||
func verifySeccompPath(path string, profileRoot string) (string, error) {
|
||||
switch path {
|
||||
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // deprecated k8s seccomp constant
|
||||
case v1.DeprecatedSeccompProfileDockerDefault:
|
||||
fallthrough
|
||||
// FIXME: Rework for deprecation removal https://github.com/containers/podman/issues/27501
|
||||
//nolint:staticcheck
|
||||
//nolint:staticcheck // deprecated k8s seccomp constant
|
||||
case v1.SeccompProfileRuntimeDefault:
|
||||
return libpod.DefaultSeccompPath()
|
||||
case "unconfined":
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2" //nolint:staticcheck
|
||||
. "github.com/onsi/gomega" //nolint:staticcheck
|
||||
. "github.com/onsi/ginkgo/v2" //nolint:staticcheck // ST1001: should not use dot imports
|
||||
. "github.com/onsi/gomega" //nolint:staticcheck // ST1001: should not use dot imports
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue