portainer/portainer

View on GitHub

Showing 3,384 of 3,384 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

class KubernetesDaemonSetService {
  /* @ngInject */
  constructor($async, KubernetesDaemonSets) {
    this.$async = $async;
    this.KubernetesDaemonSets = KubernetesDaemonSets;
Severity: Major
Found in app/kubernetes/services/daemonSetService.js and 1 other location - About 4 days to fix
app/kubernetes/services/deploymentService.js on lines 6..112

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 830.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

class KubernetesDeploymentService {
  /* @ngInject */
  constructor($async, KubernetesDeployments) {
    this.$async = $async;
    this.KubernetesDeployments = KubernetesDeployments;
Severity: Major
Found in app/kubernetes/services/deploymentService.js and 1 other location - About 4 days to fix
app/kubernetes/services/daemonSetService.js on lines 6..112

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 830.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function CreateIngressView has 726 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function CreateIngressView() {
  const environmentId = useEnvironmentId();
  const { params } = useCurrentStateAndParams();
  const { authorized: isAuthorizedToAddEdit } = useAuthorizations([
    'K8sIngressesW',
Severity: Major
Found in app/react/kubernetes/ingresses/CreateIngressView/CreateIngressView.tsx - About 3 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function SecretsDatatable() {
      const tableState = useTableState(settingsStore, storageKey);
      const { authorized: canWrite } = useAuthorizations(['K8sSecretsW']);
      const readOnly = !canWrite;
      const { authorized: canAccessSystemResources } = useAuthorizations(
    app/react/kubernetes/configs/ListView/ConfigMapsDatatable/ConfigMapsDatatable.tsx on lines 35..109

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 521.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function ConfigMapsDatatable() {
      const tableState = useTableState(settingsStore, storageKey);
      const { authorized: canWrite } = useAuthorizations(['K8sConfigMapsW']);
      const readOnly = !canWrite;
      const { authorized: canAccessSystemResources } = useAuthorizations(
    app/react/kubernetes/configs/ListView/SecretsDatatable/SecretsDatatable.tsx on lines 35..109

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 521.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File portainer.go has 1381 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package portainer
    
    import (
        "context"
        "io"
    Severity: Major
    Found in api/portainer.go - About 2 days to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        async getConfigurationAsync() {
          try {
            this.state.configurationLoading = true;
            const name = this.$transition$.params().name;
            const namespace = this.$transition$.params().namespace;
      app/kubernetes/views/configurations/secret/edit/secretController.js on lines 137..166

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 428.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        async getConfigurationAsync() {
          try {
            this.state.configurationLoading = true;
            const name = this.$transition$.params().name;
            const namespace = this.$transition$.params().namespace;
      app/kubernetes/views/configurations/configmap/edit/configMapController.js on lines 140..170

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 428.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      File createApplicationController.js has 945 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import angular from 'angular';
      import _ from 'lodash-es';
      import filesizeParser from 'filesize-parser';
      import * as JsonPatch from 'fast-json-patch';
      import { RegistryTypes } from '@/portainer/models/registryTypes';

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export function ConfigMapsFormSection({
          values,
          onChange,
          errors,
          namespace,
        app/react/kubernetes/applications/components/ConfigurationsFormSection/SecretsFormSection.tsx on lines 21..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 398.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export function SecretsFormSection({
          values,
          onChange,
          errors,
          namespace,
        app/react/kubernetes/applications/components/ConfigurationsFormSection/ConfigMapsFormSection.tsx on lines 21..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 398.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          async updateConfigurationAsync() {
            try {
              this.state.actionInProgress = true;
              if (
                this.formValues.Kind !== this.configuration.Kind ||
        app/kubernetes/views/configurations/secret/edit/secretController.js on lines 88..117

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 360.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          async updateConfigurationAsync() {
            try {
              this.state.actionInProgress = true;
              if (
                this.formValues.Kind !== this.configuration.Kind ||
        app/kubernetes/views/configurations/configmap/edit/configMapController.js on lines 91..120

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 360.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function StackServiceFactory has 400 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function StackServiceFactory($q, $async, Stack, StackByName, FileUploadService, StackHelper, ServiceService, ContainerService, SwarmService) {
            'use strict';
            var service = {
              updateGit,
              updateKubeGit,
        Severity: Major
        Found in app/portainer/services/api/stackService.js - About 2 days to fix

          File serviceController.js has 792 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require('./includes/configs.html');
          require('./includes/constraints.html');
          require('./includes/container-specs.html');
          require('./includes/containerlabels.html');
          require('./includes/environmentvariables.html');
          Severity: Major
          Found in app/docker/views/services/edit/serviceController.js - About 1 day to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              const appContainersEnvVars =
                appContainers?.flatMap((container) => {
                  const containerEnvVars: ContainerEnvVar[] =
                    container?.env?.map((envVar) => {
                      let envtype: EnvVarType = 'env';
            app/react/kubernetes/applications/DetailsView/ApplicationDetailsWidget/ApplicationEnvVarsTable.tsx on lines 183..218

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 326.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              const appInitContainersEnvVars =
                appInitContainers?.flatMap((container) => {
                  const containerEnvVars: ContainerEnvVar[] =
                    container?.env?.map((envVar) => {
                      let envtype: EnvVarType = 'env';
            app/react/kubernetes/applications/DetailsView/ApplicationDetailsWidget/ApplicationEnvVarsTable.tsx on lines 146..181

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 326.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            File IngressForm.tsx has 767 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { ChangeEvent, useEffect } from 'react';
            import { Plus, RefreshCw, Trash2 } from 'lucide-react';
            
            import Route from '@/assets/ico/route.svg?c';
            
            
            Severity: Major
            Found in app/react/kubernetes/ingresses/CreateIngressView/IngressForm.tsx - About 1 day to fix

              File CreateIngressView.tsx has 765 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { useState, useEffect, useMemo, useCallback, ReactNode } from 'react';
              import { useCurrentStateAndParams, useRouter } from '@uirouter/react';
              import { v4 as uuidv4 } from 'uuid';
              import { debounce } from 'lodash';
              
              

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                function Cell({ row }: CellContext<ConfigMapRowData, string>) {
                  const name = row.original.metadata?.name;
                
                  const isSystemToken = name?.includes('default-token-');
                  const isSystemConfigMap = isSystemToken || row.original.isSystem;
                app/react/kubernetes/configs/ListView/SecretsDatatable/columns/name.tsx on lines 40..73

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 318.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language