This adds some simple bindings to ruby to enable use of coffeelint
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
coffeelint @ 34d1d78 Update to coffeelint v1.14.0 Dec 1, 2015
lib Update to coffeelint v1.14.0 Dec 1, 2015
spec Clean up some quality drift Dec 1, 2015
.gitignore
.gitmodules Switch back to mainline coffeelint Apr 14, 2014
.rspec update for rspec-3.x Aug 4, 2014
.travis.yml Add travis.yml Jan 31, 2014
Gemfile Add files May 6, 2013
LICENSE.txt Add files May 6, 2013
README.md Update to coffeelint v1.14.0 Dec 1, 2015
Rakefile Add bin/coffeelint Apr 7, 2014
coffeelint.gemspec Fix assignment of gem files in the gemspec file. Feb 18, 2015

README.md

Coffeelint Build Status Gem Version

Using coffeelint version: v1.14.0

Coffeelint is a set of simple ruby bindings for coffeelint.

Install the Gem

Add this line to your application's Gemfile:

gem 'coffeelint'

Or for the most up to date version:

gem 'coffeelint', :git => 'git://github.com/zmbush/coffeelint-ruby.git', :submodules => true

And then execute:

$ bundle

Or install it yourself as:

$ gem install coffeelint

Usage

There are a few different uses of coffeelint.

lint_report = Coffeelint.lint(coffeescript source code, [config options])
lint_report = Coffeelint.lint_file(filename of coffeescript source, [config_options])
lint_reports = Coffeelint.lint_dir(directory, [config_options])
Coffeelint.lint_dir(directory, [config_options]) do |filename, lint_report|
    puts filename
    puts lint_report
    Coffeelint.display_test_results(filename, lint_report)
end
Coffeelint.run_test(filename of coffeescript source, [config_options]) # Run tests and print pretty results (return true/false)
Coffeelint.run_test_suite(directory, [config_options]) # Runs a pretty report recursively for a directory (returns/exits with number of errors if any or 0)

Config Options

The coffeelint gem takes the same config options as coffeelint. The only addition is the config_file parameter. If you call coffeelint like:

Coffeelint.run_test_suite(directory, :config_file => 'coffeelint_config.json')

Then it will load the config options from that file.

Alternatively you can create a config file in your project, coffeelint will load these by default:

  • coffeelint.json
  • .coffeelint.json
  • config/coffeelint.json
  • config/.coffeelint.json

To use a local version of coffeelint instead of the one bundled with the gem, You can set the path with Coffeelint.set_path(/path/to/coffeelint.js)

Additionally, if you are using rails you also get the rake task:

rake coffeelint

Which will run the test on any *.coffee file in your app or spec directories

Finally, there is a command line utility that allows you to run standalone tests:

coffeelint.rb <filename>
coffeelint.rb -r <directory>
coffeelint.rb -f <config.json> [-r] <fname-or-directory>

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Bundler needs a compiled coffeelint present which you can get by running

rake prepare