gitlabhq/gitlabhq

View on GitHub

Showing 1,894 of 2,743 total issues

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

          def copy_resource_milestone_events
            return unless milestone_events_supported?
    
            copy_events(ResourceMilestoneEvent.table_name, original_entity.resource_milestone_events) do |event|
              if event.remove?
    Severity: Minor
    Found in app/services/issuable/clone/attributes_rewriter.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(token)
              return bad_request unless valid_payload_size?
              return unprocessable_entity unless valid_version?
              return unauthorized unless valid_alert_manager_token?(token)
    
    
    Severity: Minor
    Found in app/services/projects/prometheus/alerts/notify_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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute
          return unless user.email
          return unless user.email.match? Devise.email_regexp
    
          canonical_email = canonicalize_email
    Severity: Minor
    Found in app/services/users/update_canonical_email_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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute(skip_authorization: false)
            raise Gitlab::Access::AccessDeniedError unless skip_authorization || can_create_user?
      
            user_params = build_user_params(skip_authorization: skip_authorization)
            user = User.new(user_params)
      Severity: Minor
      Found in app/services/users/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(member, skip_authorization: false, skip_subresources: false)
            raise Gitlab::Access::AccessDeniedError unless skip_authorization || can_destroy_member?(member)
      
            @skip_auth = skip_authorization
      
      
      Severity: Minor
      Found in app/services/members/destroy_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 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
            if in_reply_to_discussion_id.present?
              unless discussion
                return base_error(_('Thread to reply to cannot be found'))
              end
      Severity: Minor
      Found in app/services/draft_notes/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 remove_non_footnote_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def remove_non_footnote_ids
                lambda do |env|
                  node = env[:node]
      
                  return unless (pattern = FOOTNOTE_LINK_ID_PATTERNS[node.name.to_sym])
      Severity: Minor
      Found in lib/banzai/filter/ascii_doc_sanitization_filter.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 rspec_tags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def rspec_tags
              tags_for_rspec = []
      
              if tags.any?
                tags.each { |tag| tags_for_rspec.push(['--tag', tag.to_s]) }
      Severity: Minor
      Found in qa/qa/specs/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 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 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 remove_non_heading_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def remove_non_heading_ids
                lambda do |env|
                  node = env[:node]
      
                  return unless SECTION_HEADINGS.any?(node.name)
      Severity: Minor
      Found in lib/banzai/filter/ascii_doc_sanitization_filter.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 register_command has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def register_command
                args = []
                args << '--non-interactive'
                args << "--name #{@name}"
                args << "--url #{@address}"
      Severity: Minor
      Found in qa/qa/service/docker_run/gitlab_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 load_uri_types has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def load_uri_types
              return unless linkable_attributes.present?
              return unless linkable_files?
              return {} unless repository
      
      
      Severity: Minor
      Found in lib/banzai/filter/repository_link_filter.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