openSUSE/open-build-service

View on GitHub

Showing 621 of 670 total issues

Method check_action_permission! has a Cognitive Complexity of 48 (exceeds 5 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 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 update has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @issue_tracker = IssueTracker.find_by_name(params[:id])
    unless @issue_tracker
      render_error(status: 404, errorcode: 'not_found', message: "Unable to find issue tracker '#{params[:id]}'") && return
    end
Severity: Minor
Found in src/api/app/controllers/issue_trackers_controller.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 branch_local_repositories has a Cognitive Complexity of 45 (exceeds 5 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('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

Class PackageController has 49 methods (exceeds 20 allowed). Consider refactoring.
Open

class Webui::PackageController < Webui::WebuiController
  require_dependency 'opensuse/validator'
  include ParsePackageDiff
  include Webui::PackageHelper
  include Webui::ManageRelationships
Severity: Minor
Found in src/api/app/controllers/webui/package_controller.rb - About 6 hrs to fix

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

      def project_index
        prj = nil
        unless params[:project] == '_dispatchprios'
          prj = Project.get_by_name(params[:project])
        end
    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

    Method determine_details_about_package_to_branch has a Cognitive Complexity of 43 (exceeds 5 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 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 changestate_accepted has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

      def changestate_accepted(opts)
        # all maintenance_incident actions go into the same incident project
        incident_project = nil # .where(type: 'maintenance_incident')
        bs_request_actions.each do |action|
          source_project = Project.find_by_name(action.source_project)
    Severity: Minor
    Found in src/api/app/models/bs_request.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 BsRequestAction has 44 methods (exceeds 20 allowed). Consider refactoring.
    Open

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

      Method find_packages_to_branch has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

        def find_packages_to_branch
          @packages = []
          if params[:request]
            # find packages from request
            req = BsRequest.find_by_number(params[:request])
      Severity: Minor
      Found in src/api/app/models/branch_package.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 default_reviewers has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

        def default_reviewers
          reviews = []
          return reviews unless target_project
      
          tprj = Project.get_by_name(target_project)
      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

      Class ProjectController has 42 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: Minor
      Found in src/api/app/controllers/webui/project_controller.rb - About 5 hrs to fix

        Method check_for_update_project has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

          def check_for_update_project(p)
            pkg = p[:package]
            prj = p[:link_target_project]
            if pkg.is_a?(Package)
              logger.debug "Check Package #{p[:package].project.name}/#{p[:package].name}"
        Severity: Minor
        Found in src/api/app/models/branch_package.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 cmd_changestate_permissions has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

          def cmd_changestate_permissions(opts)
            # We do not support to revert changes from accepted requests (yet)
            if req.state == :accepted
              raise PostRequestNoPermission, 'change state from an accepted state is not allowed.'
            end
        Severity: Minor
        Found in src/api/app/models/bs_request_permission_check.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

        File branch_package.rb has 398 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class BranchPackage
          attr_accessor :params
        
          include BranchPackage::Errors
        
        
        Severity: Minor
        Found in src/api/app/models/branch_package.rb - About 5 hrs to fix

          Class Base has 41 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 5 hrs to fix

            Method project_command_copy has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

              def project_command_copy
                project_name = params[:project]
            
                @project = Project.find_by_name(project_name)
                unless (@project && User.session!.can_modify?(@project)) || User.session!.can_create_project?(project_name)
            Severity: Minor
            Found in src/api/app/controllers/source_controller.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 render_grouplist_ldap has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.render_grouplist_ldap(grouplist, user = nil)
                result = []
                if @@ldap_search_con.nil?
                  @@ldap_search_con = initialize_ldap_con(CONFIG['ldap_search_user'], CONFIG['ldap_search_auth'])
                end
            Severity: Minor
            Found in src/api/app/models/user_ldap_strategy.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 binary_packages has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

              def binary_packages
                check_package_access(params[:project], params[:package], false)
                @pkg = Package.find_by_project_and_name(params[:project], params[:package])
            
                begin
            Severity: Minor
            Found in src/api/app/controllers/public_controller.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 find_all_by has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.find_all_by(args = {}, opt = {})
                  refresh = (opt.symbolize_keys[:cache].to_s == 'refresh')
                  exclude_mod = !!opt.symbolize_keys[:exclude_modules]
                  filter = args.symbolize_keys.slice(:iso, :state, :build, :maxage, :distri, :version, :group)
            
            
            Severity: Minor
            Found in src/api/app/models/obs_factory/openqa_job.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 sync_repository_pathes has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

              def sync_repository_pathes
                # check all my repositories and ..
                repositories.each do |repo|
                  cycle_detection = {}
                  repo.path_elements.each do |path|
            Severity: Minor
            Found in src/api/app/models/project.rb - About 4 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