Showing 1,468 of 1,914 total issues
Method linuxParser.validateMountConfigImpl
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSourceExists bool) error {
if len(mnt.Target) == 0 {
return &errMountConfig{mnt, errMissingField("Target")}
}
Method controller.Start
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *controller) Start(ctx context.Context) error {
if err := r.checkClosed(); err != nil {
return err
}
Function FilterNetworks
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func FilterNetworks(nws []network.Inspect, filter filters.Args) ([]network.Inspect, error) {
// if filter is empty, return original network list
if filter.Len() == 0 {
return nws, nil
}
Method layerStore.RegisterByGraphID
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (ls *layerStore) RegisterByGraphID(graphID string, parent ChainID, diffID DiffID, tarDataFile string, size int64) (Layer, error) {
// err is used to hold the error which will always trigger
// cleanup of creates sources but may not be an error returned
// to the caller (already exists).
var err error
Method puller.pullSchema2Layers
has 18 return statements (exceeds 4 allowed). Open
Open
func (p *puller) pullSchema2Layers(ctx context.Context, target distribution.Descriptor, layers []distribution.Descriptor, platform *ocispec.Platform) (id digest.Digest, err error) {
if _, err := p.config.ImageStore.Get(ctx, target.Digest); err == nil {
// If the image already exists locally, no need to pull
// anything.
return target.Digest, nil
Method Endpoint.sbJoin
has 18 return statements (exceeds 4 allowed). Open
Open
func (ep *Endpoint) sbJoin(ctx context.Context, sb *Sandbox, options ...EndpointOption) (retErr error) {
ctx, span := otel.Tracer("").Start(ctx, "libnetwork.sbJoin")
defer span.End()
n, err := ep.getNetworkFromStore()
Method GossipMessage.Unmarshal
has 18 return statements (exceeds 4 allowed). Open
Open
func (m *GossipMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
Method driver.Join
has 18 return statements (exceeds 4 allowed). Open
Open
func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.ipvlan.Join", trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),
attribute.String("sboxKey", sboxKey)))
Method puller.pullManifestList
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfstList *manifestlist.DeserializedManifestList, pp *ocispec.Platform) (id digest.Digest, manifestListDigest digest.Digest, err error) {
manifestListDigest, err = schema2ManifestDigest(ref, mfstList)
if err != nil {
return "", "", err
}
Method cnmNetworkAllocator.allocatePools
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (na *cnmNetworkAllocator) allocatePools(n *api.Network) (map[string]string, error) {
ipam, dName, dOptions, err := na.resolveIPAM(n)
if err != nil {
return nil, err
}
Function normalizeLayersAndHistory
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func normalizeLayersAndHistory(diffs []digest.Digest, history []ocispec.History, ref cache.ImmutableRef) ([]digest.Digest, []ocispec.History) {
refMeta := getRefMetadata(ref, len(diffs))
var historyLayers int
for _, h := range history {
if !h.EmptyLayer {
Method containerRouter.postContainerExecStart
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *containerRouter) postContainerExecStart(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
if err := httputils.ParseForm(r); err != nil {
return err
}
Method nodeRunner.start
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (n *nodeRunner) start(conf nodeStartConfig) error {
var control string
if isWindows {
control = `\\.\pipe\` + controlSocket
} else {
Method Daemon.cleanupContainer
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (daemon *Daemon) cleanupContainer(container *container.Container, config backend.ContainerRmConfig) error {
if container.IsRunning() {
if !config.ForceRemove {
if state := container.StateString(); state == "paused" {
return errdefs.Conflict(fmt.Errorf("cannot remove container %q: container is %s and must be unpaused first", container.Name, state))
Method Daemon.containerExtractToDir
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (daemon *Daemon) containerExtractToDir(container *container.Container, path string, copyUIDGID, noOverwriteDirNonDir bool, content io.Reader) (err error) {
container.Lock()
defer container.Unlock()
// Make sure an online file-system operation is permitted.
Method ImageService.SquashImage
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (i *ImageService) SquashImage(id, parent string) (string, error) {
var (
img *image.Image
err error
)
Function changes
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func changes(layers []string, rw string, dc deleteChange, sc skipChange) ([]Change, error) {
var (
changes []Change
changedDirs = make(map[string]struct{})
)
Method LayerDownloadManager.makeDownloadFuncFromDownload
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer) doFunc {
return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) transfer {
d := &downloadTransfer{
transfer: newTransfer(),
layerStore: ldm.layerStore,
Method NetworkDB.clusterInit
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (nDB *NetworkDB) clusterInit() error {
nDB.lastStatsTimestamp = time.Now()
nDB.lastHealthTimestamp = nDB.lastStatsTimestamp
config := memberlist.DefaultLANConfig()
Function NodeFromGRPC
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func NodeFromGRPC(n swarmapi.Node) types.Node {
node := types.Node{
ID: n.ID,
Spec: types.NodeSpec{
Role: types.NodeRole(strings.ToLower(n.Spec.DesiredRole.String())),