hugopl/reviewit

View on GitHub

Showing 32 of 32 total issues

Method start_reading_interdiff_file_metadata has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def start_reading_interdiff_file_metadata(line)
    new_file_line = line =~ /^(diff -u|---|\+\+\+)/
    interdiff_tag = line =~ /^(reverted|unchanged|only in patch2|only in patch1)/
    return false if !new_file_line && !interdiff_tag

Severity: Minor
Found in app/models/diff.rb - About 1 hr to fix

    Method state_reading_file_metadata has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def state_reading_file_metadata(line)
        case line
        when /^new file mode (.+)/
          @file.status = :new
          @file.new_chmod = $1
    Severity: Minor
    Found in app/models/diff.rb - About 1 hr to fix

      Method inject_default_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def inject_default_params(app)
            return if ARGV.include?('--help') || ARGV.include?('-h')
      
            raw_default_params = app.git_config("reviewit.config#{app.action_name}")
            return if raw_default_params.empty?
      Severity: Minor
      Found in lib/reviewit/lib/reviewit/action/action.rb - About 55 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 send_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def send_request(relative_url, params, method = :post)
            klass = method == :get ? Net::HTTP::Get : Net::HTTP::Post
      
            uri = URI(url_for(relative_url))
            req = klass.new(uri.to_s)
      Severity: Minor
      Found in lib/reviewit/lib/reviewit/api.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 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          params[:project].delete(:jira_password) if (params[:project] || {})[:jira_password].blank?
      
          if project.update_attributes(project_params)
            flash[:success] = 'The project was successfully updated.'
      Severity: Minor
      Found in app/controllers/projects_controller.rb - About 35 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 diff_file_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def diff_file_status(file)
          labels = {}
          labels[number_to_human_size(file.size)] = 'black' if file.binary? && !file.delta?
      
          if file.new?
      Severity: Minor
      Found in app/helpers/merge_requests_helper.rb - About 35 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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def perform(patch_id, push_type)
          fail("Wrong push type (#{push_type})") unless PUSH_TYPES.include?(push_type)
      
          patch = Patch.find(patch_id)
          repository = patch.project.repository
      Severity: Minor
      Found in app/workers/git_push_worker.rb - About 35 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 print_colored_diff has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def print_colored_diff(diff)
            line_to_end_intersection = 0
            diff.each_line do |line|
              if line.start_with? 'd'
                color = WHITE
      Severity: Minor
      Found in lib/reviewit/lib/reviewit/action/show.rb - About 35 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 install_rme_gem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def install_rme_gem
        gem_file = "/tmp/#{File.basename(@gem_url)}"
        puts 'Downloading reviewit gem...'
        uri = URI(@gem_url)
        http = Net::HTTP.new(uri.host, uri.port)
      Severity: Minor
      Found in lib/reviewit/install.rb - About 35 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 process_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_response(response)
            upgrade_and_exit! if response.code == '426'
            update_configuration_and_exit! if response.code == '460'
      
            raise response.body if response.code =~ /[^2]\d\d/
      Severity: Minor
      Found in lib/reviewit/lib/reviewit/api.rb - About 35 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 base_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def base_text(method, options)
          html_args = { id: id(method), placeholder: options[:placeholder] }
          html_args[:autofocus] = true if options[:autofocus]
          html_args[:type] ||= options[:type] if options.key?(:type)
          html_args[:name] ||= "#{@object_name}[#{method}]"
      Severity: Minor
      Found in app/helpers/semantic_ui_form_builder.rb - About 25 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 integrate! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def integrate!(reviewer, patch_id = :not_specified)
          raise 'You tried to accept an outdated version of this merge request.' if patch.id != patch_id &&
                                                                                    patch_id != :not_specified
          raise 'This merge request is already closed.' if closed?
          raise 'This merge request is being integrated by another request, please wait' if integrating?
      Severity: Minor
      Found in app/models/merge_request.rb - About 25 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