Class: Avm::EacRubyBase1::Rubocop::Command
- Inherits:
-
Object
- Object
- Avm::EacRubyBase1::Rubocop::Command
- Defined in:
- lib/avm/eac_ruby_base1/rubocop/command.rb,
lib/avm/eac_ruby_base1/rubocop/command/build.rb
Defined Under Namespace
Classes: Build
Instance Method Summary collapse
- #autocorrect_safe_option ⇒ String
- #autocorrect_to_args ⇒ Array<String>
- #autocorrect_unsafe_option ⇒ String
- #build_args ⇒ Array<String>
- #bundle_command_args ⇒ Array<String>
- #config_to_args ⇒ Array<String>
- #files_to_args ⇒ Array<String>
- #format_to_args ⇒ Array<String>
- #ignore_parent_exclusion_option ⇒ String
- #ignore_parent_exclusion_to_args ⇒ Array<String>
- #prefix_to_args ⇒ Array<String>
Instance Method Details
#autocorrect_safe_option ⇒ String
14 15 16 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 14 def autocorrect_safe_option ? '--auto-correct' : '--autocorrect' end |
#autocorrect_to_args ⇒ Array<String>
24 25 26 27 28 29 30 31 32 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 24 def autocorrect_to_args if autocorrect_unsafe? [autocorrect_unsafe_option] elsif autocorrect_safe? [autocorrect_safe_option] else [] end end |
#autocorrect_unsafe_option ⇒ String
19 20 21 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 19 def autocorrect_unsafe_option ? '--auto-correct-all' : '--autocorrect-all' end |
#build_args ⇒ Array<String>
35 36 37 38 39 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 35 def build_args %w[prefix config ignore_parent_exclusion autocorrect format files].inject([]) do |a, e| a + send("#{e}_to_args") end end |
#bundle_command_args ⇒ Array<String>
42 43 44 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 42 def bundle_command_args %w[exec rubocop] + rubocop_command_args end |
#config_to_args ⇒ Array<String>
47 48 49 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 47 def config_to_args config.if_present([]) { |v| ['--config', v] } end |
#files_to_args ⇒ Array<String>
52 53 54 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 52 def files_to_args files end |
#format_to_args ⇒ Array<String>
57 58 59 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 57 def format_to_args format.if_present([]) { |v| ['--format', v] } end |
#ignore_parent_exclusion_option ⇒ String
62 63 64 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 62 def ignore_parent_exclusion_option '--ignore-parent-exclusion' end |
#ignore_parent_exclusion_to_args ⇒ Array<String>
67 68 69 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 67 def ignore_parent_exclusion_to_args ignore_parent_exclusion? ? [ignore_parent_exclusion_option] : [] end |
#prefix_to_args ⇒ Array<String>
72 73 74 |
# File 'lib/avm/eac_ruby_base1/rubocop/command.rb', line 72 def prefix_to_args (gemfile.present? ? %w[bundle exec] : []) + ['rubocop'] end |