Skip to content

This adds some simple bindings to ruby to enable use of coffeelint

License

Notifications You must be signed in to change notification settings

zmbush/coffeelint-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Brian Nicholszmbush
Brian Nichols
and
Oct 19, 2017
2b8501b · Oct 19, 2017
Apr 7, 2014
Oct 19, 2017
Oct 19, 2017
Dec 1, 2015
May 6, 2013
Apr 14, 2014
Aug 4, 2014
Jan 31, 2014
May 6, 2013
May 6, 2013
Oct 19, 2017
Apr 7, 2014
Oct 19, 2017

Repository files navigation

Coffeelint Build Status Gem Version

Using coffeelint version: v1.16.1

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