Skip to content

Commit

Permalink
Update rubocop to 0.67 (forem#2313) [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham authored and maestromac committed Apr 5, 2019
1 parent 1b9f243 commit b98565a
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "2"
plugins:
rubocop:
enabled: true
channel: rubocop-0-63
channel: rubocop-0-67
brakeman:
enabled: true
eslint:
Expand Down
7 changes: 5 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
inherit_from: .rubocop_todo.yml

require: rubocop-rspec
require:
- rubocop-performance
- rubocop-rspec

# our custom config
# TODO: Uncomment it after fix rubocop-todo RSpec/MultipleExpectations
Expand All @@ -12,7 +14,8 @@ RSpec/MultipleExpectations:
RSpec/DescribeClass:
Exclude:
- spec/features/**/*
- spec/requests/*
- spec/requests/**/*
- spec/system/**/*

RSpec/ExampleLength:
Max: 10
Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ group :development, :test do
gem "parallel_tests", "~> 2.27"
gem "pry-byebug", "~> 3.7"
gem "rspec-rails", "~> 3.8"
gem "rubocop", "~> 0.63", require: false
gem "rubocop-rspec", "~> 1.32"
gem "rubocop", "~> 0.67", require: false
gem "rubocop-performance", "~> 1.0", require: false
gem "rubocop-rspec", "~> 1.32", require: false
gem "spring", "~> 2.0"
gem "spring-commands-rspec", "~> 1.0"
gem "vcr", "~> 4.0"
Expand Down
17 changes: 10 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,12 @@ GEM
rack
orm_adapter (0.5.0)
os (1.0.0)
parallel (1.15.0)
parallel (1.17.0)
parallel_tests (2.27.1)
parallel
parser (2.6.2.0)
ast (~> 2.4.0)
pg (1.1.4)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
Expand All @@ -689,6 +688,7 @@ GEM
pry (~> 0.10)
pry-rails (0.3.9)
pry (>= 0.10.4)
psych (3.1.0)
public_suffix (3.0.3)
puma (3.12.0)
pundit (2.0.1)
Expand Down Expand Up @@ -798,14 +798,16 @@ GEM
rspec-retry (0.6.1)
rspec-core (> 3.3)
rspec-support (3.8.0)
rubocop (0.63.1)
rubocop (0.67.2)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.4.0)
unicode-display_width (>= 1.4.0, < 1.6)
rubocop-performance (1.0.0)
rubocop (>= 0.58.0)
rubocop-rspec (1.32.0)
rubocop (>= 0.60.0)
ruby-prof (0.17.0)
Expand Down Expand Up @@ -931,7 +933,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.4.1)
unicode-display_width (1.5.0)
uniform_notifier (1.12.1)
validate_url (1.0.6)
activemodel (>= 3.0.0)
Expand Down Expand Up @@ -1071,7 +1073,8 @@ DEPENDENCIES
rouge (~> 3.3)
rspec-rails (~> 3.8)
rspec-retry (~> 0.6)
rubocop (~> 0.63)
rubocop (~> 0.67)
rubocop-performance (~> 1.0)
rubocop-rspec (~> 1.32)
ruby-prof (~> 0.17)
rubyzip (~> 1.2, >= 1.2.2)
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ def callback_for(provider)
flash[:alert] = user_errors
redirect_to new_user_registration_url
end
rescue StandardError => error
logger.error "Log in error: #{error}"
rescue StandardError => e
logger.error "Log in error: #{e}"
logger.error "Log in error: auth data hash - #{request.env['omniauth.auth']}"
logger.error "Log in error: auth data hash - #{request.env['omniauth.error']&.inspect}"
flash[:alert] = "Log in error: #{error}"
flash[:alert] = "Log in error: #{e}"
redirect_to new_user_registration_url
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/stories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def redirect_to_changed_username_profile
def handle_possible_redirect
potential_username = params[:username].tr("@", "").downcase
@user = User.find_by("old_username = ? OR old_old_username = ?", potential_username, potential_username)
if @user&.articles&.find_by_slug(params[:slug])
if @user&.articles&.find_by(slug: params[:slug])
redirect_to "/#{@user.username}/#{params[:slug]}"
return
elsif (@organization = @article.organization)
Expand Down
8 changes: 4 additions & 4 deletions app/labor/rate_limit_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def ping_admins

SlackBot.ping(
"Rate limit exceeded. https://dev.to#{user.path}",
channel: "abuse-reports",
username: "rate_limit",
icon_emoji: ":hand:",
)
channel: "abuse-reports",
username: "rate_limit",
icon_emoji: ":hand:",
)
end
handle_asynchronously :ping_admins
end
3 changes: 0 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
resources :page_views, only: %i[create update]
resources :buffer_updates, only: [:create]


get "/notifications/:filter" => "notifications#index"
get "/notifications/:filter/:org_id" => "notifications#index"
patch "/onboarding_update" => "users#onboarding_update"
Expand All @@ -153,8 +152,6 @@

post "/pusher/auth" => "pusher#auth"

# resources :users

get "/social_previews/article/:id" => "social_previews#article"
get "/social_previews/user/:id" => "social_previews#user"
get "/social_previews/organization/:id" => "social_previews#organization"
Expand Down
4 changes: 0 additions & 4 deletions spec/system/comments/user_fills_out_comment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@
end

it "User fill out commen box then click previews and submit" do
visit user.path
visit article.path.to_s
fill_in "text-area", with: raw_comment
find(".checkbox").click
click_button("PREVIEW")

expect(page).to have_text(raw_comment)
expect(page).to have_text("MARKDOWN")
click_button("MARKDOWN")
# expect(page).to have_text(raw_comment)
expect(page).to have_text("PREVIEW")
click_button("SUBMIT")
expect(page).to have_text(raw_comment)
Expand Down
26 changes: 15 additions & 11 deletions spec/system/organization/user_updates_org_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@

it "user creates an organization" do
visit "settings/organization"
fill_in "organization[name]", with: "Organization Name"
fill_in "organization[slug]", with: "Organization"
attach_file(
"organization_profile_image",
Rails.root.join("app", "assets", "images", "android-icon-36x36.png"),
)
fill_in "Text color (hex)", with: "#ffffff"
fill_in "Background color (hex)", with: "#000000"
fill_in "organization[url]", with: "http://company.com"
fill_in "organization[summary]", with: "Summary"
fill_in "organization[proof]", with: "Proof"
fill_in_org_form
click_button "SUBMIT"
expect(page).to have_text("Your organization was successfully created and you are an admin.")
end
Expand All @@ -33,4 +23,18 @@
page.driver.browser.switch_to.alert.accept
expect(page).not_to have_text(user2.name)
end

def fill_in_org_form
fill_in "organization[name]", with: "Organization Name"
fill_in "organization[slug]", with: "Organization"
attach_file(
"organization_profile_image",
Rails.root.join("app", "assets", "images", "android-icon-36x36.png"),
)
fill_in "Text color (hex)", with: "#ffffff"
fill_in "Background color (hex)", with: "#000000"
fill_in "organization[url]", with: "http://company.com"
fill_in "organization[summary]", with: "Summary"
fill_in "organization[proof]", with: "Proof"
end
end

0 comments on commit b98565a

Please sign in to comment.