cloudfoundry-incubator/eirini

View on GitHub

Showing 28 of 59 total issues

Method LRPToStatefulSet.Convert has 135 lines of code (exceeds 50 allowed). Consider refactoring.
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,
Severity: Major
Found in k8s/stset/lrp_to_statefulset.go - About 4 hrs to fix

    Function main has 54 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func main() {
        var opts options
        _, err := flags.ParseArgs(&opts, os.Args)
        cmdcommons.ExitfIfError(err, "Failed to parse args")
    
    
    Severity: Minor
    Found in cmd/task-reporter/main.go - About 1 hr to fix

      Method APIConverter.ConvertLRP has 52 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (c *APIConverter) ConvertLRP(request cf.DesireLRPRequest) (api.LRP, error) {
          env := map[string]string{
              "LANG": "en_US.UTF-8",
          }
      
      
      Severity: Minor
      Found in bifrost/convert.go - About 1 hr to fix

        Method Reconciler.Reconcile has 10 return statements (exceeds 4 allowed).
        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 {
        Severity: Major
        Found in k8s/informers/task/reconciler.go - About 1 hr to fix

          Function NewReconciler has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              logger lager.Logger,
              podClient client.Client,
              jobsClient JobsClient,
              podUpdater PodsClient,
              reporter Reporter,
          Severity: Major
          Found in k8s/informers/task/reconciler.go - About 1 hr to fix

            Function NewLRPClient has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                logger lager.Logger,
                secrets SecretsClient,
                statefulSets StatefulSetClient,
                pods PodClient,
                pdbClient PodDisruptionBudgetClient,
            Severity: Major
            Found in k8s/lrp_client.go - About 1 hr to fix

              Method Desirer.Desire has 9 return statements (exceeds 4 allowed).
              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 {
              Severity: Major
              Found in k8s/stset/desire.go - About 55 mins to fix

                Function NewLRPToStatefulSetConverter has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    applicationServiceAccount string,
                    registrySecretName string,
                    allowAutomountServiceAccountToken bool,
                    allowRunImageAsRoot bool,
                    latestMigration int,
                Severity: Major
                Found in k8s/stset/lrp_to_statefulset.go - About 50 mins to fix

                  Function GetPodState has 8 return statements (exceeds 4 allowed).
                  Open

                  func GetPodState(pod corev1.Pod) string {
                      if len(pod.Status.ContainerStatuses) == 0 || pod.Status.Phase == corev1.PodUnknown {
                          return api.UnknownState
                      }
                  
                  
                  Severity: Major
                  Found in k8s/utils/pod_state.go - About 50 mins to fix

                    Function generateReport has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        pod *v1.Pod,
                        reason string,
                        exitStatus int,
                        exitDescription string,
                        crashTimestamp int64,
                    Severity: Minor
                    Found in k8s/informers/event/crash_event_generator.go - About 45 mins to fix

                      Method Reconciler.reportIfRequired has 6 return statements (exceeds 4 allowed).
                      Open

                      func (r *Reconciler) reportIfRequired(ctx context.Context, pod *corev1.Pod) error {
                          if pod.Annotations[jobs.AnnotationCCAckedTaskCompletion] == jobs.TaskCompletedTrue {
                              return nil
                          }
                      
                      
                      Severity: Major
                      Found in k8s/informers/task/reconciler.go - About 40 mins to fix

                        Method CrashReconciler.Reconcile has 6 return statements (exceeds 4 allowed).
                        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,
                        Severity: Major
                        Found in k8s/informers/event/crash.go - About 40 mins to fix

                          Method DefaultCrashEventGenerator.Generate has 6 return statements (exceeds 4 allowed).
                          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],
                          Severity: Major
                          Found in k8s/informers/event/crash_event_generator.go - About 40 mins to fix

                            Method Executor.migrateObjects has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            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 {
                            Severity: Minor
                            Found in migrations/executor.go - About 35 mins to fix

                              Function do has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func do(ctx context.Context, client *http.Client, method string, uri string, body interface{}) error {
                              Severity: Minor
                              Found in k8s/utils/http.go - About 35 mins to fix

                                Function NewGetter has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    logger lager.Logger,
                                    statefulSetGetter StatefulSetByLRPIdentifierGetter,
                                    podGetter PodGetter,
                                    eventGetter EventGetter,
                                    statefulsetToLrpConverter StatefulSetToLRPConverter,
                                Severity: Minor
                                Found in k8s/stset/get.go - About 35 mins to fix

                                  Function NewDesirer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      logger lager.Logger,
                                      secrets SecretsClient,
                                      statefulSets StatefulSetCreator,
                                      lrpToStatefulSetConverter LRPToStatefulSetConverter,
                                      podDisruptionBudgetCreator PodDisruptionBudgetUpdater,
                                  Severity: Minor
                                  Found in k8s/stset/desire.go - About 35 mins to fix

                                    Method Stopper.StopInstance has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (s *Stopper) StopInstance(ctx context.Context, identifier api.LRPIdentifier, index uint) error {
                                        logger := s.logger.Session("stopInstance", lager.Data{"guid": identifier.GUID, "version": identifier.Version, "index": index})
                                        statefulset, err := s.getStatefulSet(ctx, identifier)
                                    
                                        if errors.Is(err, eirini.ErrNotFound) {
                                    Severity: Major
                                    Found in k8s/stset/stop.go - About 35 mins to fix

                                      Method RetryableJSONClient.Post has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (c *RetryableJSONClient) Post(ctx context.Context, url string, data interface{}) error {
                                          jsonBody, err := json.Marshal(data)
                                          if err != nil {
                                              return errors.Wrap(err, "failed to marshal json body")
                                          }
                                      Severity: Major
                                      Found in util/retryable_json_client.go - About 35 mins to fix

                                        Function Fetch has 5 return statements (exceeds 4 allowed).
                                        Open

                                        func Fetch(dockerRef string, sysCtx types.SystemContext) (*v1.ImageConfig, error) {
                                            ref, err := docker.ParseReference(dockerRef)
                                            if err != nil {
                                                return nil, errors.Wrap(err, "failed to parse docker reference")
                                            }
                                        Severity: Major
                                        Found in stager/docker/fetcher.go - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language