openSUSE/open-build-service

View on GitHub

Showing 326 of 426 total issues

Method change_review_state has a Cognitive Complexity of 27 (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 a changeable state (new, review or declined)' unless state == :review || (state.in?(%i[new declined]) && new_review_state == :new)
Severity: Minor
Found in src/api/app/models/bs_request.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 _assignreview_update_reviews has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
Open

  def _assignreview_update_reviews(reviewer, opts, new_review = nil)
    review_comment = nil
    reviews.reverse_each do |review|
      next if review.by_user
      next if review.by_group && review.by_group != opts[:by_group]
Severity: Minor
Found in src/api/app/models/bs_request.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 configure_package_link_target_project has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
Open

  def configure_package_link_target_project(pkg_name, update_project)
    package_to_update = update_project.packages.find_by(name: pkg_name)

    if package_to_update
      # We have a package in the update project already, take that
Severity: Minor
Found in src/api/app/models/branch_package/check_for_update.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 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 find_changed_issues has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
Open

  def find_changed_issues
    # no expand=1, so only branches are tracked
    query = { cmd: :diff, orev: 0, onlyissues: 1, linkrev: :base, view: :xml }
    issue_change = parse_issues_xml(query, 'kept')
    # issues introduced by local changes
Severity: Minor
Found in src/api/app/models/package.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 SCMWebhook has 28 methods (exceeds 20 allowed). Consider refactoring.
Confirmed

class SCMWebhook
  include ActiveModel::Model
  include SCMWebhookInstrumentation # for run_callbacks

  attr_accessor :payload
Severity: Minor
Found in src/api/app/models/scm_webhook.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

    Method action_details has 80 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 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 73 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 2 hrs to fix

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

          def verify_release_targets!(pro, filter_architecture = nil)
            repo_matches = nil
            repo_bad_type = nil
        
            pro.repositories.each do |repo|
        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 check_action_permission_target! has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring.
        Open

          def check_action_permission_target!
            return unless target_project
        
            tprj = Project.get_by_name(target_project)
            if tprj.is_a?(Project)
        Severity: Minor
        Found in src/api/app/models/bs_request_action.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

        Severity
        Category
        Status
        Source
        Language