openSUSE/open-build-service

View on GitHub

Showing 697 of 759 total issues

Method create_expand_package has a Cognitive Complexity of 181 (exceeds 5 allowed). Consider refactoring.
Open

  def create_expand_package(packages, opts = {})
    newactions = []
    incident_suffix = ''
    if is_maintenance_release?
      # 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

File project.rb has 1202 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_dependency 'has_relationships'

# rubocop:disable Metrics/ClassLength
class Project < ApplicationRecord
  include FlagHelper
Severity: Major
Found in src/api/app/models/project.rb - About 3 days to fix

    File package.rb has 1091 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_dependency 'api_error'
    require 'builder/xchar'
    require 'rexml/document'
    require_dependency 'has_relationships'
    require_dependency 'opensuse/validator'
    Severity: Major
    Found in src/api/app/models/package.rb - About 2 days to fix

      Class Project has 128 methods (exceeds 20 allowed). Consider refactoring.
      Open

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

        File package_controller.rb has 949 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'project'
        
        class Webui::PackageController < Webui::WebuiController
          require_dependency 'opensuse/validator'
          include ParsePackageDiff
        Severity: Major
        Found in src/api/app/controllers/webui/package_controller.rb - About 2 days to fix

          File bs_request.rb has 945 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'xmlhash'
          
          include MaintenanceHelper
          
          class BsRequest < ApplicationRecord
          Severity: Major
          Found in src/api/app/models/bs_request.rb - About 2 days to fix

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

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

              File source_controller.rb has 864 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              include MaintenanceHelper
              include ValidationHelper
              
              require 'builder/xchar'
              
              
              Severity: Major
              Found in src/api/app/controllers/source_controller.rb - About 2 days to fix

                File project_controller.rb has 785 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class Webui::ProjectController < Webui::WebuiController
                  require_dependency 'opensuse/validator'
                  include Webui::RequestHelper
                  include Webui::ProjectHelper
                  include Webui::ManageRelationships
                Severity: Major
                Found in src/api/app/controllers/webui/project_controller.rb - About 1 day to fix

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

                  class User < ApplicationRecord
                    include CanRenderModel
                  
                    # Keep in sync with states defined in db/structure.sql
                    STATES = ['unconfirmed', 'confirmed', 'locked', 'deleted', 'subaccount'].freeze
                  Severity: Major
                  Found in src/api/app/models/user.rb - About 1 day to fix

                    File routes.rb has 703 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class WebuiMatcher
                      class InvalidRequestFormat < APIError
                      end
                    
                      def self.matches?(request)
                    Severity: Major
                    Found in src/api/config/routes.rb - About 1 day to fix

                      File bs_request_action.rb has 686 lines of code (exceeds 250 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

                        File user.rb has 671 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'kconv'
                        require_dependency 'api_error'
                        
                        class UserBasicStrategy
                          def is_in_group?(user, group)
                        Severity: Major
                        Found in src/api/app/models/user.rb - About 1 day to fix

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

                          class SourceController < ApplicationController
                            include Source::Errors
                          
                            validate_action index: { method: :get, response: :directory }
                            validate_action projectlist: { method: :get, response: :directory }
                          Severity: Major
                          Found in src/api/app/controllers/source_controller.rb - About 1 day to fix

                            Method webui_actions has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def webui_actions(opts = {})
                                # TODO: Fix!
                                actions = []
                                with_diff = opts.delete(:diffs)
                                bs_request_actions.each do |xml|
                            Severity: Minor
                            Found in src/api/app/models/bs_request.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

                            Method create_branch_packages has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def create_branch_packages(tprj)
                                # collect also the needed repositories here
                                response = nil
                                @packages.each do |p|
                                  pac = p[:package]
                            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 BsRequest has 67 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class BsRequest < ApplicationRecord
                              class InvalidStateError < APIError
                                setup 'request_not_modifiable', 404
                              end
                              class InvalidReview < APIError
                            Severity: Major
                            Found in src/api/app/models/bs_request.rb - About 1 day to fix

                              Class ProjectController has 67 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Webui::ProjectController < Webui::WebuiController
                                require_dependency 'opensuse/validator'
                                include Webui::RequestHelper
                                include Webui::ProjectHelper
                                include Webui::ManageRelationships
                              Severity: Major
                              Found in src/api/app/controllers/webui/project_controller.rb - About 1 day to fix

                                Method initialize has 225 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

                                  File xpath_engine.rb has 536 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  class XpathEngine
                                    require 'rexml/parsers/xpathparser'
                                  
                                    class IllegalXpathError < APIError
                                      setup 'illegal_xpath_error', 400
                                  Severity: Major
                                  Found in src/api/lib/xpath_engine.rb - About 1 day to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language