mkristian / jar-dependencies

manage jar dependencies for ruby gems
MIT License
34 stars 19 forks source link

Ruby style in generated <gem-name>_jars.rb #61

Closed paulgoetze closed 7 years ago

paulgoetze commented 7 years ago

I just found some additional whitespace around arguments in the require_jar function that is called in the generated lib/<gem-name>_jars.rb file (assuming the gem use case).

It generates e.g. a file similar to this one:

# this is a generated file, to avoid over-writing it just delete this comment
begin
  require 'jar_dependencies'
rescue LoadError
  require 'nz/ac/waikato/cms/weka/thirdparty/java-cup-11b-runtime/2015.03.26/java-cup-11b-runtime-2015.03.26.jar'
end

if defined? Jars
  require_jar( 'nz.ac.waikato.cms.weka.thirdparty', 'java-cup-11b-runtime', '2015.03.26' )
end

The problem is that this is not the Ruby style recommended by the community (method calls should not have whitespace after/before parentheses) and the generated file fails to pass code linters such as Rubocop. Of course you can remove the whitespace manually, but you would have to do it by hand every time the file is regenerated.

Looks like the corresponding line of code is this one: https://github.com/mkristian/jar-dependencies/blob/d70197da81ccac4cc0b40e5ed29fd1c4b83be72c/lib/jars/installer.rb#L113

Do you mind if I open a PR to remove the extra whitespace?

mkristian commented 7 years ago

any PR is welcome. sure bad idea to use my personal style for a generated file (and I am not doing this any more any ways)