Skip to content

Commit

Permalink
Add Rubocop style config and fix violations
Browse files Browse the repository at this point in the history
  • Loading branch information
andypike committed Jun 8, 2016
1 parent 7775ee2 commit c3a584e
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 10 deletions.
25 changes: 25 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
AllCops:
Exclude:
- 'bin/**/*'
- 'spec/db/schema.rb'

Style/Documentation:
Enabled: false

Style/HashSyntax:
EnforcedStyle: hash_rockets

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/AlignParameters:
EnforcedStyle: with_fixed_indentation

Style/MultilineOperationIndentation:
EnforcedStyle: indented

Style/MultilineMethodCallIndentation:
EnforcedStyle: indented

Style/IndentationWidth:
Width: 2
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.2
2.2.3
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end
namespace :g do
desc "Generate migration"
task :migration do
name = ARGV[1] || fail("Specify name: rake g:migration your_migration")
name = ARGV[1] || raise("Specify name: rake g:migration name")
timestamp = Time.now.strftime("%Y%m%d%H%M%S")
folder = "../spec/db/migrate"
path = File.expand_path("#{folder}/#{timestamp}_#{name}.rb", __FILE__)
Expand Down
4 changes: 2 additions & 2 deletions lib/rectify/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ def |(other)
elsif eager? && other.eager?
Rectify::Query.new(cached_query | other.cached_query)
else
fail UnableToComposeQueries.new(self, other)
raise UnableToComposeQueries.new(self, other)
end
end

alias_method :merge, :|
alias merge |

def count
cached_query.count
Expand Down
4 changes: 2 additions & 2 deletions lib/rectify/rspec/stub_form.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module Rectify
class StubForm
attr_reader :attributes
attr_reader :attributes, :valid

def initialize(attributes)
@valid = attributes.fetch(:valid?, false)
@attributes = attributes.except!(:valid?)
end

def valid?
@valid
valid
end

def invalid?
Expand Down
2 changes: 1 addition & 1 deletion lib/rectify/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Rectify
VERSION = "0.6.0"
VERSION = "0.6.0".freeze
end
2 changes: 1 addition & 1 deletion spec/fixtures/command/error_command.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ErrorCommand < Rectify::Command
def call
fail "This command failed"
raise "This command failed"
end
end
4 changes: 3 additions & 1 deletion spec/lib/rectify/presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
it "returns the presenter object" do
presenter = SimplePresenter.new(:first_name => "Andy")

expect(presenter.attach_controller(EmptyController.new)).to eq(presenter)
expect(
presenter.attach_controller(EmptyController.new)
).to eq(presenter)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
config.around(:each) do |test|
ActiveRecord::Base.transaction do
test.run
fail ActiveRecord::Rollback
raise ActiveRecord::Rollback
end
end

Expand Down

0 comments on commit c3a584e

Please sign in to comment.