Skip to content

Fix rubocop warnings #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 4 additions & 227 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,231 +1,8 @@
# Relaxed.Ruby.Style
require:
- solidus_dev_support/rubocop

AllCops:
Exclude:
- 'spec/dummy/**/*'
- 'vendor/bundle/**/*'
TargetRubyVersion: 2.1

# Sometimes I believe this reads better
# This also causes spacing issues on multi-line fixes
Style/BracesAroundHashParameters:
Enabled: false

# We use class vars and will have to continue doing so for compatability
Style/ClassVars:
Enabled: false

# We need these names for backwards compatability
Style/PredicateName:
Enabled: false

Style/AccessorMethodName:
Enabled: false

# This has been used for customization
Style/MutableConstant:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/GuardClause:
Enabled: false

Style/WordArray:
Enabled: false

Style/ConditionalAssignment:
Enabled: false

Performance/Count:
Enabled: false

Style/RaiseArgs:
Enabled: false

Style/OpMethod:
Enabled: false

# We can use good judgement here
Style/RegexpLiteral:
Enabled: false

# Unicode comments are useful
Style/AsciiComments:
Enabled: false

Lint/EndAlignment:
Enabled: false

Style/ElseAlignment:
Enabled: false

Style/IndentationWidth:
Enabled: false

Style/AlignParameters:
Enabled: false

Style/ClosingParenthesisIndentation:
Enabled: false

Style/MultilineMethodCallIndentation:
Enabled: false

Style/IndentArray:
Enabled: false

Style/IndentHash:
Enabled: false

Style/AlignHash:
Enabled: false

# From http://relaxed.ruby.style/

Style/Alias:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylealias

Style/BeginBlock:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylebeginblock

Style/BlockDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters

Style/Documentation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledocumentation

Style/DotPosition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledotposition

Style/DoubleNegation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledoublenegation

Style/EndBlock:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleendblock

Style/FormatString:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleformatstring

Style/IfUnlessModifier:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier

Style/Lambda:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylelambda

Style/ModuleFunction:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylemodulefunction

Style/MultilineBlockChain:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain

Style/NegatedIf:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedif

Style/NegatedWhile:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile

Style/ParallelAssignment:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment

Style/PercentLiteralDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters

Style/PerlBackrefs:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs

Style/Semicolon:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesemicolon

Style/SignalException:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesignalexception

Style/SingleLineBlockParams:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams

Style/SingleLineMethods:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods

Style/SpaceBeforeBlockBraces:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces

Style/SpaceInsideParens:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens

Style/SpecialGlobalVars:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars

Style/StringLiterals:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylestringliterals

Style/SymbolProc:
Enabled: false

Style/WhileUntilModifier:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier

Lint/AmbiguousRegexpLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral

Lint/AssignmentInCondition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition

Lint/HandleExceptions:
Exclude:
- 'Rakefile'

Metrics/AbcSize:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/ModuleLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/LineLength:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/ParameterLists:
RSpec/MultipleMemoizedHelpers:
Enabled: false

Metrics/PerceivedComplexity:
RSpec/LetSetup:
Enabled: false
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# frozen_string_literal: true

<<<<<<< Updated upstream
module SolidusPaymentMethodByZone
module Spree
module PaymentMethodDecorator
extend ActiveSupport::Concern
=======
module Spree
module PaymentMethodDecorator
def self.prepended(base)
base.has_and_belongs_to_many :zones, join_table: 'spree_payment_method_zones'
>>>>>>> Stashed changes

included do
has_and_belongs_to_many :zones, join_table: 'spree_payment_method_zones'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# frozen_string_literal: true

<<<<<<< Updated upstream
module SolidusPaymentMethodByZone
module Spree
module ZoneDecorator
extend ActiveSupport::Concern
=======
module Spree
module ZoneDecorator
def self.prepended(base)
base.has_and_belongs_to_many :payment_methods, join_table: 'spree_payment_method_zones'
end
>>>>>>> Stashed changes

included do
has_and_belongs_to_many :payment_methods, join_table: 'spree_payment_method_zones'
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Spree::Core::Engine.routes.draw do
# Add your extension routes here
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class SolidusPaymentMethodByZoneCreatePaymentMethodZones < SolidusSupport::Migration[5.0]
def change
create_table :spree_payment_method_zones do |t|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
# frozen_string_literal: true

module SolidusPaymentMethodByZone
module Generators
class InstallGenerator < Rails::Generators::Base
class_option :auto_run_migrations, type: :boolean, default: false

def add_javascripts
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_payment_method_by_zone\n"
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_payment_method_by_zone\n"
append_file 'vendor/assets/javascripts/spree/frontend/all.js',
"//= require spree/frontend/solidus_payment_method_by_zone\n"
append_file 'vendor/assets/javascripts/spree/backend/all.js',
"//= require spree/backend/solidus_payment_method_by_zone\n"
end

def add_stylesheets
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_payment_method_by_zone\n", before: /\*\//, verbose: true
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_payment_method_by_zone\n", before: /\*\//, verbose: true
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css',
" *= require spree/frontend/solidus_payment_method_by_zone\n",
before: %r{\*/},
verbose: true
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css',
" *= require spree/backend/solidus_payment_method_by_zone\n",
before: %r{\*/},
verbose: true
end

def add_migrations
run 'bundle exec rake railties:install:migrations FROM=solidus_payment_method_by_zone'
end

def run_migrations
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(
ask('Would you like to run the migrations now? [Y/n]')
)
if run_migrations
run 'bundle exec rake db:migrate'
else
puts 'Skipping rake db:migrate, don\'t forget to run it!'
Rails.logger 'Skipping rake db:migrate, don\'t forget to run it!'
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions lib/solidus_payment_method_by_zone.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# frozen_string_literal: true

require 'solidus_core'
require 'solidus_backend'
require 'solidus_support'
require 'deface'

require 'solidus_payment_method_by_zone/version'
require 'solidus_payment_method_by_zone/engine'
16 changes: 7 additions & 9 deletions lib/solidus_payment_method_by_zone/engine.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
# frozen_string_literal: true

require 'solidus_payment_method_by_zone'

module SolidusPaymentMethodByZone
class Engine < Rails::Engine
require 'spree/core'
include SolidusSupport::EngineExtensions

isolate_namespace ::Spree

engine_name 'solidus_payment_method_by_zone'

# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end

def self.activate
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end

config.to_prepare(&method(:activate).to_proc)
end
end
5 changes: 5 additions & 0 deletions lib/solidus_payment_method_by_zone/factories/state_factory.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# frozen_string_literal: true
<<<<<<< Updated upstream

eval(ENV.fetch('FACTORY')).define do
=======

FactoryBot.define do
>>>>>>> Stashed changes
factory :state_ja, class: 'Spree::State' do
transient do
country_iso { 'MX' }
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_payment_method_by_zone/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaymentMethodByZone
VERSION = '1.0.1'
end
Loading