Skip to content
7 changes: 4 additions & 3 deletions babelish.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ Gem::Specification.new do |s|
- .strings (iOS)
- .xml (Android)
- .json
- .php"
s.authors = ["François Benaiteau", "Markus Paeschke"]
s.email = ['francois.benaiteau@gmail.com', 'markus.paeschke@gmail.com']
- .php
- .yaml (Rails)"
s.authors = ["François Benaiteau", "Markus Paeschke", "Nikolay Moskvin"]
s.email = ['francois.benaiteau@gmail.com', 'markus.paeschke@gmail.com', 'nikolay.moskvin@gmail.com']
s.homepage = 'http://netbe.github.io/Babelish/'
s.license = 'MIT'

Expand Down
1 change: 1 addition & 0 deletions lib/babelish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def to_utf8
require "babelish/csv2android"
require "babelish/csv2php"
require "babelish/csv2json"
require "babelish/csv2yaml"

# To CSV
require "babelish/base2csv"
Expand Down
1 change: 1 addition & 0 deletions lib/babelish/csv2android.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def process_value(row_value, default_value)

def get_row_format(row_key, row_value, comment = nil, indentation = 0)
entry = comment.to_s.empty? ? "" : "\n\t<!-- #{comment} -->\n"
row_key = "#{@output_basename}_#{row_key}" unless @output_basename.empty?
entry + "\t<string name=\"#{row_key}\">#{row_value}</string>\n"
end

Expand Down
42 changes: 42 additions & 0 deletions lib/babelish/csv2yaml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module Babelish

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing magic comment # frozen_string_literal: true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubocop | grep frozen_string_literal does not have it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.

# Converter from csv format to Rails like yaml format
class CSV2YAML < Csv2Base
attr_accessor :is_first_row
attr_accessor :deep

def initialize(filename, langs, args = {})
super(filename, langs, args)
@is_first_row = true
@deep = 1
end

def language_filepaths(language)
require 'pathname'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not agree with the bot

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

filename = @output_basename || language.code
filepath = Pathname.new("#{@output_dir}/#{filename}.#{language.code}.#{extension}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [89/80]

@language = language
filepath ? [filepath] : []
end

def get_row_format(row_key, row_value, comment = nil, indentation = 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused method argument - indentation. If it's necessary, use _ or _indentation as an argument name to indicate that it won't be used.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused method argument - indentation. If it's necessary, use _ or _indentation as an argument name to indicate that it won't be used.

entry = ''

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will not fix it!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

indent = ' '

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

if @is_first_row
entry << "#{@language.code}:\n"
@deep = 1
unless @output_basename.empty?
entry << "#{indent}#{@output_basename}:\n"
@deep = 2
end
@is_first_row = false
end
entry << "#{indent*@deep}# #{comment}\n" unless comment.to_s.empty?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing for operator *.

entry << "#{indent*@deep}#{row_key}: \"#{row_value}\"\n"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing for operator *.

end

def extension
'yaml'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will not fix it!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at class body end.

end
end
2 changes: 1 addition & 1 deletion lib/babelish/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Babelish
VERSION = "0.5.4"
VERSION = "0.6.0".freeze
end