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",
}
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 {
Function NewReconciler
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger,
podClient client.Client,
jobsClient JobsClient,
podUpdater PodsClient,
reporter Reporter,
Function NewLRPClient
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger,
secrets SecretsClient,
statefulSets StatefulSetClient,
pods PodClient,
pdbClient PodDisruptionBudgetClient,
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 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,
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 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 NewGetter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger,
statefulSetGetter StatefulSetByLRPIdentifierGetter,
podGetter PodGetter,
eventGetter EventGetter,
statefulsetToLrpConverter StatefulSetToLRPConverter,
Function NewDesirer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
logger lager.Logger,
secrets SecretsClient,
statefulSets StatefulSetCreator,
lrpToStatefulSetConverter LRPToStatefulSetConverter,
podDisruptionBudgetCreator PodDisruptionBudgetUpdater,
Method Stopper.StopInstance
has 5 return statements (exceeds 4 allowed). Open
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) {
Method RetryableJSONClient.Post
has 5 return statements (exceeds 4 allowed). Open
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")
}
Function Fetch
has 5 return statements (exceeds 4 allowed). Open
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")
}