hacken-in/hacken-in

View on GitHub

Showing 48 of 144 total issues

Complex method Radar::Base#update_event (21.2)
Open

    def update_event(event)
      entry = @radar_setting.entries.find_or_create_by(entry_id: event[:id].to_s)
      if (entry.entry_date != event[:time] ||
          entry.previous_confirmed_content != event.except(:id, :time))

Severity: Minor
Found in lib/radar/base.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

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

  def css_class
    [
      (active ? "active" : false),
      (has_events ? "has_events" : false),
      (date == Date.today ? "today" : false)
Severity: Minor
Found in app/presenters/day_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

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

    def update
      params[:event][:schedule_rules] = JSON.parse(params[:event][:schedule_rules]) if params[:event][:schedule_rules]
      params[:event][:excluded_times] = JSON.parse(params[:event][:excluded_times]) if params[:event][:excluded_times]
      reconstruct_start_time
      update! do |success|
Severity: Minor
Found in app/admin/events.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      params[:event][:schedule_rules] = JSON.parse(params[:event][:schedule_rules]) if params[:event][:schedule_rules]
      params[:event][:excluded_times] = JSON.parse(params[:event][:excluded_times]) if params[:event][:excluded_times]
      reconstruct_start_time
      create! do |success|
Severity: Minor
Found in app/admin/events.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 add_missing_to_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_missing_to_list(handles, list)
    handles_in_list = members(list).map(&:screen_name)
    (handles - handles_in_list).each do |screen_name|
      begin
        request_wrapper do
Severity: Minor
Found in lib/twitter_list_updater.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

Complex method AuthorizationsController#destroy (20.7)
Open

  def destroy
    @auth = current_user.authorizations.find_by_id(params[:id])
    if (current_user.needs_one_authorization?)
      redirect_to edit_user_registration_path, notice: t('registrations.oauth.only_one_no_password')
    else

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method TwitterHashTagFixer#fix_twitter (20.6)
Open

  def fix_twitter
    if twitter 
      if twitter[0] == '@'
        self.twitter = twitter[1..-1]
      elsif m = twitter.match(/http(?:s)?:\/\/twitter.com\/(.*)/)
Severity: Minor
Found in lib/twitter_hash_tag_fixer.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method Event#closest_single_event (20.4)
Open

  def closest_single_event(date=Date.today)
    return nil if single_events.to_a.empty?

    coming_up = single_events.to_a.select { |s| s.occurrence.to_date >= date }.sort_by { |s| s.occurrence }

Severity: Minor
Found in app/models/event.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Severity
Category
Status
Source
Language