zmbush / coffeelint-ruby

This adds some simple bindings to ruby to enable use of coffeelint
MIT License
32 stars 23 forks source link

any way to hook into coffeelint's config.json support? #3

Closed RandomEtc closed 10 years ago

RandomEtc commented 10 years ago

Thanks for this gem - it's really helping our code quality!

I'm wondering if there's a way to get coffeelint to load a config file? I think all that is handled by coffeelint's commandline.coffee, but it looks like you're invoking coffeelint.coffee directly, so it might not be an easy addition?

zmbush commented 10 years ago

Hmm. I can look into it.

To clarify, do you want the rake task to load a config file, or the coffeelint.rb command?

RandomEtc commented 10 years ago

Ideally I'd like to call from rake like this:

  task :coffee do
    options = { config_file: 'coffeelint.json' }
    success = Coffeelint.run_test_suite('app', options) and Coffeelint.run_test_suite('spec', options)
    fail "Lint!" unless success
  end

This is to achieve two goals:

  1. change the maximum line length linter to 120
  2. run a custom linter (coffeelint supports this now)

The second one is nice-to-have, the first is a show-stopper. Happy to help if you can outline the best way to do it.

zmbush commented 10 years ago

Okay. For the moment, I believe that if you read your coffeelint.json file and passed it as the second parameter to Coffeelint.run_test_suite

If that doesn't work, let me know. That will help me gauge how easy/hard this will be to implement. If reading the coffeelint.json file into a hash works then this should be a pretty simple patch.

zmbush commented 10 years ago

I just went ahead and implemented the change. Let me know if it works for you.