maxnitze/football_homepage

View on GitHub

Showing 5 of 24 total issues

Method handle_local_links has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_local_links text
    Nokogiri::HTML(text).css('a').each do |url|
      if is_local_link url['href']
        orig_url_s = url.to_s
        url.remove_attribute 'rel' if url['rel'] && url['rel'].eql?('nofollow')
Severity: Minor
Found in app/helpers/application_helper.rb - About 1 hr 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 9 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    respond_to do |format|
      any_newstext_valid = I18n.available_locales.map do |locale|
        newstext = Newstext.find_or_initialize_by(news: @news, language: locale)
        newstext.assign_attributes(newstext_params locale)
Severity: Minor
Found in app/controllers/news_controller.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @league_team = LeagueTeam.new(league_team_params)

    respond_to do |format|
      if @league_team.save
Severity: Minor
Found in app/controllers/league_teams_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 get_scheme_host_port_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_scheme_host_port_s uri
      "#{uri.scheme ? "#{uri.scheme}://" : ""}#{uri.host}#{uri.port ? ":#{uri.port}" : ""}" if uri.host
    end
Severity: Minor
Found in app/helpers/application_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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    respond_to do |format|
      if @user.update(user_params)
        sign_in(@user == current_user ? @user : current_user, bypass: true)
        format.html { redirect_to @user, notice: [ t('users.flash.update.success') ] }
Severity: Minor
Found in app/controllers/users_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

Severity
Category
Status
Source
Language