gitlabhq/gitlabhq

View on GitHub

Showing 1,757 of 2,500 total issues

Method validate_projects_and_branches has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_projects_and_branches
      merge_request.validate_target_project
      merge_request.validate_fork

      return if errors.any?
Severity: Minor
Found in app/services/merge_requests/build_service.rb - About 45 mins 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def execute
      remove_unallowed_params
      set_visibility_level

      @group = Group.new(params)
Severity: Minor
Found in app/services/groups/create_service.rb - About 45 mins 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 add_commits has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def add_commits(noteable, project, author, new_commits, existing_commits = [], oldrev = nil)
Severity: Minor
Found in app/services/system_note_service.rb - About 45 mins to fix

    Method execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute
          should_resolve = false
          in_reply_to_discussion_id = params.delete(:in_reply_to_discussion_id)
    
          if in_reply_to_discussion_id.present?
    Severity: Minor
    Found in app/services/notes/build_service.rb - About 45 mins 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_branch_presence has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def change_branch_presence(noteable, project, author, branch_type, branch, presence)
    Severity: Minor
    Found in app/services/system_note_service.rb - About 45 mins to fix

      Method update_authorizations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_authorizations(remove = [], add = [])
            return if remove.empty? && add.empty?
      
            User.transaction do
              user.remove_project_authorizations(remove) unless remove.empty?
      Severity: Minor
      Found in app/services/users/refresh_authorized_projects_service.rb - About 45 mins 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 ensure_preconditions! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def ensure_preconditions!(target_ref)
            unless downstream_project_accessible?
              @bridge.drop!(:downstream_bridge_project_not_found)
              return false
            end
      Severity: Minor
      Found in app/services/ci/create_cross_project_pipeline_service.rb - About 45 mins 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute
            unless awardable.user_can_award?(current_user)
              return error('User cannot award emoji to awardable', status: :forbidden)
            end
      
      
      Severity: Minor
      Found in app/services/award_emojis/add_service.rb - About 45 mins 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_branch has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def change_branch(noteable, project, author, branch_type, old_branch, new_branch)
      Severity: Minor
      Found in app/services/system_note_service.rb - About 45 mins to fix

        Method run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def run(args)
                unless args.include?('--')
                  index = args.index { |opt| opt.include?('features') }
        
                  args.insert(index, '--') if index
        Severity: Minor
        Found in qa/qa/specs/parallel_runner.rb - About 45 mins 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 import_repository has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def import_repository
              refmap = importer_class.try(:refmap) if has_importer?
        
              if refmap
                project.ensure_repository
        Severity: Minor
        Found in app/services/projects/import_service.rb - About 45 mins 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def execute(type)
              model_class = type.classify.constantize
              update_class = type.classify.pluralize.constantize::UpdateService
        
              ids = params.delete(:issuable_ids).split(",")
        Severity: Minor
        Found in app/services/issuable/bulk_update_service.rb - About 45 mins 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 remaining_days_in_words has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def remaining_days_in_words(due_date, start_date = nil)
            if due_date&.past?
              content_tag(:strong, _('Past due'))
            elsif due_date&.today?
              content_tag(:strong, _('Today'))
        Severity: Minor
        Found in app/serializers/entity_date_helper.rb - About 45 mins 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 test_wait_with_counter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                  def test_wait_with_counter
                    Timecop.freeze(time_start) do
                      subject.repeat_until(max_duration: 3, raise_on_failure: false, retry_on_exception: true) do
                        @loop_counter += 1
                        Timecop.travel(time_start + @loop_counter)
        Severity: Minor
        Found in qa/spec/support/repeater_spec.rb - About 45 mins 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 save_lfs_objects has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def save_lfs_objects
              return unless @project.forked?
        
              lfs_storage_project = @project.lfs_storage_project
        
        
        Severity: Minor
        Found in app/services/projects/unlink_fork_service.rb - About 45 mins 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 after_create_actions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def after_create_actions
              log_info("#{@project.owner.name} created a new project \"#{@project.full_name}\"")
        
              unless @project.gitlab_project_import?
                @project.write_repository_config
        Severity: Minor
        Found in app/services/projects/create_service.rb - About 45 mins 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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def validate(record)
            unless certificate = read_certificate(record)
              record.errors.add(options[:certificate], _('is not a valid X509 certificate.'))
            end
        
        
        Severity: Minor
        Found in app/validators/x509_certificate_credentials_validator.rb - About 45 mins 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def execute(source_project)
              return unless source_project && source_project.namespace == @project.namespace
        
              Project.transaction do
                move_before_destroy_relationships(source_project)
        Severity: Minor
        Found in app/services/projects/overwrite_project_service.rb - About 45 mins 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 open has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def open
            stream =
              if file_storage?
                File.open(path, "rb") if path
              else
        Severity: Minor
        Found in app/uploaders/gitlab_uploader.rb - About 45 mins 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 sign_in_using_credentials has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def sign_in_using_credentials(user: nil, skip_page_validation: false)
                  # Don't try to log-in if we're already logged-in
                  return if Page::Main::Menu.perform(&:signed_in?)
        
                  using_wait_time 0 do
        Severity: Minor
        Found in qa/qa/page/main/login.rb - About 45 mins 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