Permalink
Browse files

rubocop fix Style/Space*

  • Loading branch information...
KonstantinKo committed Apr 8, 2015
1 parent fb130fd commit a67e57e30df337eb712158fcdd6fbef90e84e360
Showing with 569 additions and 644 deletions.
  1. +0 −75 .rubocop_todo.yml
  2. +6 −6 Gemfile
  3. +1 −1 Rakefile
  4. +3 −3 app/chewy/articles_index.rb
  5. +1 −1 app/controllers/addresses_controller.rb
  6. +2 −2 app/controllers/application_controller.rb
  7. +5 −5 app/controllers/articles_controller.rb
  8. +3 −3 app/controllers/bank_details_controller.rb
  9. +4 −4 app/controllers/carts_controller.rb
  10. +2 −2 app/controllers/categories_controller.rb
  11. +1 −1 app/controllers/discourse_controller.rb
  12. +2 −2 app/controllers/libraries_controller.rb
  13. +1 −1 app/controllers/mass_uploads_controller.rb
  14. +2 −2 app/controllers/payments_controller.rb
  15. +3 −3 app/controllers/registrations_controller.rb
  16. +1 −1 app/controllers/toolbox_controller.rb
  17. +1 −1 app/controllers/users_controller.rb
  18. +4 −4 app/helpers/application_helper.rb
  19. +1 −1 app/helpers/articles_helper.rb
  20. +4 −4 app/helpers/checkout_helper.rb
  21. +5 −5 app/helpers/container_helper.rb
  22. +1 −1 app/helpers/form_helper.rb
  23. +1 −1 app/helpers/statistic_helper.rb
  24. +5 −5 app/helpers/users_helper.rb
  25. +1 −1 app/helpers/welcome_helper.rb
  26. +1 −1 app/inputs/plain_radio_input.rb
  27. +1 −1 app/mailers/cart_mailer.rb
  28. +2 −2 app/mailers/devise_mailer.rb
  29. +2 −2 app/mailers/feedback_mailer.rb
  30. +2 −2 app/mailers/refund_mailer.rb
  31. +1 −1 app/models/article.rb
  32. +7 −7 app/models/article/commendation.rb
  33. +1 −1 app/models/article/extended_attributes.rb
  34. +3 −3 app/models/article/fees_and_donations.rb
  35. +1 −1 app/models/article/images.rb
  36. +2 −2 app/models/article/state.rb
  37. +5 −5 app/models/article/validations.rb
  38. +2 −2 app/models/business_transaction.rb
  39. +5 −5 app/models/business_transaction/discountable.rb
  40. +2 −2 app/models/business_transaction/refundable.rb
  41. +2 −2 app/models/business_transaction/scopes.rb
  42. +2 −2 app/models/cart.rb
  43. +1 −1 app/models/discount.rb
  44. +8 −8 app/models/fair_trust_questionnaire.rb
  45. +5 −5 app/models/feedback.rb
  46. +2 −2 app/models/library.rb
  47. +1 −1 app/models/library_element.rb
  48. +1 −1 app/models/line_item.rb
  49. +5 −5 app/models/line_item_group.rb
  50. +1 −1 app/models/mass_upload.rb
  51. +2 −2 app/models/mass_upload/fees_and_donations.rb
  52. +1 −1 app/models/mass_upload/questionnaire.rb
  53. +4 −4 app/models/mass_upload_article.rb
  54. +3 −3 app/models/remote_validation.rb
  55. +5 −5 app/models/social_producer_questionnaire.rb
  56. +5 −5 app/models/statistic.rb
  57. +4 −4 app/models/user.rb
  58. +1 −1 app/models/user/extended_attributes.rb
  59. +5 −5 app/models/user/ratings.rb
  60. +5 −5 app/models/user/validations.rb
  61. +9 −9 app/models/users/legal_entity.rb
  62. +1 −1 app/objects/abaci/abacus.rb
  63. +3 −3 app/objects/abaci/business_transaction_abacus.rb
  64. +3 −3 app/objects/abaci/cart_abacus.rb
  65. +2 −2 app/objects/abaci/donation_abacus.rb
  66. +5 −5 app/objects/abaci/payment_abacus.rb
  67. +3 −3 app/objects/abaci/preview_abacus.rb
  68. +4 −4 app/objects/abaci/transport_abacus.rb
  69. +1 −1 app/objects/coercers/price_range_parser.rb
  70. +4 −4 app/objects/form/article_search_form.rb
  71. +1 −1 app/objects/form/cart_checkout_form.rb
  72. +2 −2 app/objects/query/active_user_articles.rb
  73. +5 −5 app/objects/query/article_autocomplete.rb
  74. +9 −9 app/objects/query/article_search.rb
  75. +4 −4 app/objects/query/featured_library_query.rb
  76. +6 −6 app/objects/service/article_exporter.rb
  77. +3 −3 app/objects/service/cleverreach_api.rb
  78. +2 −2 app/objects/service/fastbill_api.rb
  79. +2 −2 app/objects/service/paypal_api.rb
  80. +1 −1 app/objects/view/html_to_text.rb
  81. +1 −1 app/observers/article_observer.rb
  82. +5 −5 app/observers/user_observer.rb
  83. +3 −3 app/policies/article_policy.rb
  84. +1 −1 app/policies/rating_policy.rb
  85. +1 −1 app/policies/user_policy.rb
  86. +10 −10 app/refineries/article_refinery.rb
  87. +1 −1 app/refineries/comment_refinery.rb
  88. +1 −1 app/refineries/content_refinery.rb
  89. +1 −1 app/refineries/image_refinery.rb
  90. +1 −1 app/refineries/library_element_refinery.rb
  91. +2 −2 app/refineries/library_refinery.rb
  92. +2 −2 app/refineries/line_item_refinery.rb
  93. +1 −1 app/refineries/mass_upload_refinery.rb
  94. +1 −1 app/refineries/user_refinery.rb
  95. +1 −1 app/validators/zip_validator.rb
  96. +5 −5 app/views/articles/show.json.jbuilder
  97. +1 −1 app/workers/broken_image_finder_worker.rb
  98. +1 −1 app/workers/mass_uploads_finish_worker.rb
  99. +1 −1 app/workers/process_mass_upload_worker.rb
  100. +3 −3 config/deploy.rb
  101. +2 −2 config/rewrites.rb
  102. +17 −17 config/routes.rb
  103. +1 −1 lib/autoload/assets/normalizer.rb
  104. +2 −2 lib/autoload/belboon_tracking.rb
  105. +3 −3 lib/autoload/fairtastic/form_builder.rb
  106. +1 −1 lib/autoload/fairtastic/helpers/input_helper.rb
  107. +3 −3 lib/autoload/fairtastic/inputs/base/input_steps.rb
  108. +2 −2 lib/autoload/paperclip_orphan_file_cleaner.rb
  109. +1 −1 lib/autoload/questionnaire_initializer.rb
  110. +3 −3 lib/autoload/single_sign_on.rb
  111. +2 −2 lib/tasks/code.rake
  112. +4 −4 lib/tasks/db.rake
  113. +4 −4 lib/tasks/images.rake
  114. +2 −2 lib/tasks/invoice.rake
  115. +2 −2 test/controllers/addresses_controller_test.rb
  116. +2 −2 test/controllers/article_templates_controller_test.rb
  117. +32 −32 test/controllers/articles_controller_test.rb
  118. +8 −8 test/controllers/categories_controller_test.rb
  119. +3 −3 test/controllers/contents_controller_test.rb
  120. +5 −5 test/controllers/library_elements_controller_test.rb
  121. +1 −1 test/controllers/payment_controller_test.rb
  122. +3 −3 test/controllers/ratings_controller_test.rb
  123. +3 −3 test/controllers/refunds_controller_test.rb
  124. +1 −1 test/controllers/registrations_controller_test.rb
  125. +2 −2 test/controllers/sessions_controller_test.rb
  126. +1 −1 test/controllers/toolbox_controller_test.rb
  127. +4 −4 test/controllers/users_controller_test.rb
  128. +1 −1 test/factories/addresses.rb
  129. +14 −14 test/factories/articles.rb
  130. +1 −1 test/factories/categories.rb
  131. +2 −2 test/factories/contents.rb
  132. +6 −6 test/factories/fair_trust_questionnaire.rb
  133. +3 −3 test/factories/feedbacks.rb
  134. +1 −1 test/factories/images.rb
  135. +1 −1 test/factories/libraries.rb
  136. +4 −4 test/factories/line_item_groups.rb
  137. +3 −3 test/factories/social_producer_questionnaire.rb
  138. +13 −13 test/factories/users.rb
  139. +1 −1 test/features/article_templates_test.rb
  140. +5 −5 test/features/articles_test.rb
  141. +4 −4 test/features/cart_test.rb
  142. +1 −1 test/features/comments_test.rb
  143. +1 −1 test/features/hearts_test.rb
  144. +1 −1 test/features/libraries_test.rb
  145. +2 −2 test/features/mass_upload_test.rb
  146. +2 −2 test/features/rating_test.rb
  147. +11 −11 test/features/refund_test.rb
  148. +1 −1 test/features/users_test.rb
  149. +1 −1 test/mailers/article_mailer_test.rb
  150. +6 −6 test/mailers/refund_mailer_test.rb
  151. +7 −7 test/models/article_test.rb
  152. +2 −2 test/models/category_test.rb
  153. +4 −4 test/models/discount_test.rb
  154. +3 −3 test/models/fastbill_api_test.rb
  155. +1 −1 test/models/image_test.rb
  156. +1 −1 test/models/line_item_group_test.rb
  157. +2 −2 test/models/mass_upload_test.rb
  158. +30 −30 test/models/user_test.rb
  159. +35 −35 test/objects/abacus_test.rb
  160. +11 −11 test/policies/refund_policy_test.rb
  161. +1 −1 test/workers/process_row_mass_upload_worker_test.rb
View
@@ -327,81 +327,6 @@ Style/SelfAssignment:
Style/Semicolon:
Enabled: false
# Offense count: 13
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false
# Offense count: 15
# Cop supports --auto-correct.
Style/SpaceAfterColon:
Enabled: false
# Offense count: 204
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAfterMethodName:
Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleInsidePipes, SupportedStyles.
Style/SpaceAroundBlockParameters:
Enabled: false
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceAroundEqualsInParameterDefault:
Enabled: false
# Offense count: 59
# Cop supports --auto-correct.
Style/SpaceAroundOperators:
Enabled: false
# Offense count: 80
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceBeforeBlockBraces:
Enabled: false
# Offense count: 66
# Cop supports --auto-correct.
Style/SpaceBeforeComma:
Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
Style/SpaceBeforeComment:
Enabled: false
# Offense count: 161
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
Style/SpaceInsideBlockBraces:
Enabled: false
# Offense count: 71
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Enabled: false
# Offense count: 188
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces:
Enabled: false
# Offense count: 269
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/SpecialGlobalVars:
View
12 Gemfile
@@ -9,7 +9,7 @@ gem 'activerecord-session_store' # sessions in activerecord
platforms :ruby do
gem 'sqlite3', group: :test # sqlite3 for inmemory testing db
gem 'therubyracer' # js runtime
gem 'pg', group: [:production,:staging,:development] # postgres
gem 'pg', group: [:production, :staging, :development] # postgres
end
# ---------- Model ----------
@@ -21,7 +21,7 @@ gem 'enumerize', '>= 0.5.1' # enums as symbols in ar
gem 'state_machine' # State Machines in Rails
gem 'amoeba'
gem 'sanitize' # Parser based sanitization
gem 'awesome_nested_set' , '>= 3.0.0.rc.4'# tree structure for categories
gem 'awesome_nested_set', '>= 3.0.0.rc.4' # tree structure for categories
gem 'friendly_id', '>= 4.0.9' # Friendly_id for beautiful links
# pseudo models
@@ -35,9 +35,9 @@ gem 'slim-rails', '>= 2.1.5'
gem 'jbuilder'
## CSS
gem 'susy' ,'~> 2.1.1' # Grid framework is susy
gem 'susy', '~> 2.1.1' # Grid framework is susy
gem 'sass-rails', '~> 5.0.0'
gem 'bourbon' , '<= 4.0.2' # easy ccs3
gem 'bourbon', '<= 4.0.2' # easy ccs3
gem 'font-awesome-rails', '>= 4.2.0.0'
gem 'sprite-factory'
gem 'chunky_png' # needed for sprite-factory
@@ -101,7 +101,7 @@ gem 'nokogiri'
gem 'prawn_rails' # pdf generation
# ---------- Monitoring ----------
gem 'newrelic_rpm', group: [:production,:staging]
gem 'newrelic_rpm', group: [:production, :staging]
gem 'rack-mini-profiler'
gem 'lograge'
@@ -191,7 +191,7 @@ group :development, :test do
gem 'bullet' # Notify about n+1 queries
end
group :development,:test,:staging do
group :development, :test, :staging do
gem 'factory_girl_rails'
gem 'ffaker'
# styleguides
View
@@ -3,7 +3,7 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
ENV['SKIP_RAILS_ADMIN_INITIALIZER']='true' # supress RailsAdmin warnings
ENV['SKIP_RAILS_ADMIN_INITIALIZER'] = 'true' # supress RailsAdmin warnings
Fairmondo::Application.load_tasks
@@ -5,7 +5,7 @@ class ArticlesIndex < Chewy::Index
},
analysis: {
filter: {
german_decompound:{
german_decompound: {
type: 'decompound'
},
german_stemming: {
@@ -51,7 +51,7 @@ class ArticlesIndex < Chewy::Index
field :borrowable, type: 'boolean'
field :condition, index: :not_analyzed
field :categories, index: :not_analyzed, value: -> do
categories.map{ |c| c.self_and_ancestors.map(&:id) }.flatten
categories.map { |c| c.self_and_ancestors.map(&:id) }.flatten
end
# sorting
@@ -79,7 +79,7 @@ class ArticlesIndex < Chewy::Index
end
# seller attributes
field :belongs_to_legal_entity? , type: 'boolean'
field :belongs_to_legal_entity?, type: 'boolean'
field :seller_ngo, type: 'boolean'
field :seller_nickname, index: :not_analyzed
field :seller_id, index: :not_analyzed
@@ -1,7 +1,7 @@
class AddressesController < ApplicationController
respond_to :html, only: [:edit, :new]
respond_to :js, if: lambda { request.xhr? }
before_action :set_address, except: [ :new, :create]
before_action :set_address, except: [:new, :create]
def new
@address = current_user.addresses.build
@@ -74,7 +74,7 @@ def pundit_unverified_controller
end
def pundit_unverified_modules
['Devise','RailsAdmin']
['Devise', 'RailsAdmin']
end
def pundit_unverified_classes
@@ -113,7 +113,7 @@ def ensure_complete_profile
def check_value_of_goods
current_user.count_value_of_goods
if current_user.value_of_goods_cents > ( current_user.max_value_of_goods_cents + current_user.max_value_of_goods_cents_bonus )
if current_user.value_of_goods_cents > (current_user.max_value_of_goods_cents + current_user.max_value_of_goods_cents_bonus)
flash[:error] = I18n.t('article.notices.max_limit')
redirect_to user_path(current_user)
end
@@ -22,7 +22,7 @@
class ArticlesController < ApplicationController
responders :location
respond_to :html
respond_to :json, only: [:show,:index]
respond_to :json, only: [:show, :index]
before_action :set_article, only: [:edit, :update, :destroy, :show]
@@ -33,7 +33,7 @@ class ArticlesController < ApplicationController
skip_after_filter :verify_authorized_with_exceptions, only: [:autocomplete]
# Layout Requirements
before_action :ensure_complete_profile , only: [:new, :create]
before_action :ensure_complete_profile, only: [:new, :create]
# search_cache
before_action :build_search_cache, only: :index
@@ -140,7 +140,7 @@ def destroy
private
def search_results_for_error_case
render json: {query: params[:q], suggestions:[]}
render json: { query: params[:q], suggestions: [] }
end
def calculate_fees_and_donations
@@ -164,7 +164,7 @@ def set_article
end
def similar_articles query
query ||= params[:id].gsub(/\-/,' ')
query ||= params[:id].gsub(/\-/, ' ')
@similar_articles = ArticleSearchForm.new(q: query).search(1)
respond_with @similar_articles do |format|
format.html { render 'article_closed' }
@@ -240,7 +240,7 @@ def clear_template_name
def save_images
# At least try to save the images -> not persisted in browser
@article.images.each_with_index do |image,index|
@article.images.each_with_index do |image, index|
if image.new_record?
# strange HACK because paperclip will now rollback uploaded files and we want the file to be saved anyway
# if you find out a way to break out a running transaction please refactor to images_attributes
@@ -1,6 +1,6 @@
class BankDetailsController < ApplicationController
def check
@result = KontoAPI::valid?( ktn: params[:bank_account_number], blz: params[:bank_code] )
@result = KontoAPI::valid?(ktn: params[:bank_account_number], blz: params[:bank_code])
respond_to do |format|
format.json { render json: @result.to_json }
end
@@ -9,7 +9,7 @@ def check
# Check IBAN and BIC
[:iban, :bic].each do |value|
define_method("check_#{ value }") do
@result = KontoAPI::valid?( value => params[value] )
@result = KontoAPI::valid?(value => params[value])
respond_to do |format|
format.json { render json: @result.to_json }
end
@@ -18,7 +18,7 @@ def check
# The Konto-API does not support bank_name for bic / iban
def get_bank_name
@result = KontoAPI::bank_name( params[:bank_code] )
@result = KontoAPI::bank_name(params[:bank_code])
respond_to do |format|
format.json { render json: @result.to_json }
end
@@ -101,16 +101,16 @@ def reject_orphaned_line_items
def set_cart
begin
@cart = Cart.includes(
line_item_groups:[
line_item_groups: [
:seller,
:business_transactions,
:transport_address,
:payment_address,
{line_items:{
article:[
{ line_items: {
article: [
:seller,
:images
]}}]).find(params[:id])
] } }]).find(params[:id])
rescue
@cart = Cart.new
end
@@ -1,7 +1,7 @@
class CategoriesController < ApplicationController
layout false, only: :select_category
respond_to :html
respond_to :json, only: [:index ,:show]
respond_to :json, only: [:index, :show]
respond_to :js, only: :show, if: lambda { request.xhr? }
before_action :set_category, only: [:show, :select_category]
before_action :build_category_search_cache, only: :show
@@ -45,7 +45,7 @@ def articles
def as_json
@children = params[:hide_empty] ? @category.children_with_active_articles : @category.children
render json: @children.map { |child| {id: child.id, name: child.name} }.to_json
render json: @children.map { |child| { id: child.id, name: child.name } }.to_json
end
def build_category_search_cache
@@ -8,7 +8,7 @@ class DiscourseController < ApplicationController
def sso
secret = $DISCOURSE_SECRET
sso = SingleSignOn.parse(request.query_string, secret)
MAP_USER.each do |k,v|
MAP_USER.each do |k, v|
sso.send("#{k}=", current_user.send(v))
end
sso.sso_secret = secret
@@ -97,9 +97,9 @@ def admin_add
articles.each do |id|
library.articles << Article.find(id) if id.present?
end
notice = {notice: 'Added to library.'}
notice = { notice: 'Added to library.' }
rescue => err # will throw errors e.g. if library already had that article
notice = {error: "Something went wrong: #{err}"} # Only visible for admins
notice = { error: "Something went wrong: #{err}" } # Only visible for admins
end
end
redirect_to :back, flash: notice
@@ -3,7 +3,7 @@ class MassUploadsController < ApplicationController
respond_to :html
respond_to :csv, only: :show
before_action :ensure_complete_profile , only: [:new, :create]
before_action :ensure_complete_profile, only: [:new, :create]
before_action :set_mass_upload, only: [:show, :update]
before_action :check_value_of_goods, only: [:update]
@@ -33,11 +33,11 @@ def ipn_notification
if payment
payment.last_ipn = params.to_json
if params && params[:status] == 'COMPLETED'# && params[:sender_email] == payment.line_item_group_buyer_email
if params && params[:status] == 'COMPLETED' # && params[:sender_email] == payment.line_item_group_buyer_email
payment.confirm
# Only send email to courier service if bike_courier is the selected transport
bts = payment.line_item_group.business_transactions.select{ |bt| bt.bike_courier_selected? }
bts = payment.line_item_group.business_transactions.select { |bt| bt.bike_courier_selected? }
if bts.any?
bts.each do |bt|
# raise StandardError, 'SCHAU WOHER ICH KOMME'
@@ -20,9 +20,9 @@
# along with Fairmondo. If not, see <http://www.gnu.org/licenses/>.
#
class RegistrationsController < Devise::RegistrationsController
before_action :dont_cache, only: [ :edit ]
before_action :dont_cache, only: [:edit]
before_action :configure_permitted_parameters
skip_before_action :authenticate_user!, only: [ :create, :new ]
skip_before_action :authenticate_user!, only: [:create, :new]
# GET /resource/sign_up
def new
@@ -111,7 +111,7 @@ def configure_permitted_parameters
u.for(User.new).as(resource).on(:create).refine
end
devise_parameter_sanitizer.for(:account_update) do |u|
u.for(User.new).as(resource).on(:update).refine# permit(*UserRefinery.new(resource).default, :current_password)
u.for(User.new).as(resource).on(:update).refine # permit(*UserRefinery.new(resource).default, :current_password)
end
end
end
@@ -4,7 +4,7 @@
class ToolboxController < ApplicationController
respond_to :js, :json
skip_before_action :authenticate_user!, only: [ :session_expired, :confirm, :rss, :reload, :healthcheck ]
skip_before_action :authenticate_user!, only: [:session_expired, :confirm, :rss, :reload, :healthcheck]
def session_expired
respond_to do |format|
@@ -65,7 +65,7 @@ def check_for_complete_mass_uploads
end
def sanitize_print_param
if params[:print] && ['terms','cancellation'].include?(params[:print])
if params[:print] && ['terms', 'cancellation'].include?(params[:print])
@print = params[:print]
end
end
Oops, something went wrong.

0 comments on commit a67e57e

Please sign in to comment.