Applicat/rails_info

View on GitHub

Showing 52 of 52 total issues

Method new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def new
    repository = Grit::Repo.new(params[:repository_path])

    diff = repository.diff(
      repository.commit(params[:rev_to]), repository.commit(params[:rev]), params[:path]
Severity: Minor
Found in app/controllers/rails_info/version_control/diffs_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 tab has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def tab(tab_key)
    @content = @tabs_data[tab_key]
    
    content_tag :div, id: "tabs-#{@index}-#{@tab_index}" do
      html = if tab_key == 'Request'
Severity: Minor
Found in app/presenters/rails_info/logs/server/action_presenter.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 row has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def row
    content = content_tag :td, class: 'first' do
      check_box_tag "data[]", "#{object[:class].name};#{object['id']}", false, id: "#{object[:class].name.tableize}-#{object['id']}"
    end
    
Severity: Minor
Found in app/presenters/rails_info/data/object_presenter.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 group_by_action? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def group_by_action?
    group_by_action = false

    @body.each do |line|
      if line.match('Processing by') && line.match('#') && line.match(' as ') && line.split(' ').length == 5
Severity: Minor
Found in lib/rails_info/logs/server.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

Avoid too many return statements within this method.
Open

    parse_request(line) and return
Severity: Major
Found in lib/rails_info/logs/server.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        parse_write(line) and return
    Severity: Major
    Found in lib/rails_info/logs/server.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          parse_read(line) and return
      Severity: Major
      Found in lib/rails_info/logs/server.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return if @action.blank?
        Severity: Major
        Found in lib/rails_info/logs/server.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              parse_action(line) and return
          Severity: Major
          Found in lib/rails_info/logs/server.rb - About 30 mins to fix

            Method try_two_times has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def try_two_times(message = '')
                tries ||= 1
                
                logger.info "#{Time.now.strftime('%H:%M:%S')} #{message} (try ##{tries})"
                
            Severity: Minor
            Found in app/models/version_control/filter.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 parse_read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def parse_read(line)
                reg_exp_begin = '\[([0-9]+)m( {2}|)(SELECT.+)'
                
                #[1mCommunity Load (0.5ms)  SELECT `communities`.* FROM `communities` WHERE `communities`.`id` = 2 LIMIT 1   
                reg_exp1 = "#{reg_exp_begin}(\\[)"
            Severity: Minor
            Found in lib/rails_info/logs/server.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 request_tab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def request_tab
                clean_params = request.filtered_parameters.clone
                clean_params.delete("action")
                clean_params.delete("controller")
              
            Severity: Minor
            Found in app/presenters/rails_info/stack_trace_presenter.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