Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Function buildRows has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const buildRows = useCallback(() => {
    const newRows = [];
    results.forEach((componentCV) => {
      const {
        id: componentCvId, content_view: cv, content_view_version: cvVersion,

    Function GenericContentPage has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const GenericContentPage = () => {
      const dispatch = useDispatch();
      const contentTypesResponse = useSelector(selectContentTypes);
      const contentTypesStatus = useSelector(selectContentTypesStatus);
      const [selectedContentType, setSelectedContentType] = useState(null);
    Severity: Major
    Found in webpack/scenes/Content/GenericContentPage.js - About 2 hrs to fix

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

          $stateProvider.state("content-host", {
              abstract: true,
              url: '/content_hosts/:hostId',
              permission: 'view_hosts',
              controller: 'ContentHostDetailsController',
      engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.routes.js on lines 30..56
      engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plans.routes.js on lines 39..62

      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 87.

      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 3 locations. Consider refactoring.
      Open

          $stateProvider.state("sync-plan", {
              abstract: true,
              url: '/sync_plans/:syncPlanId',
              permission: 'view_sync_plans',
              controller: 'SyncPlanDetailsController',
      engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.routes.js on lines 30..56
      engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.routes.js on lines 41..66

      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 87.

      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 3 locations. Consider refactoring.
      Open

          $stateProvider.state("activation-key", {
              abstract: true,
              url: '/activation_keys/:activationKeyId',
              permission: 'view_activation_keys',
              controller: 'ActivationKeyDetailsController',
      engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.routes.js on lines 41..66
      engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plans.routes.js on lines 39..62

      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 87.

      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 const resolveTraces = ({ hostname, search }) => post({
        type: API_OPERATIONS.POST,
        key: REX_JOB_INVOCATIONS_KEY,
        url: foremanApi.getApiUrl('/job_invocations'),
        params: katelloTracerResolveParams({ hostname, search }),
      webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js on lines 243..250

      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 87.

      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 const updatePackage = ({ hostname, packageName }) => post({
        type: API_OPERATIONS.POST,
        key: REX_JOB_INVOCATIONS_KEY,
        url: foremanApi.getApiUrl('/job_invocations'),
        params: katelloPackageUpdateParams({ hostname, packageName }),
      webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js on lines 265..272

      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 87.

      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

      Method assign_related_os_templates has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

            def assign_related_os_templates
              all_related_os = find_related_os
              return false if all_related_os.nil?
      
              boot_loader_template_kinds = TemplateKind.where(name: ["PXELinux", "PXEGrub", "PXEGrub2", "iPXE"]).pluck(:id)
      Severity: Minor
      Found in app/models/katello/concerns/operatingsystem_extensions.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function ACSEditCredentials has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      const ACSEditCredentials = ({ onClose, acsId, acsDetails }) => {
        const {
          ssl_ca_cert: sslCACert,
          ssl_client_cert: sslClientCert,
          ssl_client_key: sslClientKey,

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method container_push_prop_validation has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def container_push_prop_validation(props = nil)
            # Handle validation and repo creation for container pushes before talking to pulp
            props = parse_blob_push_props if props.nil?
            return false unless check_blob_push_field_syntax(props)
      
      
      Severity: Minor
      Found in app/controllers/katello/api/registry/registry_proxies_controller.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method authorize_remove_environments has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def authorize_remove_environments(view, options) # rubocop:disable Metrics/CyclomaticComplexity
            env_ids = options[:environment_ids]
      
            return true if env_ids.blank?
      
      

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method set_user_by_token has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_user_by_token(token, redirect_on_failure = true)
            if token
              token_type, token = token.split
              if token_type == 'Bearer' && token
                personal_token = PersonalAccessToken.find_by_token(token)
      Severity: Minor
      Found in app/controllers/katello/api/registry/registry_proxies_controller.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method index_relation has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def index_relation
            content_views = ContentView.readable
            content_views = content_views.ignore_generated unless Foreman::Cast.to_bool(params[:include_generated])
            content_views = content_views.where(:organization_id => @organization.id) if @organization
            content_views = content_views.in_environment(@environment) if @environment
      Severity: Minor
      Found in app/controllers/katello/api/v2/content_views_controller.rb - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      File content_views_controller.rb has 274 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Katello
        class Api::V2::ContentViewsController < Api::V2::ApiController
          include Concerns::Authorization::Api::V2::ContentViewsController
          include Katello::Concerns::FilteredAutoCompleteSearch
          include Katello::Concerns::Api::V2::BulkExtensions
      Severity: Minor
      Found in app/controllers/katello/api/v2/content_views_controller.rb - About 2 hrs to fix

        Function CVVersionDeleteFinish has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const CVVersionDeleteFinish = () => {
          const {
            cvId, versionIdToRemove, versionEnvironments,
            setIsOpen, selectedEnvSet,
            selectedCVForAK, selectedEnvForAK, selectedCVForHosts,

          Method plan has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def plan(content_view, description = "", options = {importing: false, syncable: false}) # rubocop:disable Metrics/PerceivedComplexity
                    action_subject(content_view)
          
                    content_view.check_ready_to_publish!(**options.slice(:importing, :syncable))
                    unless options[:importing] || options[:syncable]
          Severity: Major
          Found in app/lib/actions/katello/content_view/publish.rb - About 2 hrs to fix

            File remove_hidden_distribution.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'pulp_rpm_client'
            require 'pulp_container_client'
            require 'pulp_ostree_client'
            require 'pulp_file_client'
            require 'pulp_deb_client'
            Severity: Minor
            Found in lib/monkeys/remove_hidden_distribution.rb - About 2 hrs to fix

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

                    <TextContent>
                      <Text ouiaId="mpw-step-3-header" component={TextVariants.h3}>
                        {__('Review hosts')}
                      </Text>
                      <Text ouiaId="mpw-step-3-content" component={TextVariants.p}>
              webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/02_BulkErrataTable.js on lines 120..127
              webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/BulkPackagesWizard.js on lines 168..175

              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 86.

              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 3 locations. Consider refactoring.
              Open

                      <Alert
                        ouiaId="host-configuration-alert"
                        variant="warning"
                        title={
                          <FormattedMessage
              webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js on lines 245..265
              webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js on lines 155..177

              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 86.

              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 3 locations. Consider refactoring.
              Open

                    <TextContent>
                      <Text ouiaId="mew-step-3-header" component={TextVariants.h3}>
                        {__('Apply errata')}
                      </Text>
                      <Text ouiaId="mew-step-3-content" component={TextVariants.p}>
              webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/BulkPackagesWizard.js on lines 168..175
              webpack/components/extensions/Hosts/BulkActions/HostReview.js on lines 103..110

              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 86.

              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