Showing 1,468 of 1,914 total issues
Function Parse
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func Parse(filePath string, objName string) (*ParsedPkg, error) {
fs := token.NewFileSet()
pkg, err := parser.ParseFile(fs, filePath, nil, parser.AllErrors)
if err != nil {
return nil, err
Method Daemon.containerStop
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Container, options containertypes.StopOptions) (retErr error) {
// Cancelling the request should not cancel the stop.
ctx = context.WithoutCancel(ctx)
if !ctr.IsRunning() {
Method Plugin.Set
has 14 return statements (exceeds 4 allowed). Open
Open
func (p *Plugin) Set(args []string) error {
p.mu.Lock()
defer p.mu.Unlock()
if p.PluginObj.Enabled {
Method driver.Join
has 14 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.macvlan.Join", trace.WithAttributes(
attribute.String("nid", nid),
attribute.String("eid", eid),
attribute.String("sboxKey", sboxKey)))
Method ImageService.resolveAllReferences
has 14 return statements (exceeds 4 allowed). Open
Open
func (i *ImageService) resolveAllReferences(ctx context.Context, refOrID string) (*containerdimages.Image, []containerdimages.Image, error) {
parsed, err := reference.ParseAnyReference(refOrID)
if err != nil {
return nil, nil, errdefs.InvalidParameter(err)
}
Method client.createWindows
has 14 return statements (exceeds 4 allowed). Open
Open
func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions interface{}) (*container, error) {
logger := c.logger.WithField("container", id)
configuration := &hcsshim.ContainerConfig{
SystemType: "Container",
Name: id,
Method ImageService.resolveImage
has 14 return statements (exceeds 4 allowed). Open
Open
func (i *ImageService) resolveImage(ctx context.Context, refOrID string) (containerdimages.Image, error) {
parsed, err := reference.ParseAnyReference(refOrID)
if err != nil {
return containerdimages.Image{}, errdefs.InvalidParameter(err)
}
Method ImageService.LoadImage
has 14 return statements (exceeds 4 allowed). Open
Open
func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, platform *ocispec.Platform, outStream io.Writer, quiet bool) error {
decompressed, err := dockerarchive.DecompressStream(inTar)
if err != nil {
return errors.Wrap(err, "failed to decompress input tar archive")
}
Method ImageService.ExportImage
has 14 return statements (exceeds 4 allowed). Open
Open
func (i *ImageService) ExportImage(ctx context.Context, names []string, platform *ocispec.Platform, outStream io.Writer) error {
pm := i.matchRequestedOrDefault(platforms.OnlyStrict, platform)
opts := []archive.ExportOpt{
archive.WithSkipNonDistributableBlobs(),
Method Daemon.openContainerFS
has 14 return statements (exceeds 4 allowed). Open
Open
func (daemon *Daemon) openContainerFS(ctr *container.Container) (_ *containerFSView, retErr error) {
ctx := context.TODO()
if err := daemon.Mount(ctr); err != nil {
return nil, err
Function New
has 14 return statements (exceeds 4 allowed). Open
Open
func New(info logger.Info) (logger.Logger, error) {
hostname, err := info.Hostname()
if err != nil {
return nil, fmt.Errorf("%s: cannot access hostname to set source field", driverName)
}
Method Daemon.ContainerRename
has 14 return statements (exceeds 4 allowed). Open
Open
func (daemon *Daemon) ContainerRename(oldName, newName string) (retErr error) {
if oldName == "" || newName == "" {
return errdefs.InvalidParameter(errors.New("Neither old nor new names may be empty"))
}
Method pushDescriptor.layerAlreadyExists
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (pd *pushDescriptor) layerAlreadyExists(
ctx context.Context,
progressOutput progress.Output,
diffID layer.DiffID,
checkOtherRepositories bool,
Method Controller.reservePools
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *Controller) reservePools() {
networks, err := c.getNetworks()
if err != nil {
log.G(context.TODO()).Warnf("Could not retrieve networks from local store during ipam allocation for existing networks: %v", err)
return
Method Controller.addServiceBinding
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *Controller) addServiceBinding(svcName, svcID, nID, eID, containerName string, vip net.IP, ingressPorts []*PortConfig, serviceAliases, taskAliases []string, ip net.IP, method string) error {
var addService bool
// Failure to lock the network ID on add can result in racing
// against network deletion resulting in inconsistent state
Method NetworkDB.gossip
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (nDB *NetworkDB) gossip() {
networkNodes := make(map[string][]string)
nDB.RLock()
thisNodeNetworks := nDB.networks[nDB.config.NodeID]
for nid := range thisNodeNetworks {
Method Reader.TestConcurrent
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (tr Reader) TestConcurrent(t *testing.T) {
t.Parallel()
l := tr.Factory(t, logger.Info{
ContainerID: "logconcurrent0",
ContainerName: "logconcurrent123",
Method ImageService.ImageHistory
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (i *ImageService) ImageHistory(ctx context.Context, name string, platform *ocispec.Platform) ([]*image.HistoryResponseItem, error) {
start := time.Now()
img, err := i.GetImage(ctx, name, backend.GetImageOpts{Platform: platform})
if err != nil {
return nil, err
Method LayerUploadManager.makeUploadFunc
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (lum *LayerUploadManager) makeUploadFunc(descriptor UploadDescriptor) doFunc {
return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) transfer {
u := &uploadTransfer{
transfer: newTransfer(),
}
Method Resolver.setupIPTable
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *Resolver) setupIPTable() error {
if r.err != nil {
return r.err
}
laddr := r.conn.LocalAddr().String()