diff --git a/.rubocop.yml b/.rubocop.yml index 92eb3c8f86..cde3f165f6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -25,10 +25,6 @@ Style/EmptyLiteral: Style/ClassVars: Enabled: false -# We need these names for backwards compatability -Style/PredicateName: - Enabled: false - # This has been used for customization Style/MutableConstant: Enabled: false @@ -117,9 +113,6 @@ Lint/ShadowedException: Style/CollectionMethods: Enabled: false -Style/AccessorMethodName: - Enabled: false - Style/Alias: Enabled: false StyleGuide: http://relaxed.ruby.style/#stylealias @@ -217,9 +210,6 @@ Style/StringLiterals: Enabled: false StyleGuide: http://relaxed.ruby.style/#stylestringliterals -Style/VariableNumber: - Enabled: false - Style/WhileUntilModifier: Enabled: false StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier @@ -280,3 +270,13 @@ Metrics/ParameterLists: Metrics/PerceivedComplexity: Enabled: false + +Naming/AccessorMethodName: + Enabled: false + +# We need these names for backwards compatability +Naming/PredicateName: + Enabled: false + +Naming/VariableNumber: + Enabled: false diff --git a/app/controllers/alchemy/admin/pictures_controller.rb b/app/controllers/alchemy/admin/pictures_controller.rb index 2e7ccbee5b..155ebe5d24 100644 --- a/app/controllers/alchemy/admin/pictures_controller.rb +++ b/app/controllers/alchemy/admin/pictures_controller.rb @@ -92,7 +92,7 @@ def delete_multiple else flash[:warn] = Alchemy.t("Could not delete Pictures") end - rescue => e + rescue StandardError => e flash[:error] = e.message ensure redirect_to_index @@ -102,7 +102,7 @@ def destroy name = @picture.name @picture.destroy flash[:notice] = Alchemy.t("Picture deleted successfully", name: name) - rescue => e + rescue StandardError => e flash[:error] = e.message ensure redirect_to_index diff --git a/app/models/alchemy/content/factory.rb b/app/models/alchemy/content/factory.rb index 012a641d72..1f1909e53f 100644 --- a/app/models/alchemy/content/factory.rb +++ b/app/models/alchemy/content/factory.rb @@ -129,7 +129,7 @@ def is_an_essence?(essence_type) rescue NameError false end - end # end class methods + end # Instance Methods diff --git a/lib/alchemy/shell.rb b/lib/alchemy/shell.rb index fd9cd16c94..786f3db2a5 100644 --- a/lib/alchemy/shell.rb +++ b/lib/alchemy/shell.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 require 'thor/shell/color' module Alchemy diff --git a/spec/factories.rb b/spec/factories.rb index 76bbb2ec12..c2d1191637 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -3,10 +3,10 @@ name 'My Event' hidden_name 'not shown' location - starts_at DateTime.new(2012, 03, 02, 8, 15) - ends_at DateTime.new(2012, 03, 02, 19, 30) - lunch_starts_at DateTime.new(2012, 03, 02, 12, 15) - lunch_ends_at DateTime.new(2012, 03, 02, 13, 45) + starts_at Time.local(2012, 03, 02, 8, 15) + ends_at Time.local(2012, 03, 02, 19, 30) + lunch_starts_at Time.local(2012, 03, 02, 12, 15) + lunch_ends_at Time.local(2012, 03, 02, 13, 45) description "something\nfancy" published false entrance_fee 12.3 diff --git a/spec/features/admin/legacy_page_url_management_spec.rb b/spec/features/admin/legacy_page_url_management_spec.rb index 98547847c4..93f03cca32 100644 --- a/spec/features/admin/legacy_page_url_management_spec.rb +++ b/spec/features/admin/legacy_page_url_management_spec.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 require 'spec_helper' describe 'Legacy page url management', type: :feature, js: true do diff --git a/spec/features/admin/resources_integration_spec.rb b/spec/features/admin/resources_integration_spec.rb index c9b347a548..1c80da186c 100644 --- a/spec/features/admin/resources_integration_spec.rb +++ b/spec/features/admin/resources_integration_spec.rb @@ -62,7 +62,7 @@ def reload_event_class before do visit '/admin/events/new' fill_in 'event_name', with: 'My second event' - fill_in 'event_starts_at', with: DateTime.new(2012, 03, 03, 20, 00) + fill_in 'event_starts_at', with: Time.local(2012, 03, 03, 20, 00) select location.name, from: 'Location' click_on 'Save' end @@ -180,16 +180,16 @@ def self.alchemy_resource_filters %w(starting_today future) end - scope :starting_today, -> { where(starts_at: DateTime.current.at_midnight..DateTime.tomorrow.at_midnight) } - scope :future, -> { where("starts_at > ?", DateTime.tomorrow.at_midnight) } + scope :starting_today, -> { where(starts_at: Time.current.at_midnight..Date.tomorrow.at_midnight) } + scope :future, -> { where("starts_at > ?", Date.tomorrow.at_midnight) } end example.run reload_event_class end - let!(:past_event) { create(:event, name: "Horse Expo", starts_at: DateTime.current - 100.years) } - let!(:today_event) { create(:event, name: "Car Expo", starts_at: DateTime.current.at_noon) } - let!(:future_event) { create(:event, name: "Hovercar Expo", starts_at: DateTime.current + 30.years) } + let!(:past_event) { create(:event, name: "Horse Expo", starts_at: Time.current - 100.years) } + let!(:today_event) { create(:event, name: "Car Expo", starts_at: Time.current.at_noon) } + let!(:future_event) { create(:event, name: "Hovercar Expo", starts_at: Time.current + 30.years) } it "lets the user filter by the defined scopes", aggregate_failures: true do visit "/admin/events" diff --git a/spec/helpers/alchemy/pages_helper_spec.rb b/spec/helpers/alchemy/pages_helper_spec.rb index 48040763be..d908b9c759 100644 --- a/spec/helpers/alchemy/pages_helper_spec.rb +++ b/spec/helpers/alchemy/pages_helper_spec.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 require 'spec_helper' module Alchemy diff --git a/spec/models/alchemy/attachment_spec.rb b/spec/models/alchemy/attachment_spec.rb index 68e3265f43..31c27db8e1 100644 --- a/spec/models/alchemy/attachment_spec.rb +++ b/spec/models/alchemy/attachment_spec.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 require 'spec_helper' module Alchemy diff --git a/spec/models/alchemy/element_spec.rb b/spec/models/alchemy/element_spec.rb index fdc5ebb556..b2d772d821 100644 --- a/spec/models/alchemy/element_spec.rb +++ b/spec/models/alchemy/element_spec.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 require 'spec_helper' module Alchemy diff --git a/spec/models/alchemy/essence_date_spec.rb b/spec/models/alchemy/essence_date_spec.rb index cfd0b0ad20..4d00f77b05 100644 --- a/spec/models/alchemy/essence_date_spec.rb +++ b/spec/models/alchemy/essence_date_spec.rb @@ -6,7 +6,7 @@ module Alchemy it_behaves_like "an essence" do let(:essence) { EssenceDate.new } - let(:ingredient_value) { DateTime.current.iso8601 } + let(:ingredient_value) { Time.current.iso8601 } end describe '#preview_text' do @@ -18,7 +18,7 @@ module Alchemy context "if date set" do it "should format the date by i18n" do - essence.date = DateTime.current + essence.date = Time.current expect(::I18n).to receive(:l).with(essence.date, format: :date) essence.preview_text end diff --git a/spec/models/alchemy/language_spec.rb b/spec/models/alchemy/language_spec.rb index 3dc021bc0d..4a97ec6777 100644 --- a/spec/models/alchemy/language_spec.rb +++ b/spec/models/alchemy/language_spec.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 require 'spec_helper' module Alchemy diff --git a/spec/models/alchemy/page_spec.rb b/spec/models/alchemy/page_spec.rb index 63371feffb..d0dd2c09a8 100644 --- a/spec/models/alchemy/page_spec.rb +++ b/spec/models/alchemy/page_spec.rb @@ -1,5 +1,3 @@ -# encoding: UTF-8 - require 'spec_helper' module Alchemy diff --git a/spec/models/alchemy/picture_spec.rb b/spec/models/alchemy/picture_spec.rb index 0452a2b64b..ab0e145047 100644 --- a/spec/models/alchemy/picture_spec.rb +++ b/spec/models/alchemy/picture_spec.rb @@ -1,4 +1,3 @@ -# encoding: utf-8 require 'spec_helper' module Alchemy