Skip to content

Commit

Permalink
Merge pull request #244 from ifad/chore/use-guard-clauses
Browse files Browse the repository at this point in the history
Fix Style/GuardClause offenses
  • Loading branch information
tagliala authored Oct 19, 2023
2 parents cfcc9fd + 1514764 commit fbb16fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
10 changes: 1 addition & 9 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions lib/active_record/connection_adapters/chronomodel_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ def chronomodel_connection(config) # :nodoc:

adapter
rescue ::PG::Error => e
if e.message.include?(conn_params[:dbname])
raise ActiveRecord::NoDatabaseError
else
raise
end
raise ActiveRecord::NoDatabaseError if e.message.include?(conn_params[:dbname])

raise
end
end
end
6 changes: 3 additions & 3 deletions lib/chrono_model/adapter/migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ def chrono_make_temporal_table(table_name, options)
# Optionally copy the plain table data, setting up history
# retroactively.
#
if options[:copy_data]
chrono_copy_temporal_to_history(table_name, options)
end
return unless options[:copy_data]

chrono_copy_temporal_to_history(table_name, options)
end

def chrono_copy_temporal_to_history(table_name, options)
Expand Down
6 changes: 3 additions & 3 deletions lib/chrono_model/time_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def inherited(subclass)
# Sadly, we can't avoid it by calling +.history?+, because in the
# subclass the HistoryModel hasn't been included yet.
#
unless subclass.name.nil?
ChronoModel::TimeMachine.define_history_model_for(subclass)
end
return if subclass.name.nil?

ChronoModel::TimeMachine.define_history_model_for(subclass)
end
end
end
Expand Down

0 comments on commit fbb16fa

Please sign in to comment.