gitlabhq/gitlabhq

View on GitHub

Showing 1,226 of 1,717 total issues

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

    def execute(discussion)
      result = tracer.trace(discussion.position)
      return unless result

      position = result[:position]
Severity: Minor
Found in app/services/discussions/update_diff_position_service.rb - About 1 hr 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 handle_changes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_changes(merge_request, options)
      old_associations = options.fetch(:old_associations, {})
      old_labels = old_associations.fetch(:labels, [])
      old_mentioned_users = old_associations.fetch(:mentioned_users, [])

Severity: Minor
Found in app/services/merge_requests/update_service.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

  def update(issuable)
    change_state(issuable)
    change_subscription(issuable)
    change_todo(issuable)
    toggle_award(issuable)
Severity: Minor
Found in app/services/issuable_base_service.rb - About 1 hr 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 call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def call
        doc.search(".//text()").each do |node|
          content = node.to_html
          next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS)

Severity: Minor
Found in lib/banzai/filter/emoji_filter.rb - About 1 hr 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 perform has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def perform(project_id, task = :gc, lease_key = nil, lease_uuid = nil)
    project = Project.find(project_id)
    active_uuid = get_lease_uuid(lease_key)

    if active_uuid
Severity: Minor
Found in app/workers/git_garbage_collect_worker.rb - About 1 hr 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 single_diff_rows has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def single_diff_rows(merge_request_diff)
        sha_attribute = Gitlab::Database::ShaAttribute.new
        commits = YAML.load(merge_request_diff.st_commits) rescue []
        commits ||= []

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

      def request_cache(method_name, &method_key_block)
        const_get(:RequestCacheExtension).module_eval do
          cache_key_method_name = "#{method_name}_cache_key"

          define_method(method_name) do |*args|
Severity: Minor
Found in lib/gitlab/cache/request_cache.rb - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

      def validate!(url, allow_localhost: false, allow_local_network: true, enforce_user: false, ports: [], protocols: [])
        return true if url.nil?

        begin
          uri = Addressable::URI.parse(url)
Severity: Minor
Found in lib/gitlab/url_blocker.rb - About 1 hr 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 feature_enabled? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def self.feature_enabled?(feature_name, status: MigrationStatus::OPT_IN)
      # Disabled features are always off!
      return false if status == MigrationStatus::DISABLED

      feature = Feature.get("gitaly_#{feature_name}")
Severity: Minor
Found in lib/gitlab/gitaly_client.rb - About 1 hr 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_blob has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_blob(options, mode: nil)
        content = options[:content]
        unless content
          raise IndexError, "You must provide content"
        end
Severity: Minor
Found in lib/gitlab/git/index.rb - About 1 hr 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 cache_method_output has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def cache_method_output(key, fallback: nil, memoize_only: false, &block)
      ivar = cache_instance_variable_name(key)

      if instance_variable_defined?(ivar)
        instance_variable_get(ivar)
Severity: Minor
Found in lib/gitlab/repository_cache_adapter.rb - About 1 hr 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 redis_store_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def redis_store_options
        config = raw_config_hash
        redis_url = config.delete(:url)
        redis_uri = URI.parse(redis_url)

Severity: Minor
Found in lib/gitlab/redis/wrapper.rb - About 1 hr 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_issue_comments has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def import_issue_comments(issue, comments)
        Note.transaction do
          while raw_comment = comments.shift
            next if raw_comment.key?("deletedBy")

Severity: Minor
Found in lib/gitlab/google_code_import/importer.rb - About 1 hr 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 with_repo_branch_commit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def with_repo_branch_commit(start_repository, start_branch_name)
        Gitlab::Git.check_namespace!(start_repository)
        start_repository = RemoteRepository.new(start_repository) unless start_repository.is_a?(RemoteRepository)

        return yield nil if start_repository.empty?
Severity: Minor
Found in lib/gitlab/git/repository.rb - About 1 hr 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 assign_ref_vars has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def assign_ref_vars
    # assign allowed options
    allowed_options = ["filter_ref"]
    @options = params.select {|key, value| allowed_options.include?(key) && !value.blank? }
    @options = HashWithIndifferentAccess.new(@options)
Severity: Minor
Found in lib/extracts_path.rb - About 1 hr 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

Function formatGroupItem has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  formatGroupItem(rawGroupItem) {
    const groupChildren = rawGroupItem.children || [];
    const groupIsOpen = (groupChildren.length > 0) || false;
    const childrenCount = this.hideProjects ?
      rawGroupItem.subgroup_count :
Severity: Minor
Found in app/assets/javascripts/groups/store/groups_store.js - About 1 hr to fix

    Function commitTooltip has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Raphael.prototype.commitTooltip = function commitTooltip(x, y, commit) {
      const boxWidth = 300;
      const icon = this.image(gon.relative_url_root + commit.author.icon, x, y, 20, 20);
      const nameText = this.text(x + 25, y + 10, commit.author.name);
      const idText = this.text(x, y + 35, commit.id);
    Severity: Minor
    Found in app/assets/javascripts/network/raphael.js - About 1 hr to fix

      Function setConfig has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        setConfig() {
          const config = {
            InputSetter: [{
              input: this.noteTypeInput,
              valueAttribute: 'data-value',
      Severity: Minor
      Found in app/assets/javascripts/comment_type_toggle.js - About 1 hr to fix

        Function renderRow has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                renderRow: function(user) {
                  var avatar, img, listClosingTags, listWithName, listWithUserName, username;
                  username = user.username ? "@" + user.username : "";
                  avatar = user.avatar_url ? user.avatar_url : gon.default_avatar_url;
        
        
        Severity: Minor
        Found in app/assets/javascripts/users_select.js - About 1 hr to fix

          Function onSearchInputKeyUp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            onSearchInputKeyUp(e) {
              switch (e.keyCode) {
                case KEYCODE.BACKSPACE:
                  // when trying to remove the location badge
                  if (this.lastTextLength === 0 && this.badgePresent()) {
          Severity: Minor
          Found in app/assets/javascripts/search_autocomplete.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language