gitlabhq/gitlabhq

View on GitHub

Showing 1,605 of 2,285 total issues

Method edit_button_tag has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def edit_button_tag(blob, common_classes, text, edit_path, project, ref)
Severity: Minor
Found in app/helpers/blob_helper.rb - About 45 mins to fix

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

      def show
        return render_404 unless uploader&.exists?
    
        # We need to reset caching from the applications controller to get rid of the no-store value
        headers['Cache-Control'] = ''
    Severity: Minor
    Found in app/controllers/concerns/uploads_actions.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 index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        can_manage_members = can?(current_user, :admin_group_member, @group)
    
        @sort = params[:sort].presence || sort_value_name
        @project = @group.projects.find(params[:project_id]) if params[:project_id]
    Severity: Minor
    Found in app/controllers/groups/group_members_controller.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
          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 ldap_security_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def ldap_security_check
        if current_user && current_user.requires_ldap_check?
          return unless current_user.try_obtain_ldap_lease
    
          unless Gitlab::Auth::LDAP::Access.allowed?(current_user)
    Severity: Minor
    Found in app/controllers/application_controller.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def execute(request)
            instantiate_application.tap do |application|
              if application.has_attribute?(:hostname)
                application.hostname = params[:hostname]
              end
    Severity: Minor
    Found in app/services/clusters/applications/base_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 blob has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def blob
        @blob ||= @repository.blob_at(@commit.id, @path)
    
        if @blob
          @blob
    Severity: Minor
    Found in app/controllers/projects/blob_controller.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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def show
        @path = Rack::Utils.clean_path_info(path_params[:path])
    
        respond_to do |format|
          format.any(:markdown, :md, :html) do
    Severity: Minor
    Found in app/controllers/help_controller.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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def update
        @service.attributes = service_params[:service]
    
        saved = @service.save(context: :manual_change)
    
    
    Severity: Minor
    Found in app/controllers/projects/services_controller.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        bitbucket_client = Bitbucket::Client.new(credentials)
    
        repo_id = params[:repo_id].to_s
        name = repo_id.gsub('___', '/')
    Severity: Minor
    Found in app/controllers/import/bitbucket_controller.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 bulk_destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def bulk_destroy
            unless params[:ids].present?
              head :bad_request
              return
            end
    Severity: Minor
    Found in app/controllers/projects/registry/tags_controller.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 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 enforce_terms! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def enforce_terms!
        return unless current_user
        return if current_user.terms_accepted?
    
        message = _("Please accept the Terms of Service before continuing.")
    Severity: Minor
    Found in app/controllers/application_controller.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 service_test_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def service_test_response
        if @service.update(service_params[:service])
          data = @service.test_data(project, current_user)
          outcome = @service.test(data)
    
    
    Severity: Minor
    Found in app/controllers/projects/services_controller.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 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 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
      Severity
      Category
      Status
      Source
      Language