sshaw/itunes_store_transporter_web

View on GitHub
app/helpers/jobs_helper.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method current_search_query has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

          def current_search_query(accounts)
            terms = []

            [:priority, :state, :target, :type].each do |name|
              next if params[name].blank?
Severity: Minor
Found in app/helpers/jobs_helper.rb - About 2 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 current_search_query has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def current_search_query(accounts)
            terms = []

            [:priority, :state, :target, :type].each do |name|
              next if params[name].blank?
Severity: Minor
Found in app/helpers/jobs_helper.rb - About 1 hr to fix

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

              def sort_by(column)
                current_column, current_dir = params[:order].to_s.split(":")
    
                dir  = current_dir == "asc" ? "desc" : "asc"
                link = link_to(column.titleize, current_path(params.merge(:order => "#{column}:#{dir}")))
    Severity: Minor
    Found in app/helpers/jobs_helper.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 account_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

              def account_options(accounts)
                options = []
    
                Array(accounts).sort_by { |u| u.username }.group_by(&:username).each do |_, users|
                  users.each do |u|
    Severity: Minor
    Found in app/helpers/jobs_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 format_option_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

              def format_option_value(name, value)
                if name == :rate && value.present?
                  number_with_delimiter(value) << " Kbps"
                elsif name == :password
                  "*" * 8
    Severity: Minor
    Found in app/helpers/jobs_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

    There are no issues that match your filters.

    Category
    Status