Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rubocop config #1363

Merged
merged 5 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -117,9 +113,6 @@ Lint/ShadowedException:
Style/CollectionMethods:
Enabled: false

Style/AccessorMethodName:
Enabled: false

Style/Alias:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylealias
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions app/controllers/alchemy/admin/pictures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/alchemy/content/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def is_an_essence?(essence_type)
rescue NameError
false
end
end # end class methods
end

# Instance Methods

Expand Down
1 change: 0 additions & 1 deletion lib/alchemy/shell.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'thor/shell/color'

module Alchemy
Expand Down
8 changes: 4 additions & 4 deletions spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion spec/features/admin/legacy_page_url_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

describe 'Legacy page url management', type: :feature, js: true do
Expand Down
12 changes: 6 additions & 6 deletions spec/features/admin/resources_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion spec/helpers/alchemy/pages_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

module Alchemy
Expand Down
1 change: 0 additions & 1 deletion spec/models/alchemy/attachment_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

module Alchemy
Expand Down
1 change: 0 additions & 1 deletion spec/models/alchemy/element_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

module Alchemy
Expand Down
4 changes: 2 additions & 2 deletions spec/models/alchemy/essence_date_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion spec/models/alchemy/language_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: UTF-8
require 'spec_helper'

module Alchemy
Expand Down
2 changes: 0 additions & 2 deletions spec/models/alchemy/page_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: UTF-8

require 'spec_helper'

module Alchemy
Expand Down
1 change: 0 additions & 1 deletion spec/models/alchemy/picture_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: utf-8
require 'spec_helper'

module Alchemy
Expand Down