Katello/katello

View on GitHub

Showing 2,737 of 2,737 total issues

Method update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def update
      # If a user doesn't include smart proxies or products in the update call, don't accidentally remove all of them.
      if params[:smart_proxy_ids].nil? && params[:smart_proxy_names].nil?
        @smart_proxies = @alternate_content_source.smart_proxies
      elsif params[:smart_proxy_ids] == [] || params[:smart_proxy_names] == []
Severity: Minor
Found in app/controllers/katello/api/v2/alternate_content_sources_controller.rb - About 45 mins 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 process_errata_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def process_errata_ids(select_all_params)
      if select_all_params[:included][:ids].blank?
        select_all_params[:excluded][:ids] ||= [] if select_all_params[:excluded][:ids].nil?
        current_errata_ids = @filter.erratum_rules.map(&:errata_id) + select_all_params[:excluded][:ids]
        query = Erratum
Severity: Minor
Found in app/controllers/katello/api/v2/content_view_filter_rules_controller.rb - About 45 mins 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 repository_mapping has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def repository_mapping(content_view_version)
          mapping = {}
          relation = content_view_version.importable_repositories.joins(:root, :product)

          metadata_map.repositories.each do |metadata_repo|
Severity: Minor
Found in app/services/katello/pulp3/content_view_version/import.rb - About 45 mins 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 main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def main
        bad_hgs = []
        good_hgs = []

        groups = interested_hostgroups.each do |hg|
Severity: Minor
Found in app/lib/katello/util/hostgroup_facets_helper.rb - About 45 mins 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 process_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def process_response(resp)
        logger.debug "Processing response: #{resp.code}"
        logger.debug filter_sensitive_data(resp.body)
        return resp unless resp.code.to_i >= 400
        parsed = {}
Severity: Minor
Found in app/lib/katello/http_resource.rb - About 45 mins 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 respond_for_exception has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def respond_for_exception(exception, options = {})
          options = options.reverse_merge(
              :with_logging    => true,
              :status          => exception.respond_to?('status_code') ? exception.status_code : :internal_server_error,
              :text            => exception.message,
Severity: Minor
Found in app/lib/katello/api/v2/error_handling.rb - About 45 mins 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 repos_to_sync has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def repos_to_sync(smart_proxy, environment, content_view, repository, skip_metatadata_check = false)
          smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
          smart_proxy_helper.lifecycle_environment_check(environment, repository)
          if repository
            if skip_metatadata_check || !repository.smart_proxy_sync_histories.where(:smart_proxy_id => smart_proxy).any? { |sph| !sph.finished_at.nil? }
Severity: Minor
Found in app/lib/actions/katello/capsule_content/sync_capsule.rb - About 45 mins 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 check_services has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def check_services
        @services.each do |service_name, service_class|
          @service_statuses[service_name] = service_class.status
        rescue => error
          Rails.logger.error("Error occurred while pinging #{service_class}")
Severity: Minor
Found in app/lib/katello/event_daemon/monitor.rb - About 45 mins 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 docker_search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def docker_search
          request_params = {
            method: :get,
            headers: { accept: :json },
            url: "#{@uri}v1/search?q=#{@search}"
Severity: Minor
Found in app/lib/katello/resources/discovery/container.rb - About 45 mins 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 rest_client has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def rest_client(http_type, method, path)
        # Need full path to properly generate the signature
        url = self.site + path
        params = { :site => self.site,
                   :http_method => method,
Severity: Minor
Found in app/lib/katello/http_resource.rb - About 45 mins 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 plan has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description)
Severity: Minor
Found in app/lib/actions/katello/content_view/incremental_updates.rb - About 45 mins to fix

    Method proxy_uri has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def proxy_uri
            #Reset the scheme to proxy(s) based on http or https to handle cgi unescaping in rest-client
            if proxy
              scheme = 'proxy' if proxy_scheme == 'http'
              scheme = 'proxys' if proxy_scheme == 'https'
    Severity: Minor
    Found in app/lib/katello/util/http_proxy.rb - About 45 mins 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 humanized_details has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

              def humanized_details
                ret = []
                ret << _("Cancelled.") if cancelled?
                ret << added_content_message
                if total_units == 0
    Severity: Minor
    Found in app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb - About 45 mins 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

    Identical blocks of code found in 5 locations. Consider refactoring.
    Open

      const { getByLabelText } = render(<EditableTextInput
        attribute={attribute}
        onEdit={jest.fn()}
        isPassword
        hasPassword
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 55..60
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 66..71
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 82..87
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 99..104

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

    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

    Identical blocks of code found in 5 locations. Consider refactoring.
    Open

      const { getByLabelText } = render(<EditableTextInput
        attribute={attribute}
        onEdit={jest.fn()}
        isPassword
        hasPassword
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 55..60
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 66..71
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 99..104
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 114..119

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

    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

    Identical blocks of code found in 5 locations. Consider refactoring.
    Open

      const { getByLabelText } = render(<EditableTextInput
        attribute={attribute}
        onEdit={jest.fn()}
        isPassword
        hasPassword
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 55..60
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 82..87
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 99..104
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 114..119

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

    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

    Identical blocks of code found in 5 locations. Consider refactoring.
    Open

      const { getByLabelText } = render(<EditableTextInput
        attribute={attribute}
        onEdit={jest.fn()}
        isPassword
        hasPassword
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 66..71
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 82..87
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 99..104
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 114..119

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

    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 plan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def plan(*args)
            if Setting[:check_services_before_actions]
              #To prevent the ping from happening multiple times, keep track on the initial entry action
              #If capsule_id is passed as in args from an action, Katello::Ping checks the pulp server on the capsule
              parent = source_action
    Severity: Minor
    Found in app/lib/actions/middleware/backend_services_check.rb - About 45 mins 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

    Identical blocks of code found in 5 locations. Consider refactoring.
    Open

      const { getByLabelText } = render(<EditableTextInput
        attribute={attribute}
        onEdit={jest.fn()}
        isPassword
        hasPassword
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 55..60
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 66..71
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 82..87
    webpack/components/EditableTextInput/__tests__/editableTextInput.test.js on lines 114..119

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

    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 plan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def plan(acs, smart_proxies, products = nil)
              acs.save!
              action_subject(acs)
              if products.present?
                acs.update!(products: products)
    Severity: Minor
    Found in app/lib/actions/katello/alternate_content_source/create.rb - About 45 mins 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

    Severity
    Category
    Status
    Source
    Language