openSUSE/open-build-service

View on GitHub

Showing 326 of 422 total issues

Method create_expand_package has a Cognitive Complexity of 176 (exceeds 8 allowed). Consider refactoring.
Open

  def create_expand_package(packages, opts = {})
    newactions = []
    incident_suffix = ''

    # The maintenance ID is always the sub project name of the maintenance project
Severity: Minor
Found in src/api/app/models/bs_request_action.rb - About 3 days 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 Project has 124 methods (exceeds 20 allowed). Consider refactoring.
Open

class Project < ApplicationRecord
  include FlagHelper
  include FlagValidations
  include CanRenderModel
  include HasRelationships
Severity: Major
Found in src/api/app/models/project.rb - About 2 days to fix

    Class Package has 111 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Package < ApplicationRecord
      include FlagHelper
      include FlagValidations
      include CanRenderModel
      include HasRelationships
    Severity: Major
    Found in src/api/app/models/package.rb - About 2 days to fix

      Class User has 90 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class User < ApplicationRecord
        include CanRenderModel
        include Flipper::Identifier
      
        # Keep in sync with states defined in db/schema.rb
      Severity: Major
      Found in src/api/app/models/user.rb - About 1 day to fix

        Class BsRequest has 82 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class BsRequest < ApplicationRecord
          include BsRequest::Errors
        
          MAX_DESCRIPTION_LENGTH_ALLOWED = 64_000
        
        
        Severity: Major
        Found in src/api/app/models/bs_request.rb - About 1 day to fix

          Class SourceController has 81 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class SourceController < ApplicationController
            include MaintenanceHelper
            include ValidationHelper
          
            include Source::Errors
          Severity: Major
          Found in src/api/app/controllers/source_controller.rb - About 1 day to fix

            Method create_branch_packages has a Cognitive Complexity of 67 (exceeds 8 allowed). Consider refactoring.
            Open

              def create_branch_packages(tprj)
                # collect also the needed repositories here
                response = nil
                @packages.each do |p|
                  raise CanNotBranchPackage, "project is developed at #{p[:link_target_project].scmsync}. Fork it instead." if p[:link_target_project].try(:scmsync).present?
            Severity: Minor
            Found in src/api/app/models/branch_package.rb - About 1 day 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 BsRequestAction has 65 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class BsRequestAction < ApplicationRecord
              #### Includes and extends
              include ParsePackageDiff
              include BsRequestAction::Errors
              #### Constants
            Severity: Major
            Found in src/api/app/models/bs_request_action.rb - About 1 day to fix

              Method initialize has 232 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def initialize
                  @lexer = REXML::Parsers::XPathParser.new
              
                  @tables = {
                    'attribute' => 'attribs',
              Severity: Major
              Found in src/api/lib/xpath_engine.rb - About 1 day to fix

                Method update_binary_releases_for_repository has a Cognitive Complexity of 53 (exceeds 8 allowed). Consider refactoring.
                Open

                  def update_binary_releases_for_repository(repository, new_binary_releases, time = Time.now)
                    # building a hash to avoid single SQL select calls slowing us down too much
                    old_binary_releases = {}
                    BinaryRelease.transaction do
                      repository.binary_releases.current.unchanged.find_each do |binary|
                Severity: Minor
                Found in src/api/app/jobs/update_released_binaries_job.rb - About 7 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 a Cognitive Complexity of 52 (exceeds 8 allowed). Consider refactoring.
                Open

                  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: Minor
                Found in src/api/app/models/bs_request.rb - About 7 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 cmd_changestate_permissions has a Cognitive Complexity of 51 (exceeds 8 allowed). Consider refactoring.
                Open

                  def cmd_changestate_permissions
                    # We do not support to revert changes from accepted requests (yet)
                    raise PostRequestNoPermission, 'change state from an accepted state is not allowed.' if req.state == :accepted
                
                    # need to check for accept permissions
                Severity: Minor
                Found in src/api/app/models/bs_request_permission_check.rb - About 7 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 determine_details_about_package_to_branch has a Cognitive Complexity of 51 (exceeds 8 allowed). Consider refactoring.
                Open

                  def determine_details_about_package_to_branch(p)
                    return unless p[:link_target_project].is_a?(Project) # only for local source projects
                
                    check_for_update_project(p) unless params[:ignoredevel]
                
                
                Severity: Minor
                Found in src/api/app/models/branch_package.rb - About 7 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 Base has 49 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Base < ApplicationRecord
                    self.inheritance_column = 'eventtype'
                    self.table_name = 'events'
                
                    after_create :create_project_log_entry_job, if: -> { (PROJECT_CLASSES | PACKAGE_CLASSES).include?(self.class.name) }
                Severity: Minor
                Found in src/api/app/models/event/base.rb - About 6 hrs to fix

                  Method branch_local_repositories has a Cognitive Complexity of 45 (exceeds 8 allowed). Consider refactoring.
                  Open

                    def branch_local_repositories(project, pkg_to_enable, opts = {})
                      # shall we use the repositories from a different project?
                      project = project.update_instance_or_self('OBS', 'BranchRepositoriesFromProject')
                      skip_repos = []
                      a = project.find_attribute('OBS', 'BranchSkipRepositories')
                  Severity: Minor
                  Found in src/api/app/models/project.rb - About 6 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_expand_package has 160 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def create_expand_package(packages, opts = {})
                      newactions = []
                      incident_suffix = ''
                  
                      # The maintenance ID is always the sub project name of the maintenance project
                  Severity: Major
                  Found in src/api/app/models/bs_request_action.rb - About 6 hrs to fix

                    Method project_index has a Cognitive Complexity of 44 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def project_index
                        prj = nil
                        prj = Project.get_by_name(params[:project]) unless params[:project] == '_dispatchprios'
                    
                        if request.get?
                    Severity: Minor
                    Found in src/api/app/controllers/build_controller.rb - About 6 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 RequestController has 43 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Webui::RequestController < Webui::WebuiController
                      include Webui::NotificationsHandler
                      include Webui::RequestsFilter
                      include BuildNewComment
                    
                    
                    Severity: Minor
                    Found in src/api/app/controllers/webui/request_controller.rb - About 5 hrs to fix

                      Method subscriptions has a Cognitive Complexity of 41 (exceeds 8 allowed). Consider refactoring.
                      Open

                          def subscriptions(channel = :instant_email)
                            receivers_and_subscriptions = {}
                      
                            event.class.receiver_roles.each do |receiver_role|
                              # Find the users/groups who are receivers for this event
                      Severity: Minor
                      Found in src/api/app/models/event_subscription/find_for_event.rb - About 5 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! has a Cognitive Complexity of 41 (exceeds 8 allowed). Consider refactoring.
                      Open

                        def check_action_permission!(skip_source = nil)
                          # find objects if specified or report error
                          role = nil
                          sprj = nil
                          if person_name
                      Severity: Minor
                      Found in src/api/app/models/bs_request_action.rb - About 5 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