Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Mar 29, 2017
1 parent 4f2a134 commit 3724deb
Show file tree
Hide file tree
Showing 111 changed files with 174 additions and 53 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Style/ClassAndModuleChildren:
Style/GuardClause:
Enabled: false

Style/IndentHeredoc:
# TODO(glebm): Remove this when we update the minimum Ruby version to 2.3+.
Enabled: false

Style/MultilineBlockChain:
Enabled: false

Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in i18n-tasks.gemspec
gemspec

unless ENV['TRAVIS']
group :development do
gem 'byebug', platforms: [:mri, :mswin, :x64_mingw_21, :x64_mingw_22], require: false
gem 'byebug', platforms: %i(mri mswin x64_mingw_21 x64_mingw_22), require: false
gem 'rubinius-debugger', platform: :rbx, require: false
end
end
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:rspec)
Expand Down
1 change: 1 addition & 0 deletions i18n-tasks.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'i18n/tasks/version'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# define all the modules to be able to use ::
module I18n
module Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/base_task.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/command_error'
require 'i18n/tasks/split_key'
require 'i18n/tasks/key_pattern_matching'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/cli.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks'
require 'i18n/tasks/commands'
require 'optparse'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/collection.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/command/dsl'
require 'i18n/tasks/command/options/common'
require 'i18n/tasks/command/options/locales'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/commander.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/cli'
require 'i18n/tasks/reports/terminal'
require 'i18n/tasks/reports/spreadsheet'
Expand Down
11 changes: 6 additions & 5 deletions lib/i18n/tasks/command/commands/data.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module Commands
Expand All @@ -13,7 +14,7 @@ module Data
cmd :normalize,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.normalize'),
args: [:locales, :pattern_router]
args: %i(locales pattern_router)

def normalize(opt = {})
i18n.normalize_store! opt[:locales], opt[:pattern_router]
Expand Down Expand Up @@ -48,7 +49,7 @@ def rm(opt = {})
cmd :data,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.data'),
args: [:locales, :out_format]
args: %i(locales out_format)

def data(opt = {})
print_forest i18n.data_forest(opt[:locales]), opt
Expand All @@ -57,7 +58,7 @@ def data(opt = {})
cmd :data_merge,
pos: '[tree ...]',
desc: t('i18n_tasks.cmd.desc.data_merge'),
args: [:data_format, :nostdin]
args: %i(data_format nostdin)

def data_merge(opt = {})
forest = merge_forests_stdin_and_pos!(opt)
Expand All @@ -68,7 +69,7 @@ def data_merge(opt = {})
cmd :data_write,
pos: '[tree]',
desc: t('i18n_tasks.cmd.desc.data_write'),
args: [:data_format, :nostdin]
args: %i(data_format nostdin)

def data_write(opt = {})
forest = forest_pos_or_stdin!(opt)
Expand All @@ -79,7 +80,7 @@ def data_write(opt = {})
cmd :data_remove,
pos: '[tree]',
desc: t('i18n_tasks.cmd.desc.data_remove'),
args: [:data_format, :nostdin]
args: %i(data_format nostdin)

def data_remove(opt = {})
removed = i18n.data.remove_by_key!(forest_pos_or_stdin!(opt))
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/tasks/command/commands/eq_base.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module Commands
Expand All @@ -8,7 +9,7 @@ module EqBase
cmd :eq_base,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.eq_base'),
args: [:locales, :out_format]
args: %i(locales out_format)

def eq_base(opt = {})
print_forest i18n.eq_base_keys(opt), opt, :eq_base_keys
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/tasks/command/commands/health.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module Commands
Expand All @@ -8,7 +9,7 @@ module Health
cmd :health,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.health'),
args: [:locales, :out_format]
args: %i(locales out_format)

def health(opt = {})
forest = i18n.data_forest(opt[:locales])
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/commands/meta.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module Commands
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/tasks/command/commands/missing.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/command/collection'

module I18n::Tasks
Expand All @@ -24,7 +25,7 @@ module Missing
cmd :missing,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.missing'),
args: [:locales, :out_format, :missing_types]
args: %i(locales out_format missing_types)

def missing(opt = {})
forest = i18n.missing_keys(opt.slice(:locales, :base_locale, :missing_types))
Expand Down
9 changes: 5 additions & 4 deletions lib/i18n/tasks/command/commands/tree.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module Commands
Expand All @@ -19,7 +20,7 @@ def tree_translate(opts = {})
cmd :tree_merge,
pos: '[[tree] [tree] ... (or stdin)]',
desc: t('i18n_tasks.cmd.desc.tree_merge'),
args: [:data_format, :nostdin]
args: %i(data_format nostdin)

def tree_merge(opts = {})
print_forest merge_forests_stdin_and_pos!(opts), opts
Expand All @@ -28,7 +29,7 @@ def tree_merge(opts = {})
cmd :tree_filter,
pos: '[pattern] [tree (or stdin)]',
desc: t('i18n_tasks.cmd.desc.tree_filter'),
args: [:data_format, :pattern]
args: %i(data_format pattern)

def tree_filter(opts = {})
pattern = arg_or_pos! :pattern, opts
Expand Down Expand Up @@ -74,7 +75,7 @@ def tree_mv(opt = {})
cmd :tree_subtract,
pos: '[[tree] [tree] ... (or stdin)]',
desc: t('i18n_tasks.cmd.desc.tree_subtract'),
args: [:data_format, :nostdin]
args: %i(data_format nostdin)

def tree_subtract(opt = {})
forests = forests_stdin_and_pos! opt, 2
Expand All @@ -85,7 +86,7 @@ def tree_subtract(opt = {})
cmd :tree_set_value,
pos: '[VALUE] [tree (or stdin)]',
desc: t('i18n_tasks.cmd.desc.tree_set_value'),
args: [:value, :data_format, :nostdin, :pattern]
args: %i(value data_format nostdin pattern)

def tree_set_value(opt = {})
value = arg_or_pos! :value, opt
Expand Down
7 changes: 4 additions & 3 deletions lib/i18n/tasks/command/commands/usages.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module Commands
Expand All @@ -12,7 +13,7 @@ module Usages
cmd :find,
pos: '[pattern]',
desc: t('i18n_tasks.cmd.desc.find'),
args: [:out_format, :pattern, :strict]
args: %i(out_format pattern strict)

def find(opt = {})
opt[:filter] ||= opt.delete(:pattern) || opt[:arguments].try(:first)
Expand All @@ -23,7 +24,7 @@ def find(opt = {})
cmd :unused,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.unused'),
args: [:locales, :out_format, :strict]
args: %i(locales out_format strict)

def unused(opt = {})
forest = i18n.unused_keys(opt.slice(:locales, :strict))
Expand All @@ -34,7 +35,7 @@ def unused(opt = {})
cmd :remove_unused,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.remove_unused'),
args: [:locales, :out_format, :strict, :confirm]
args: %i(locales out_format strict confirm)

def remove_unused(opt = {})
unused_keys = i18n.unused_keys(opt.slice(:locales, :strict))
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/commands/xlsx.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module Commands
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/dsl.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module DSL
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/option_parsers/enum.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module OptionParsers
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/tasks/command/option_parsers/locale.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module Command
module OptionParsers
Expand Down Expand Up @@ -39,7 +40,7 @@ def call(vals, context)
if vals == %w(all) || vals.blank?
context.locales
else
move_base_locale_to_front! vals.map { |v| v == 'base' ? context.base_locale : v }, context.base_locale
move_base_locale_to_front!(vals.map { |v| v == 'base' ? context.base_locale : v }, context.base_locale)
end.tap do |locales|
locales.each { |locale| validate! locale }
end
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/options/common.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/command/dsl'

module I18n::Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/options/data.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/command/option_parsers/enum'

module I18n::Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command/options/locales.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/command/option_parsers/locale'

module I18n::Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/command_error.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n
module Tasks
# When this type of error is caught:
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/commands.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/command/dsl'
require 'i18n/tasks/command/collection'
require 'i18n/tasks/command/commands/health'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks::Configuration # rubocop:disable Metrics/ModuleLength
DEFAULTS = {
base_locale: 'en',
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/console_context.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
class ConsoleContext < BaseTask
def to_s
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/data/file_system'

module I18n::Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/adapter/json_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'json'

module I18n::Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/adapter/yaml_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'yaml'
module I18n::Tasks
module Data
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/file_formats.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'fileutils'

module I18n
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/file_system.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/data/file_system_base'
require 'i18n/tasks/data/adapter/json_adapter'
require 'i18n/tasks/data/adapter/yaml_adapter'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/file_system_base.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/data/tree/node'
require 'i18n/tasks/data/router/pattern_router'
require 'i18n/tasks/data/router/conservative_router'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/router/conservative_router.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/data/router/pattern_router'

module I18n::Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/router/pattern_router.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'i18n/tasks/key_pattern_matching'
require 'i18n/tasks/data/tree/node'

Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/tree/siblings.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'set'
require 'i18n/tasks/split_key'
require 'i18n/tasks/data/tree/nodes'
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/data/tree/traversal.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'set'

module I18n::Tasks
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/google_translation.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'easy_translate'
require 'i18n/tasks/html_keys'

Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/html_keys.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks
module HtmlKeys
HTML_KEY_PATTERN = /[.\-_]html\z/
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/ignore_keys.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module I18n::Tasks::IgnoreKeys
# whether to ignore the key
# will also apply global ignore rules
Expand Down
Loading

0 comments on commit 3724deb

Please sign in to comment.