Showing 28 of 59 total issues
Method LRPToStatefulSet.Convert
has 135 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *LRPToStatefulSet) Convert(statefulSetName string, lrp *api.LRP, privateRegistrySecret *corev1.Secret) (*appsv1.StatefulSet, error) { envs := shared.MapToEnvVar(lrp.Env) fieldEnvs := []corev1.EnvVar{ { Name: eirini.EnvPodName,
Function main
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func main() { var opts options _, err := flags.ParseArgs(&opts, os.Args) cmdcommons.ExitfIfError(err, "Failed to parse args")
Method APIConverter.ConvertLRP
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *APIConverter) ConvertLRP(request cf.DesireLRPRequest) (api.LRP, error) { env := map[string]string{ "LANG": "en_US.UTF-8", }
Function NewLRPClient
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger, secrets SecretsClient, statefulSets StatefulSetClient, pods PodClient, pdbClient PodDisruptionBudgetClient,
Function NewReconciler
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger, podClient client.Client, jobsClient JobsClient, podUpdater PodsClient, reporter Reporter,
Method Reconciler.Reconcile
has 10 return statements (exceeds 4 allowed). Open
Open
func (r Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { logger := r.logger.Session("task-completion-reconciler", lager.Data{"namespace": request.Namespace, "pod-name": request.Name}) pod := &corev1.Pod{} if err := r.runtimeClient.Get(ctx, request.NamespacedName, pod); err != nil {
Method Desirer.Desire
has 9 return statements (exceeds 4 allowed). Open
Open
func (d *Desirer) Desire(ctx context.Context, namespace string, lrp *api.LRP, opts ...shared.Option) error { logger := d.logger.Session("desire", lager.Data{"guid": lrp.GUID, "version": lrp.Version, "namespace": namespace}) statefulSetName, err := utils.GetStatefulsetName(lrp) if err != nil {
Function NewLRPToStatefulSetConverter
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
applicationServiceAccount string, registrySecretName string, allowAutomountServiceAccountToken bool, allowRunImageAsRoot bool, latestMigration int,
Function GetPodState
has 8 return statements (exceeds 4 allowed). Open
Open
func GetPodState(pod corev1.Pod) string { if len(pod.Status.ContainerStatuses) == 0 || pod.Status.Phase == corev1.PodUnknown { return api.UnknownState }
Function generateReport
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
pod *v1.Pod, reason string, exitStatus int, exitDescription string, crashTimestamp int64,
Method DefaultCrashEventGenerator.Generate
has 6 return statements (exceeds 4 allowed). Open
Open
func (g DefaultCrashEventGenerator) Generate(ctx context.Context, pod *v1.Pod, logger lager.Logger) (events.CrashEvent, bool) { logger = logger.Session("generate-crash-event", lager.Data{ "pod-name": pod.Name, "guid": pod.Annotations[stset.AnnotationProcessGUID],
Method Reconciler.reportIfRequired
has 6 return statements (exceeds 4 allowed). Open
Open
func (r *Reconciler) reportIfRequired(ctx context.Context, pod *corev1.Pod) error { if pod.Annotations[jobs.AnnotationCCAckedTaskCompletion] == jobs.TaskCompletedTrue { return nil }
Method CrashReconciler.Reconcile
has 6 return statements (exceeds 4 allowed). Open
Open
func (c *CrashReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { logger := c.logger.Session("reconcile-pod-crash", lager.Data{ "name": request.NamespacedName.Name, "namespace": request.NamespacedName.Namespace,
Function NewGetter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger, statefulSetGetter StatefulSetByLRPIdentifierGetter, podGetter PodGetter, eventGetter EventGetter, statefulsetToLrpConverter StatefulSetToLRPConverter,
Method Executor.migrateObjects
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (e *Executor) migrateObjects(ctx context.Context, logger lager.Logger, objects []runtime.Object, objectType ObjectType, setAnnotationFn func(context.Context, runtime.Object, int) error) error {
Function do
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func do(ctx context.Context, client *http.Client, method string, uri string, body interface{}) error {
Function NewDesirer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger, secrets SecretsClient, statefulSets StatefulSetCreator, lrpToStatefulSetConverter LRPToStatefulSetConverter, podDisruptionBudgetCreator PodDisruptionBudgetUpdater,
Method Desirer.Desire
has 5 return statements (exceeds 4 allowed). Open
Open
func (d *Desirer) Desire(ctx context.Context, namespace string, task *api.Task, opts ...shared.Option) error { logger := d.logger.Session("desire-task", lager.Data{"guid": task.GUID, "name": task.Name, "namespace": namespace}) var ( err error
Function do
has 5 return statements (exceeds 4 allowed). Open
Open
func do(ctx context.Context, client *http.Client, method string, uri string, body interface{}) error { bodyJSON, err := json.Marshal(body) if err != nil { return errors.Wrap(err, "cannot marshal body") }
Method Getter.GetInstances
has 5 return statements (exceeds 4 allowed). Open
Open
func (g *Getter) GetInstances(ctx context.Context, identifier api.LRPIdentifier) ([]*api.Instance, error) { logger := g.logger.Session("get-instance", lager.Data{"guid": identifier.GUID, "version": identifier.Version}) if _, err := g.getLRP(ctx, logger, identifier); errors.Is(err, eirini.ErrNotFound) { return nil, err }