Skip to content

Commit

Permalink
rubocop step 1
Browse files Browse the repository at this point in the history
  • Loading branch information
aivils committed Apr 12, 2019
1 parent 68474b0 commit d5aa615
Show file tree
Hide file tree
Showing 239 changed files with 2,038 additions and 1,984 deletions.
50 changes: 37 additions & 13 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ Layout/SpaceInsideBlockBraces:

# Offense count: 57
# Cop supports --auto-correct.
Layout/SpaceInsideBrackets:
Layout/SpaceInsideArrayLiteralBrackets:
Enabled: false

# Offense count: 1571
Expand Down Expand Up @@ -466,7 +466,7 @@ Lint/AssignmentInCondition:
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith.
# SupportedStylesAlignWith: either, start_of_block, start_of_line
Lint/BlockAlignment:
Layout/BlockAlignment:
Exclude:
- 'app/controllers/people_controller.rb'
- 'app/mailers/person_mailer.rb'
Expand Down Expand Up @@ -500,7 +500,7 @@ Lint/DuplicateMethods:
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
# SupportedStylesAlignWith: keyword, variable, start_of_line
Lint/EndAlignment:
Layout/EndAlignment:
Enabled: false

# Offense count: 1
Expand Down Expand Up @@ -709,7 +709,7 @@ Security/YAMLLoad:
- 'lib/tasks/sharetribe_db.rake'

# Offense count: 16
Style/AccessorMethodName:
Naming/AccessorMethodName:
Exclude:
- 'app/controllers/admin/categories_controller.rb'
- 'app/controllers/listings_controller.rb'
Expand Down Expand Up @@ -992,14 +992,14 @@ Style/MethodDefParentheses:
- 'app/models/sortable_by_priority.rb'

# Offense count: 1
Style/MethodMissing:
Style/MethodMissingSuper:
Exclude:
- 'lib/services/paypal_service/test_logger.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: snake_case, camelCase
Style/MethodName:
Naming/MethodName:
Exclude:
- 'features/step_definitions/admin_look_and_feel_steps.rb'

Expand Down Expand Up @@ -1179,7 +1179,7 @@ Style/PerlBackrefs:
# NamePrefix: is_, has_, have_
# NamePrefixBlacklist: is_, has_, have_
# NameWhitelist: is_a?
Style/PredicateName:
Naming/PredicateName:
Enabled: false

# Offense count: 5
Expand Down Expand Up @@ -1393,7 +1393,7 @@ Style/TrailingCommaInArguments:
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInLiteral:
Style/TrailingCommaInArrayLiteral:
Enabled: false

# Offense count: 1
Expand Down Expand Up @@ -1445,7 +1445,7 @@ Style/UnneededPercentQ:
# Offense count: 8
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: snake_case, normalcase, non_integer
Style/VariableNumber:
Naming/VariableNumber:
Exclude:
- 'spec/services/paypal_service/data_types/ipn_spec.rb'
- 'spec/services/transaction_service/process_spec.rb'
Expand Down Expand Up @@ -1488,15 +1488,12 @@ Rails/Delegate:
- 'app/models/person.rb'

Rails/DynamicFindBy:
Enabled: false
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'features/**/*'


Rails/DynamicFindBy:
Enabled: false

Rails/FilePath:
Exclude:
- 'spec/**/*'
Expand Down Expand Up @@ -1682,3 +1679,30 @@ Rails/Validation:
Rails/UniqBeforePluck:
Exclude:
- 'app/services/marketplace_service/inbox.rb'

Naming/UncommunicativeMethodParamName:
MinNameLength: 1

Naming/ConstantName:
Enabled: false

Style/AccessModifierDeclarations:
Exclude:
- 'test/helper_modules.rb'

Rails/LexicallyScopedActionFilter:
Exclude:
- 'app/controllers/**/*'

Naming/RescuedExceptionsVariableName:
Enabled: false

Naming/MemoizedInstanceVariableName:
Exclude:
- 'app/services/paypal_service/ipn_injector.rb'
- 'app/services/paypal_service/paypal_service_injector.rb'
- 'app/services/transaction_service/jobs/process_preauthorize_command.rb'
- 'app/services/email_service/email_service_injector.rb'
- 'app/services/custom_landing_page/listing_store.rb'
- 'app/services/custom_landing_page/category_store.rb'

6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ gem 'flying-sphinx', '~> 1.2.0'
# Use patched v2.0.2
# Fixes issues: Create a new delayed delta job if there is an existing delta job which has failed
gem 'ts-delayed-delta',
:git => 'https://github.com/pat/ts-delayed-delta.git',
:git => 'https://github.com/pat/ts-delayed-delta.git',
:branch => 'master',
:ref => '0aef2195f3acc1da048f18bc0191c90538565705'
:ref => '0aef2195f3acc1da048f18bc0191c90538565705'
gem 'possibly', '~> 1.0.1'

gem 'delayed_job', '~> 4.1.3'
Expand Down Expand Up @@ -107,7 +107,7 @@ group :staging, :production do
end

group :development, :test do
gem 'rubocop', '~> 0.49.1', require: false
gem 'rubocop', '~> 0.67.2', require: false
gem 'factory_girl_rails', '~> 4.8.0'
end

Expand Down
18 changes: 10 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ GEM
innertube (1.1.0)
intercom (3.5.14)
json (>= 1.8)
jaro_winkler (1.5.2)
jmespath (1.3.1)
joiner (0.3.4)
activerecord (>= 4.1.0)
Expand Down Expand Up @@ -362,7 +363,7 @@ GEM
mime-types
mimemagic (~> 0.3.0)
parallel (1.17.0)
parser (2.6.2.0)
parser (2.6.2.1)
ast (~> 2.4.0)
passenger (6.0.1)
rack
Expand All @@ -375,7 +376,6 @@ GEM
paypal-sdk-permissions (1.96.4)
paypal-sdk-core (~> 0.3.0)
possibly (1.0.1)
powerpack (0.1.2)
premailer (1.10.4)
addressable
css_parser (>= 1.4.10)
Expand All @@ -386,6 +386,7 @@ GEM
pry-byebug (3.7.0)
byebug (~> 11.0)
pry (~> 0.10)
psych (3.1.0)
public_suffix (2.0.5)
pusher-client (0.6.2)
json
Expand Down Expand Up @@ -485,13 +486,14 @@ GEM
rspec_junit_formatter (0.2.3)
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.49.1)
rubocop (0.67.2)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
parser (>= 2.5, != 2.5.1.1)
psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
unicode-display_width (>= 1.4.0, < 1.6)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)
Expand Down Expand Up @@ -670,7 +672,7 @@ DEPENDENCIES
rest-client (~> 2.0.2)
rspec-rails (~> 3.6.0)
rspec_junit_formatter
rubocop (~> 0.49.1)
rubocop (~> 0.67.2)
rubyzip (~> 1.2.2)
sass (~> 3.4.24)
sass-rails (~> 5.0.6)
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require File.expand_path('config/application', __dir__)
require 'rake'

begin
require 'delayed/tasks'
rescue LoadError
STDERR.puts "Run `bundle install` to install delayed_job"
warn "Run `bundle install` to install delayed_job"
end

Kassi::Application.load_tasks
4 changes: 2 additions & 2 deletions app/controllers/admin/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def update
shapes = @current_community.shapes
selected_shape_ids = shape_ids_from_params(params)

if @category.update_attributes(category_params)
if @category.update(category_params)
update_category_listing_shapes(selected_shape_ids, @category)
redirect_to admin_categories_path
else
Expand All @@ -57,7 +57,7 @@ def update
def order
new_sort_order = params[:order].map(&:to_i).each_with_index
order_categories!(new_sort_order)
render body: nil, status: 200
render body: nil, status: :ok
end

# Remove form
Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin/communities/footer_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Admin::Communities::FooterController < Admin::AdminBaseController

def update
return if @service.plan_footer_disabled?

if @service.update
flash[:notice] = t('layouts.notifications.community_updated')
redirect_to admin_footer_edit_path
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/communities/topbar_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def update

menu_links_params[:logo_link] = params[:logo_link]

if @current_community.update_attributes(menu_links_params)
if @current_community.update(menu_links_params)
flash[:notice] = t("layouts.notifications.community_updated")
redirect_to admin_topbar_edit_path
else
Expand Down
11 changes: 6 additions & 5 deletions app/controllers/admin/communities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ def check_email_status

render json: HashUtils.camelize_keys(address.merge(translated_verification_sent_time_ago: time_ago(address[:verification_requested_at])))
else
render json: {error: res.error_msg }, status: 500
render json: {error: res.error_msg }, status: :internal_server_error
end

end

def resend_verification_email
EmailService::API::Api.addresses.enqueue_verification_request(community_id: @current_community.id, id: params[:address_id])
render json: {}, status: 200
render json: {}, status: :ok
end

def social_media
Expand Down Expand Up @@ -265,7 +265,7 @@ def update_analytics

def delete_marketplace
if can_delete_marketplace?(@current_community.id) && params[:delete_confirmation] == @current_community.ident
@current_community.update_attributes(deleted: true)
@current_community.update(deleted: true)

redirect_to Maybe(delete_redirect_url(APP_CONFIG)).or_else(:community_not_found)
else
Expand Down Expand Up @@ -296,7 +296,7 @@ def images_changed?(params)
end

def update(model, params, path, action, &block)
if model.update_attributes(params)
if model.update(params)
flash[:notice] = t("layouts.notifications.community_updated")
block.call(model) if block_given? #on success, call optional block
redirect_to path
Expand Down Expand Up @@ -335,7 +335,7 @@ def ensure_white_label_plan

def update_feature_flags(community_id:, person_id:, user_enabled:, user_disabled:, community_enabled:, community_disabled:)
updates = []
updates << ->() {
updates << -> {
FeatureFlagService::API::Api.features.enable(community_id: community_id, person_id: person_id, features: user_enabled)
} unless user_enabled.blank?
updates << ->(*) {
Expand All @@ -354,6 +354,7 @@ def update_feature_flags(community_id:, person_id:, user_enabled:, user_disabled
def find_or_initialize_customizations
@current_community.locales.each do |locale|
next if @current_community.community_customizations.find_by_locale(locale)

@current_community.community_customizations.create(
slogan: @current_community.slogan,
description: @current_community.description,
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/admin/community_customizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def update_details
customizations = find_or_initialize_customizations_for_locale(locale)
customizations.assign_attributes(locale_params)
analytic.process(customizations)
update_results.push(customizations.update_attributes({}))
update_results.push(customizations.update({}))
customizations
end

Expand All @@ -51,13 +51,13 @@ def update_details
end

transaction_agreement_checked = Maybe(params)[:community][:transaction_agreement_checkbox].is_some?
update_results.push(@current_community.update_attributes(transaction_agreement_in_use: transaction_agreement_checked))
update_results.push(@current_community.update(transaction_agreement_in_use: transaction_agreement_checked))

show_slogan = Maybe(params)[:community][:show_slogan].is_some?
update_results.push(@current_community.update_attributes(show_slogan: show_slogan))
update_results.push(@current_community.update(show_slogan: show_slogan))

show_description = Maybe(params)[:community][:show_description].is_some?
update_results.push(@current_community.update_attributes(show_description: show_description))
update_results.push(@current_community.update(show_description: show_description))

analytic.send_properties
if update_results.all? && (!process_locales || enabled_locales_valid)
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/admin/community_memberships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ def unban

def promote_admin
if @service.removes_itself?
render body: nil, status: 405
render body: nil, status: :method_not_allowed
else
@service.promote_admin
render body: nil, status: 200
render body: nil, status: :ok
end
end

def posting_allowed
@service.posting_allowed
render body: nil, status: 200
render body: nil, status: :ok
end

def resend_confirmation
@service.resend_confirmation
render body: nil, status: 200
render body: nil, status: :ok
end

private
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/admin/community_seo_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def update
:category_meta_description,
]
)
@current_community.update_attributes(meta_params)
@current_community.update(meta_params)
redirect_to action: :show
end

Expand All @@ -31,6 +31,7 @@ def update
def find_or_initialize_customizations
@current_community.locales.each do |locale|
next if @current_community.community_customizations.find_by_locale(locale)

@current_community.community_customizations.create(
slogan: @current_community.slogan,
description: @current_community.description,
Expand Down
Loading

0 comments on commit d5aa615

Please sign in to comment.