gitlabhq/gitlabhq

View on GitHub

Showing 1,834 of 1,834 total issues

Class Group has 55 methods (exceeds 20 allowed). Consider refactoring.
Open

class Group < Namespace
  include Gitlab::ConfigHelper
  include AfterCommitQueue
  include AccessRequestable
  include Avatarable
Severity: Major
Found in app/models/group.rb - About 7 hrs to fix

    Class ApplicationController has 54 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ApplicationController < ActionController::Base
      include Gitlab::GonHelper
      include GitlabRoutingHelper
      include PageLayoutHelper
      include SafeParamsHelper
    Severity: Major
    Found in app/controllers/application_controller.rb - About 7 hrs to fix

      Class File has 54 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class File
            attr_reader :diff, :repository, :diff_refs, :fallback_diff_refs
      
            delegate :new_file?, :deleted_file?, :renamed_file?,
              :old_path, :new_path, :a_mode, :b_mode, :mode_changed?,
      Severity: Major
      Found in lib/gitlab/diff/file.rb - About 7 hrs to fix

        Function Keyboard has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

        const Keyboard = function() {
          var currentKey;
          var currentFocus;
          var isUpArrow = false;
          var isDownArrow = false;
        Severity: Minor
        Found in app/assets/javascripts/droplab/keyboard.js - 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 inject_rblineprof has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

              def inject_rblineprof
                ret = nil
                profile = lineprof(rblineprof_profiler_regex) do
                  ret = yield
                end
        Severity: Minor
        Found in lib/peek/rblineprof/custom_controller_helpers.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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const localeRemaining = (number, index) =>
              [
                [s__('Timeago|just now'), s__('Timeago|right now')],
                [s__('Timeago|%s seconds ago'), s__('Timeago|%s seconds remaining')],
                [s__('Timeago|1 minute ago'), s__('Timeago|1 minute remaining')],
        Severity: Major
        Found in app/assets/javascripts/lib/utils/datetime_utility.js and 1 other location - About 7 hrs to fix
        app/assets/javascripts/lib/utils/datetime_utility.js on lines 100..116

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 185.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export default class DockerfileSelector extends FileTemplateSelector {
          constructor({ mediator }) {
            super(mediator);
            this.config = {
              key: 'dockerfile',
        app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js on lines 3..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 185.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const locale = (number, index) =>
              [
                [s__('Timeago|just now'), s__('Timeago|right now')],
                [s__('Timeago|%s seconds ago'), s__('Timeago|in %s seconds')],
                [s__('Timeago|1 minute ago'), s__('Timeago|in 1 minute')],
        Severity: Major
        Found in app/assets/javascripts/lib/utils/datetime_utility.js and 1 other location - About 7 hrs to fix
        app/assets/javascripts/lib/utils/datetime_utility.js on lines 82..98

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 185.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export default class BlobCiYamlSelector extends FileTemplateSelector {
          constructor({ mediator }) {
            super(mediator);
            this.config = {
              key: 'gitlab-ci-yaml',
        app/assets/javascripts/blob/template_selectors/dockerfile_selector.js on lines 3..30

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 185.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Class IssuableFinder has 52 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class IssuableFinder
          prepend FinderWithCrossProjectAccess
          include FinderMethods
          include CreatedAtFilter
        
        
        Severity: Major
        Found in app/finders/issuable_finder.rb - About 7 hrs to fix

          Class Event has 51 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Event < ActiveRecord::Base
            include Sortable
            include IgnorableColumn
            include FromUnion
            default_scope { reorder(nil) }
          Severity: Major
          Found in app/models/event.rb - About 7 hrs to fix

            Function GitLabDropdown has 172 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function GitLabDropdown(el1, options) {
                var searchFields, selector, self;
                this.el = el1;
                this.options = options;
                this.updateLabel = this.updateLabel.bind(this);
            Severity: Major
            Found in app/assets/javascripts/gl_dropdown.js - About 6 hrs to fix

              Class Commit has 48 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Commit
                    include Gitlab::EncodingHelper
                    extend Gitlab::Git::WrapsGitalyErrors
              
                    attr_accessor :raw_commit, :head
              Severity: Minor
              Found in lib/gitlab/git/commit.rb - About 6 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    } else {
                      reopentext = reopenbtn.data('originalText');
                      closetext = closebtn.data('originalText');
                      if (reopenbtn.text() !== reopentext) {
                        reopenbtn.text(reopentext);
                Severity: Major
                Found in app/assets/javascripts/notes.js and 1 other location - About 6 hrs to fix
                app/assets/javascripts/notes.js on lines 1204..1222

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 168.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    if (textarea.val().trim().length > 0) {
                      reopentext = reopenbtn.attr('data-alternative-text');
                      closetext = closebtn.attr('data-alternative-text');
                      if (reopenbtn.text() !== reopentext) {
                        reopenbtn.text(reopentext);
                Severity: Major
                Found in app/assets/javascripts/notes.js and 1 other location - About 6 hrs to fix
                app/assets/javascripts/notes.js on lines 1222..1240

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 168.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method each_pair has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                              def each_pair
                                state = :key
                                key = StringIO.new
                                value = StringIO.new
                                hex_buffer = ""
                Severity: Minor
                Found in lib/gitlab/background_migration/normalize_ldap_extern_uids_range.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 each_pair has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                        def each_pair
                          state = :key
                          key = StringIO.new
                          value = StringIO.new
                          hex_buffer = ""
                Severity: Minor
                Found in lib/gitlab/auth/ldap/dn.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

                File projects_helper.rb has 439 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module ProjectsHelper
                  def link_to_project(project)
                    link_to [project.namespace.becomes(Namespace), project], title: h(project.name) do
                      title = content_tag(:span, project.name, class: 'project-name')
                
                
                Severity: Minor
                Found in app/helpers/projects_helper.rb - About 6 hrs to fix

                  File common_utils.js has 433 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import $ from 'jquery';
                  import axios from './axios_utils';
                  import { getLocationHash } from './url_utility';
                  import { convertToCamelCase } from './text_utility';
                  import { isObject } from './type_utility';
                  Severity: Minor
                  Found in app/assets/javascripts/lib/utils/common_utils.js - About 6 hrs to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    export default function projectAvatar() {
                      $('.js-choose-project-avatar-button').bind('click', function onClickAvatar() {
                        const form = $(this).closest('form');
                        return form.find('.js-project-avatar-input').click();
                      });
                    app/assets/javascripts/group_avatar.js on lines 3..15

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 162.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language