Update rubocop to 0.67 (#2313) [ci skip]

This commit is contained in:
Abraham Williams 2019-04-05 12:55:13 -04:00 committed by Mac Siri
parent 1b9f2432f6
commit b98565a931
10 changed files with 42 additions and 38 deletions

View file

@ -2,7 +2,7 @@ version: "2"
plugins:
rubocop:
enabled: true
channel: rubocop-0-63
channel: rubocop-0-67
brakeman:
enabled: true
eslint:

View file

@ -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
@ -12,7 +14,8 @@ RSpec/MultipleExpectations:
RSpec/DescribeClass:
Exclude:
- spec/features/**/*
- spec/requests/*
- spec/requests/**/*
- spec/system/**/*
RSpec/ExampleLength:
Max: 10

View file

@ -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"

View file

@ -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)
@ -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)
@ -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)
@ -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)
@ -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)

View file

@ -43,11 +43,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
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

View file

@ -55,7 +55,7 @@ class StoriesController < ApplicationController
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)

View file

@ -30,10 +30,10 @@ class RateLimitChecker
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

View file

@ -139,7 +139,6 @@ Rails.application.routes.draw do
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"
@ -153,8 +152,6 @@ Rails.application.routes.draw do
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"

View file

@ -19,16 +19,12 @@ RSpec.describe "Creating Comment", type: :system, js: true do
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)

View file

@ -10,17 +10,7 @@ RSpec.describe "Organization setting page(/settings/organization)", type: :syste
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
@ -33,4 +23,18 @@ RSpec.describe "Organization setting page(/settings/organization)", type: :syste
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