Skip to content

Commit

Permalink
Rubocop: signal vs raise
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Jan 10, 2017
1 parent 975717f commit 7afa908
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 23 deletions.
12 changes: 0 additions & 12 deletions .rubocop_todo.yml
Expand Up @@ -508,18 +508,6 @@ Style/Semicolon:
- 'spec/models/fields/custom_field_spec.rb'
- 'spec/support/macros.rb'

# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: only_raise, only_fail, semantic
Style/SignalException:
Exclude:
- 'app/helpers/application_helper.rb'
- 'app/models/fields/field.rb'
- 'db/migrate/20100928030620_remove_uuid.rb'
- 'spec/factories/shared_factories.rb'
- 'spec/factories/user_factories.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Expand Up @@ -10,7 +10,7 @@ def tabs(tabs = nil)
@current_tab ||= tabs.first[:text] # Select first tab by default.
tabs.each { |tab| tab[:active] = (@current_tab == tab[:text] || @current_tab == tab[:url][:controller]) }
else
fail FatFreeCRM::MissingSettings, "Tab settings are missing, please run <b>rake ffcrm:setup</b> command."
raise FatFreeCRM::MissingSettings, "Tab settings are missing, please run <b>rake ffcrm:setup</b> command."
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/fields/field.rb
Expand Up @@ -63,7 +63,7 @@ class Field < ActiveRecord::Base
validates_inclusion_of :as, in: proc { field_types.keys }, message: "^Invalid field type.", allow_blank: true

def column_type(field_type = as)
(opts = Field.field_types[field_type]) ? opts[:type] : fail("Unknown field_type: #{field_type}")
(opts = Field.field_types[field_type]) ? opts[:type] : raise("Unknown field_type: #{field_type}")
end

def input_options
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20100928030620_remove_uuid.rb
Expand Up @@ -9,7 +9,7 @@ def self.up
end

def self.down
fail ActiveRecord::IrreversibleMigration, "Can't recover deleted UUIDs"
raise ActiveRecord::IrreversibleMigration, "Can't recover deleted UUIDs"
end

private
Expand Down
10 changes: 5 additions & 5 deletions spec/factories/shared_factories.rb
Expand Up @@ -6,14 +6,14 @@
FactoryGirl.define do
factory :version do
whodunnit ""
item { fail "Please specify :item for the version" }
item { raise "Please specify :item for the version" }
event "create"
created_at { FactoryGirl.generate(:time) }
end

factory :comment do
user
commentable { fail "Please specify :commentable for the comment" }
commentable { raise "Please specify :commentable for the comment" }
title { FactoryGirl.generate(:title) }
private false
comment { FFaker::Lorem.paragraph }
Expand All @@ -25,7 +25,7 @@
factory :email do
imap_message_id { "%08x" % rand(0xFFFFFFFF) }
user
mediator { fail "Please specify :mediator for the email" }
mediator { raise "Please specify :mediator for the email" }
sent_from { FFaker::Internet.email }
sent_to { FFaker::Internet.email }
cc { FFaker::Internet.email }
Expand All @@ -42,7 +42,7 @@
end

factory :address do
addressable { fail "Please specify :addressable for the address" }
addressable { raise "Please specify :addressable for the address" }
street1 { FFaker::Address.street_address }
street2 { FFaker::Address.street_address }
city { FFaker::Address.city }
Expand All @@ -58,7 +58,7 @@

factory :avatar do
user
entity { fail "Please specify :entity for the avatar" }
entity { raise "Please specify :entity for the avatar" }
image { File.new(Rails.root.join('spec', 'fixtures', 'rails.png')) }
updated_at { FactoryGirl.generate(:time) }
created_at { FactoryGirl.generate(:time) }
Expand Down
6 changes: 3 additions & 3 deletions spec/factories/user_factories.rb
Expand Up @@ -43,15 +43,15 @@

factory :permission do
user
asset { fail "Please specify :asset for the permission" }
asset { raise "Please specify :asset for the permission" }
updated_at { FactoryGirl.generate(:time) }
created_at { FactoryGirl.generate(:time) }
end

factory :preference do
user
name { fail "Please specify :name for the preference" }
value { fail "Please specify :value for the preference" }
name { raise "Please specify :name for the preference" }
value { raise "Please specify :value for the preference" }
updated_at { FactoryGirl.generate(:time) }
created_at { FactoryGirl.generate(:time) }
end
Expand Down

0 comments on commit 7afa908

Please sign in to comment.