-
Notifications
You must be signed in to change notification settings - Fork 83
Add possibility to configure pretty json in .babelish #109
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
base: master
Are you sure you want to change the base?
Conversation
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, {'English' => "en"}, :output_basename => 'output', pretty_json: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [118/80]
test/babelish/test_csv2json.rb
Outdated
| expected_json_filename = 'test_pretty_json.json' | ||
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) |
There was a problem hiding this comment.
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.
test/babelish/test_csv2json.rb
Outdated
| def test_converting_csv_to_json_with_pretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_pretty_json.json' | ||
| given_json_filename = 'output.json' |
There was a problem hiding this comment.
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.
test/babelish/test_csv2json.rb
Outdated
|
|
||
| def test_converting_csv_to_json_with_pretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_pretty_json.json' |
There was a problem hiding this comment.
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.
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, {'English' => "en"}, :output_basename => 'output', pretty_json: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [119/80]
test/babelish/test_csv2json.rb
Outdated
| expected_json_filename = 'test_unpretty_json.json' | ||
| given_json_filename = 'output.json' | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) |
There was a problem hiding this comment.
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.
test/babelish/test_csv2json.rb
Outdated
| def test_converting_csv_to_json_with_unpretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_unpretty_json.json' | ||
| given_json_filename = 'output.json' |
There was a problem hiding this comment.
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.
test/babelish/test_csv2json.rb
Outdated
|
|
||
| def test_converting_csv_to_json_with_unpretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = 'test_unpretty_json.json' |
There was a problem hiding this comment.
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.
lib/babelish/csv2json.rb
Outdated
|
|
||
| def hash_to_output(content = {}) | ||
| return content.to_json | ||
| return @pretty_json ? JSON.pretty_generate(content) : content.to_json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/RedundantReturn: Redundant return detected.
lib/babelish/commandline.rb
Outdated
| method_option :ignore_lang_path, :type => :boolean, :aliases => "-I", :lazy_default => false, :desc => "Ignore the path component of langs" | ||
| method_option :fetch, :type => :boolean, :desc => "Download file from Google Drive" | ||
| method_option :sheet, :type => :numeric, :desc => "Index of worksheet to download. First index is 0" | ||
| method_option :pretty_json, :type => :boolean, :aliases => "-p", :desc => "Prettify your json output files" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [111/80]
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, { "English" => "en" }, output_basename: 'output', pretty_json: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [117/80]
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
test/babelish/test_csv2json.rb
Outdated
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read('test/data/' + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, { "English" => "en" }, output_basename: 'output', pretty_json: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [118/80]
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
cb319b8 to
aa36473
Compare
| method_option :ignore_lang_path, :type => :boolean, :aliases => "-I", :lazy_default => false, :desc => "Ignore the path component of langs" | ||
| method_option :fetch, :type => :boolean, :desc => "Download file from Google Drive" | ||
| method_option :sheet, :type => :numeric, :desc => "Index of worksheet to download. First index is 0" | ||
| method_option :pretty_json, :type => :boolean, aliases: "-p", desc: "Prettify your json output files" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [105/80]
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, | ||
| output_basename: "output", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingWhitespace: Trailing whitespace detected.
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, | ||
| output_basename: "output", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
| { "English" => "en" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/AlignParameters: Align the parameters of a method call if they span more than one line.
Layout/TrailingWhitespace: Trailing whitespace detected.
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingWhitespace: Trailing whitespace detected.
@netbe it would be great if you could look at it 🚀