Conversation
lib/babelish/version.rb
Outdated
| @@ -1,3 +1,3 @@ | |||
| module Babelish | |||
| VERSION = "0.5.3" | |||
| VERSION = "0.6.0" | |||
There was a problem hiding this comment.
Freeze mutable objects assigned to constants.
lib/babelish/csv2yaml.rb
Outdated
| end | ||
| end | ||
| end | ||
|
|
There was a problem hiding this comment.
1 trailing blank lines detected.
lib/babelish/csv2yaml.rb
Outdated
| end | ||
| indent = ' ' | ||
| entry += comment.to_s.empty? ? "" : "#{indent}# #{comment}\n" | ||
| entry += "#{indent}#{row_key}: \"#{row_value}\"\n" |
There was a problem hiding this comment.
Useless assignment to variable - entry. Use + instead of +=.
lib/babelish/csv2yaml.rb
Outdated
| entry += "#{@language.code}:\n" | ||
| @is_first_row = false | ||
| end | ||
| indent = ' ' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
There was a problem hiding this comment.
not agree with the bot
lib/babelish/csv2yaml.rb
Outdated
| return filepath ? [filepath] : [] | ||
| end | ||
|
|
||
| def get_row_format(row_key, row_value, comment = nil, indentation = 0) |
There was a problem hiding this comment.
Unused method argument - indentation. If it's necessary, use _ or _indentation as an argument name to indicate that it won't be used.
lib/babelish/csv2yaml.rb
Outdated
| filename = @output_basename || language.code | ||
| filepath = Pathname.new("#{@output_dir}/#{filename}.#{extension}") | ||
| @language = language | ||
| return filepath ? [filepath] : [] |
There was a problem hiding this comment.
Redundant return detected.
| end | ||
|
|
||
| def language_filepaths(language) | ||
| require 'pathname' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
There was a problem hiding this comment.
not agree with the bot
| @@ -0,0 +1,34 @@ | |||
| module Babelish | |||
There was a problem hiding this comment.
Missing magic comment # frozen_string_literal: true.
There was a problem hiding this comment.
rubocop | grep frozen_string_literal does not have it.
|
@moskvin thanks for the contribution, Please add some unit tests and have you look at the @houndci-bot comments.
|
lib/babelish/csv2yaml.rb
Outdated
| end | ||
|
|
||
| def extension | ||
| 'yaml' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| def get_row_format(row_key, row_value, comment = nil, _indentation = 0) | ||
| entry = '' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
no, I was surprised :) |
not required right now for me, but I think we should add it |
|
@netbe If you want to achieve clean code for the project I suggest use |
lib/babelish/csv2yaml.rb
Outdated
| end | ||
|
|
||
| def extension | ||
| 'yaml' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2yaml.rb
Outdated
| @is_first_row = false | ||
| end | ||
| entry << "#{indent*2}# #{comment}\n" unless comment.to_s.empty? | ||
| entry << "#{indent*2}#{row_key}: \"#{row_value}\"\n" |
There was a problem hiding this comment.
Surrounding space missing for operator *.
lib/babelish/csv2yaml.rb
Outdated
| entry << "#{indent}#{filename}:\n" | ||
| @is_first_row = false | ||
| end | ||
| entry << "#{indent*2}# #{comment}\n" unless comment.to_s.empty? |
There was a problem hiding this comment.
Surrounding space missing for operator *.
|
|
||
| def get_row_format(row_key, row_value, comment = nil, _indentation = 0) | ||
| entry = '' | ||
| indent = ' ' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2yaml.rb
Outdated
| def language_filepaths(language) | ||
| require 'pathname' | ||
| filename = @output_basename || language.code | ||
| filepath = Pathname.new("#{@output_dir}/#{filename}.#{language.code}.#{extension}") |
There was a problem hiding this comment.
Line is too long. [89/80]
lib/babelish/csv2yaml.rb
Outdated
| def extension | ||
| 'yaml' | ||
| end | ||
|
|
There was a problem hiding this comment.
Extra empty line detected at class body end.
lib/babelish/csv2yaml.rb
Outdated
| end | ||
|
|
||
| def extension | ||
| 'yaml' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2yaml.rb
Outdated
| @is_first_row = false | ||
| end | ||
| entry << "#{indent*@deep}# #{comment}\n" unless comment.to_s.empty? | ||
| entry << "#{indent*@deep}#{row_key}: \"#{row_value}\"\n" |
There was a problem hiding this comment.
Surrounding space missing for operator *.
lib/babelish/csv2yaml.rb
Outdated
| end | ||
| @is_first_row = false | ||
| end | ||
| entry << "#{indent*@deep}# #{comment}\n" unless comment.to_s.empty? |
There was a problem hiding this comment.
Surrounding space missing for operator *.
|
|
||
| def get_row_format(row_key, row_value, comment = nil, indentation = 0) | ||
| entry = '' | ||
| indent = ' ' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| def get_row_format(row_key, row_value, comment = nil, indentation = 0) | ||
| entry = '' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2yaml.rb
Outdated
| filepath ? [filepath] : [] | ||
| end | ||
|
|
||
| def get_row_format(row_key, row_value, comment = nil, indentation = 0) |
There was a problem hiding this comment.
Unused method argument - indentation. If it's necessary, use _ or _indentation as an argument name to indicate that it won't be used.
| end | ||
|
|
||
| def language_filepaths(language) | ||
| require 'pathname' |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
|
||
| def to_camel_case underscope_text | ||
| enumerator = underscope_text.split('_').each_with_index | ||
| enumerator.map{|word, index| index == 0 ? word : word.capitalize}.join |
There was a problem hiding this comment.
Space missing to the left of {.
Space between { and | missing.
Use index.zero? instead of index == 0.
Space missing inside }.
| end | ||
|
|
||
| def to_camel_case underscope_text | ||
| enumerator = underscope_text.split('_').each_with_index |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2strings.rb
Outdated
| @output_basename || 'Localizable' | ||
| end | ||
|
|
||
| def to_camel_case underscope_text |
There was a problem hiding this comment.
Use def with parentheses when there are parameters.
lib/babelish/csv2strings.rb
Outdated
| def get_row_format(row_key, row_value, comment = nil, indentation = 0) | ||
| entry = comment.to_s.empty? ? "" : "\n/* #{comment} */\n" | ||
| entry + "\"#{row_key}\"" + " " * indentation + " = \"#{row_value}\";\n" | ||
| entry + "\"#{to_camel_case(row_key)}\"" + " " * indentation + " = \"#{row_value}\";\n" |
There was a problem hiding this comment.
Line is too long. [92/80]
| end | ||
|
|
||
| def filename_to_camel_case underscope_text | ||
| underscope_text.split('_').map{|word| word.capitalize}.join |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Space missing to the left of {.
Space between { and | missing.
Pass &:capitalize as an argument to map instead of a block.
Space missing inside }.
lib/babelish/csv2strings.rb
Outdated
| enumerator.map{|word, index| index == 0 ? word : word.capitalize}.join | ||
| end | ||
|
|
||
| def filename_to_camel_case underscope_text |
There was a problem hiding this comment.
Use def with parentheses when there are parameters.
|
|
||
| def row_to_camel_case underscope_text | ||
| enumerator = underscope_text.split('_').each_with_index | ||
| enumerator.map{|word, index| index == 0 ? word : word.capitalize}.join |
There was a problem hiding this comment.
Space missing to the left of {.
Space between { and | missing.
Use index.zero? instead of index == 0.
Space missing inside }.
| end | ||
|
|
||
| def row_to_camel_case underscope_text | ||
| enumerator = underscope_text.split('_').each_with_index |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2strings.rb
Outdated
| @output_basename || 'Localizable' | ||
| end | ||
|
|
||
| def row_to_camel_case underscope_text |
There was a problem hiding this comment.
Use def with parentheses when there are parameters.
lib/babelish/csv2strings.rb
Outdated
| def get_row_format(row_key, row_value, comment = nil, indentation = 0) | ||
| entry = comment.to_s.empty? ? "" : "\n/* #{comment} */\n" | ||
| entry + "\"#{row_key}\"" + " " * indentation + " = \"#{row_value}\";\n" | ||
| entry + "\"#{row_to_camel_case(row_key)}\"" + " " * indentation + " = \"#{row_value}\";\n" |
There was a problem hiding this comment.
Line is too long. [96/80]
…mel case [csv2strings] Added convertor for filename from underscore case to camel case
houndci-bot
left a comment
There was a problem hiding this comment.
Some files could not be reviewed due to errors:
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
.rubocop.yml: Style/FileName has the wrong namespace - should be Naming .rubocop.yml: Style/PredicateName has the wrong namespace - should be Naming .rubocop.yml: Style/AccessorMethodName has the wrong namespace - should be Naming Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead. (obsolete configuration found in .rubocop.yml, please update it) obsolete parameter MaxLineLength (for Style/IfUnlessModifier) found in .rubocop.yml `Style/IfUnlessModifier: MaxLineLength` has been removed. Use `Metrics/LineLength: Max` instead
| @@ -1,3 +1,3 @@ | |||
| module Babelish | |||
| VERSION = "0.5.4" | |||
| VERSION = '0.6.0'.freeze | |||
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/babelish/csv2yaml.rb
Outdated
| end | ||
|
|
||
| def extension | ||
| 'yaml' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
|
||
| def get_row_format(row_key, row_value, comment = nil, _indentation = 0) | ||
| entry = '' | ||
| indent = ' ' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| def get_row_format(row_key, row_value, comment = nil, _indentation = 0) | ||
| entry = '' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| def language_filepaths(language) | ||
| require 'pathname' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
|
||
| def row_to_camel_case(underscope_text) | ||
| enumerator = underscope_text.split('_').each_with_index | ||
| enumerator.map{|word, index| index == 0 ? word : word.capitalize}.join |
There was a problem hiding this comment.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Style/NumericPredicate: Use index.zero? instead of index == 0.
Layout/SpaceInsideBlockBraces: Space missing inside }.
| end | ||
|
|
||
| def row_to_camel_case(underscope_text) | ||
| enumerator = underscope_text.split('_').each_with_index |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| else | ||
| language.regions.each do |region| | ||
| filepaths << Pathname.new(@output_dir) + "#{language.code}-#{region}.lproj/#{output_basename}.#{extension}" | ||
| filepaths << Pathname.new(@output_dir) + "#{language.code}-#{region}.lproj/#{basename}.#{extension}" |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [110/80]
| basename = filename_to_camel_case(output_basename) | ||
| if language.regions.empty? | ||
| filepaths << Pathname.new(@output_dir) + "#{language.code}.lproj/#{output_basename}.#{extension}" | ||
| filepaths << Pathname.new(@output_dir) + "#{language.code}.lproj/#{basename}.#{extension}" |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [98/80]
| output += get_row_format(key, value, comment, indentation - key.length) | ||
| key_out = key_to_output(key) | ||
| value_out = value_to_output(value) | ||
| output += get_row_format(key_out, value_out, comment, indentation - key_out.length) |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [93/80]
| require 'pathname' | ||
| filename = @output_basename || language.code | ||
| filepath = Pathname.new("#{@output_dir}#{filename}.#{extension}") | ||
| filepath = Pathname.new("#{@output_dir}/#{filename}.#{language.code}.#{extension}") |
There was a problem hiding this comment.
Metrics/LineLength: Line is too long. [89/80]
[gems] updated gems
| group :test do | ||
| gem 'coveralls', :require => false, :platforms => [:ruby_19, :ruby_20] | ||
| gem 'coveralls', require: false, platforms: %i[ruby_19 ruby_20] | ||
| gem 'rubocop' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
|
||
| group :test do | ||
| gem 'coveralls', :require => false, :platforms => [:ruby_19, :ruby_20] | ||
| gem 'coveralls', require: false, platforms: %i[ruby_19 ruby_20] |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| @@ -1,8 +1,9 @@ | |||
| source "http://rubygems.org" | |||
| source 'http://rubygems.org' | |||
There was a problem hiding this comment.
Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
|
||
| Rake::TestTask.new do |t| | ||
| t.libs << "test" | ||
| t.libs << 'test' |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| @@ -1,9 +1,9 @@ | |||
| require "bundler/gem_tasks" | |||
| require 'bundler/gem_tasks' | |||
There was a problem hiding this comment.
Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Added