Skip to content

Commit

Permalink
Update Rubocop gem and ruby-style
Browse files Browse the repository at this point in the history
Update rubocop to the last version since there's a
security issue in the version 0.4.5.

I add new rules to make sure the current code is still valid.
  • Loading branch information
dechuck committed Sep 15, 2017
1 parent db9f9a4 commit 08cce87
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 25 deletions.
28 changes: 16 additions & 12 deletions .ruby-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ Style/CollectionMethods:
find: detect
find_all: select
reduce: inject
Style/DotPosition:
Style/Encoding:
Description: Checks whether the source file has a utf-8 encoding comment or not
Enabled: false
Layout/DotPosition:
Description: Checks the position of the dot in multi-line method calls.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
Enabled: true
EnforcedStyle: trailing
SupportedStyles:
- leading
- trailing
Style/FileName:
Naming/FileName:
Description: Use snake_case for source file names.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
Enabled: false
Expand Down Expand Up @@ -58,7 +61,7 @@ Style/PercentLiteralDelimiters:
"%w": "()"
"%W": "()"
"%x": "()"
Style/PredicateName:
Naming/PredicateName:
Description: Check the names of predicate methods.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
Enabled: true
Expand Down Expand Up @@ -124,24 +127,19 @@ Style/TrailingCommaInArguments:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
Enabled: false
EnforcedStyleForMultiline: no_comma
SupportedStyles:
- comma
- consistent_comma
- no_comma
Style/TrailingCommaInLiteral:
Description: 'Checks for trailing comma in array and hash literals.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
Enabled: false
EnforcedStyleForMultiline: no_comma
SupportedStyles:
- comma
- consistent_comma
- no_comma
Metrics/AbcSize:
Description: A calculated magnitude based on number of assignments, branches, and
conditions.
Enabled: false
Max: 15
Metrics/BlockLength:
Description: Checks if the length of a block exceeds some maximum value
Enabled: false
Metrics/ClassLength:
Description: Avoid classes longer than 100 lines of code.
Enabled: false
Expand Down Expand Up @@ -191,7 +189,7 @@ Lint/AssignmentInCondition:
Style/InlineComment:
Description: Avoid inline comments.
Enabled: false
Style/AccessorMethodName:
Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
Enabled: false
Style/Alias:
Expand Down Expand Up @@ -233,6 +231,9 @@ Style/SpecialGlobalVars:
Description: Avoid Perl-style global variables.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
Enabled: false
Style/SymbolArray:
Description: Check for array literals made up of symbols that are not using the %i() syntax
Enabled: false
Style/VariableInterpolation:
Description: Don't interpolate global, instance and class variables directly in
strings.
Expand All @@ -242,6 +243,9 @@ Style/WhenThen:
Description: Use when x then ... for one-line cases.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
Enabled: false
Layout/EmptyLineAfterMagicComment:
Description: Checks for a newline after the final magic comment.
Enabled: false
Lint/EachWithObjectArgument:
Description: Check for immutable argument given to each_with_object.
Enabled: true
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
ruby "2.4.0"

Expand Down Expand Up @@ -85,7 +86,7 @@ group :development, :test do
gem "pry"
gem "rspec-its"
gem "rspec-rails"
gem "rubocop", "~> 0.45.0", require: false
gem "rubocop", "~> 0.50.0", require: false
gem "shoulda-matchers"
gem "sqlite3"
gem "timecop"
Expand Down
12 changes: 7 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ GEM
font-awesome-sass (4.7.0)
sass (>= 3.2)
formatador (0.2.5)
friendly_id (5.2.1)
friendly_id (5.2.2)
activerecord (>= 4.0.0)
gemoji (3.0.0)
globalid (0.4.0)
Expand Down Expand Up @@ -261,6 +261,7 @@ GEM
omniauth-oauth (~> 1.1)
rack
orm_adapter (0.5.0)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.21.0)
Expand Down Expand Up @@ -347,10 +348,11 @@ GEM
rspec-mocks (~> 3.6.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rubocop (0.45.0)
parser (>= 2.3.1.1, < 3.0)
rubocop (0.50.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.3)
Expand Down Expand Up @@ -485,7 +487,7 @@ DEPENDENCIES
reverse_markdown
rspec-its
rspec-rails
rubocop (~> 0.45.0)
rubocop (~> 0.50.0)
sass-rails
shoulda-matchers
simple_form
Expand Down
3 changes: 1 addition & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def from_omniauth(auth)

def new_with_session(params, session)
super.tap do |user|
if data = session["devise.github_data"] &&
session["devise.github_data"]["extra"]["raw_info"]
if data = session.dig("devise.github_data", "extra", "raw_info")
user.email = data["email"] if user.email.blank?
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/slack_invitation_sending_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def url
set_active: true,
_attempts: 1,
token: @token,
email: URI.escape(@user.email)
email: CGI.escape(@user.email)
}.to_param)
end
end
4 changes: 2 additions & 2 deletions spec/controllers/members_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
it { is_expected.to redirect_to edit_member_path }

it "updates the member" do
expect { subject }.to change { member.reload.twitter_handle }
expect { subject }.to(change { member.reload.twitter_handle })
end

context "with invalid attributes" do
Expand All @@ -38,7 +38,7 @@
it { is_expected.to render_template :edit }

it "updates the member" do
expect { subject }.to_not change { member.reload.twitter_handle }
expect { subject }.to_not(change { member.reload.twitter_handle })
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
end

it "includes only scheduled talks" do
expect(event.talks).to match talks.select { |t| t.state == "scheduled" }
expect(event.talks).to_not match talks.select { |t| t.state == "proposed" }
expect(event.talks).to match(talks.select { |t| t.state == "scheduled" })
expect(event.talks).to_not match(talks.select { |t| t.state == "proposed" })
end
end

Expand Down

0 comments on commit 08cce87

Please sign in to comment.