openSUSE/open-build-service

View on GitHub

Showing 338 of 424 total issues

Method execute_accept has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
Open

  def execute_accept(opts)
    # create package unless it exists already
    target_project = Project.get_by_name(self.target_project)

    # FIXME: when this code is moved to conditional assigment, it causes ambiguity between target_package and self.target_package.
Severity: Minor
Found in src/api/app/models/bs_request_action_submit.rb - About 3 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 action_details has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

  def action_details(opts = {}, xml:)
    with_diff = opts.delete(:diffs)
    action = { type: xml.action_type }
    action[:id] = xml.id
    action[:number] = xml.bs_request.number
Severity: Major
Found in src/api/app/models/bs_request.rb - About 3 hrs to fix

    Method store_from_xml has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring.
    Open

      def store_from_xml(hash)
        source = hash.delete('source')
        if source
          self.source_package = source.delete('package')
          self.source_project = source.delete('project')
    Severity: Minor
    Found in src/api/app/models/bs_request_action.rb - About 3 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 create has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring.
    Open

          def create
            # FIXME: We should use strong parameters instead of this custom implementation
            params.fetch(:linked_project) { raise ArgumentError, 'Linked Project parameter missing' }
            params.fetch(:linked_package) { raise ArgumentError, 'Linked Package parameter missing' }
    
    
    Severity: Minor
    Found in src/api/app/controllers/webui/packages/branches_controller.rb - About 3 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

    Class ApplicationController has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ApplicationController < ActionController::Base
      include Pundit::Authorization
      protect_from_forgery
    
      include ActionController::ImplicitRender
    Severity: Minor
    Found in src/api/app/controllers/application_controller.rb - About 3 hrs to fix

      Method cleanup_before_destroy has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
      Open

        def cleanup_before_destroy
          # change all linking repository pathes
          linking_repositories.each do |lrep|
            lrep.path_elements.includes(:link, :repository).find_each do |pe|
              next unless pe.link == self # this is not pointing to our repo
      Severity: Minor
      Found in src/api/app/models/repository.rb - About 3 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 evaluate_expr has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring.
      Open

        def evaluate_expr(expr, root, escape = false)
          table = @base_table
          a = []
          until expr.empty?
            token = expr.shift
      Severity: Minor
      Found in src/api/lib/xpath_engine.rb - About 3 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 _merge_pkg_into_maintenance_incident has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def _merge_pkg_into_maintenance_incident(incident_project)
          # recreate package based on link target and throw everything away, except source changes
          # silently as maintenance teams requests ...
          new_pkg = nil
      
      
      Severity: Major
      Found in src/api/app/models/bs_request_action_maintenance_incident.rb - About 3 hrs to fix

        Class SearchController has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class SearchController < ApplicationController
          require 'xpath_engine'
        
          def project
            search(:project, true)
        Severity: Minor
        Found in src/api/app/controllers/search_controller.rb - About 3 hrs to fix

          Method apply_default_reviewers has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def apply_default_reviewers
              reviewers = collect_default_reviewers!
              # apply reviewers
              reviewers.each do |r|
                if r.instance_of?(User)
          Severity: Minor
          Found in src/api/app/models/bs_request.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 is_reviewer? has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def is_reviewer?(user)
              return false if reviews.blank?
          
              reviews.each do |r|
                if r.by_user
          Severity: Minor
          Found in src/api/app/models/bs_request.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 change_review_state has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def change_review_state(new_review_state, opts = {})
              with_lock do
                new_review_state = new_review_state.to_sym
          
                raise InvalidStateError, 'request is not in review state' unless state == :review || (state == :new && new_review_state == :new)
          Severity: Minor
          Found in src/api/app/models/bs_request.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 update_from_xml has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def update_from_xml(xml)
              transaction do
                xml.elements('productdefinition') do |pd|
                  # we are either an operating system or an application for CPE
                  sw_class = 'o'
          Severity: Minor
          Found in src/api/app/models/product.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 render_xml has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def render_xml(opts = {})
              builder = Nokogiri::XML::Builder.new
              builder.request(id: number, creator: creator) do |r|
                bs_request_actions.includes([:bs_request_action_accept_info]).find_each do |action|
                  action.render_xml(r)
          Severity: Minor
          Found in src/api/app/models/bs_request.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 check_accepted_action has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def check_accepted_action(action)
              raise NotExistingTarget, "Unable to process project #{action.target_project}; it does not exist." unless @target_project
          
              check_action_target(action)
          
          
          Severity: Minor
          Found in src/api/app/models/bs_request_permission_check.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 package_command has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def package_command
              params[:user] = User.session!.login
          
              raise MissingParameterError, 'POST request without given cmd parameter' unless params[:cmd]
          
          
          Severity: Minor
          Found in src/api/app/controllers/source_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 update has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def update
              params[:user] = User.session!.login
              begin
                project = Project.get_by_name(@request_data['name'])
              rescue Project::UnknownObjectError
          Severity: Minor
          Found in src/api/app/controllers/source_project_meta_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 sync_hash_with_model has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def sync_hash_with_model(entry_class, dblist, inhasharray)
              keys = entry_class._sync_keys
              entries = {}
          
              dblist.each do |e|
          Severity: Minor
          Found in src/api/app/helpers/model_helper.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 close_requests has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def close_requests
              # Find open requests involving self and:
              # - revoke them if self is source
              # - decline if self is target
              open_requests_with_package_as_source_or_target.each do |request|
          Severity: Minor
          Found in src/api/app/models/package.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 parse_predicate has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
          Open

            def parse_predicate(root, stack)
              # logger.debug "------------------ predicate ---------------"
              # logger.debug "-- pred_array: #{stack.inspect} --"
          
              raise IllegalXpathError, 'invalid predicate' if stack.nil?
          Severity: Minor
          Found in src/api/lib/xpath_engine.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

          Severity
          Category
          Status
          Source
          Language