I make things. Sometimes.
zmbush / coffeelint-ruby Goto Github PK
View Code? Open in Web Editor NEWThis adds some simple bindings to ruby to enable use of coffeelint
License: MIT License
This adds some simple bindings to ruby to enable use of coffeelint
License: MIT License
I noticed my coffeelint rake task wasn't failing anymore when tests were failing. It looks like Coffeelint::display_test_results is always returning true now.
results = Coffeelint.lint "hey: ->\n @bort()\n", :missing_fat_arrows => { :level => "error" }
Coffeelint.display_test_results 'Such failure', results
=> true
Great gem! ๐
However, I haven't found a way to create a default conf file as suggested here: http://www.coffeelint.org/#usage
coffeelint --makeconfig > coffeelint.json
Suggestions?
Hi there,
I was wondering if there is a reason that coffeelint is run a file at a time? Running coffeelint directly from the command line on all out files take 2 seconds but running it via coffeelint-ruby takes 47 seconds.
Is it not possible to simply pass the directory through to coffeelint?
Peter
rspec errors out during config when running with the bundler version.
Either make it run or change documentation to describe steps required to clone & compile coffeeling
Upgrade to latest version por favor?
Hello! And thanks for this lovely gem.
I recently switched to the binstub interface for running coffeelint and discovered that some lints were sneaking thru our continuous integration process. It seems that this interface doesn't use an exit code to indicate whether there were any lints present.
Have updated the coffeelint
version to 2.0.6 & got this:
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/k1r8r0wn/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/bundler/gems/coffeelint-ruby-452387789c1c/coffeelint/lib/coffeelint.js
What I've done wrong?
I'm experiencing a problem where I can run coffeelint
from npm (verison 1.9.1) and I'm able to use the transforms feature, which converts some files to coffeescript prior to linting, but when I do it with coffeelint.rb
at the command line or through a Rake task (using the bundled coffeelint 1.9.1 code), I get this error:
$ coffeelint.rb -f config/coffeelint.json app/assets/javascripts/components/page.coffee.cjsx
lint@(execjs):281:29: TypeError: undefined is not an object (evaluating 'ruleLoader.require') (ExecJS::ProgramError)
from (execjs):2786:12
from (execjs):2790:21
from (execjs):1:46
from global code@(execjs):1:58
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:32:in `exec'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:21:in `eval'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:39:in `call'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/coffeelint-1.9.1/lib/coffeelint.rb:49:in `lint'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/coffeelint-1.9.1/lib/coffeelint.rb:53:in `lint_file'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/coffeelint-1.9.1/lib/coffeelint.rb:104:in `run_test'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/coffeelint-1.9.1/lib/coffeelint/cmd.rb:86:in `block in main'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/coffeelint-1.9.1/lib/coffeelint/cmd.rb:82:in `each'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/coffeelint-1.9.1/lib/coffeelint/cmd.rb:82:in `main'
from /Users/geoff/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/coffeelint-1.9.1/bin/coffeelint.rb:5:in `<top (required)>'
from /Users/geoff/.rbenv/versions/2.2.1/bin/coffeelint.rb:23:in `load'
from /Users/geoff/.rbenv/versions/2.2.1/bin/coffeelint.rb:23:in `<main>'
I get a similar issue if I specify the coffeelint.js file installed through npm, but I don't get the issue if I run my tests through the coffeelint executable that comes from npm. I'm trying to figure out if there's either something straightforward that I'm missing or if there's a way to allow the gem to use coffeelint with other npm packages to integrate transforms.
How can i add plugins to coffeelint, since i did not instal it "the normal way"but used this gem instead.
an expample pluging: https://www.npmjs.com/package/coffeelint-camel-case-vars
https://github.com/zmbush/coffeelint-ruby/blob/master/lib/tasks/coffeelint.rake#L3
The rake task calls Coffeelint.run_test_suite
on app and spec.
success = Coffeelint.run_test_suite('app') and Coffeelint.run_test_suite('spec')
The new implementation of Coffeelint.run_test_suite
exits with the number of failures. This causes the rake task to exit after running Coffeelint.run_test_suite('app')
. Is there a reason to exit in run_test_suite? I can make the changes. Just wondering how you would like to structure the code. Another method to run the test suite that can be used by run_test_suite and the rake task, or to remove the exit from run_test_suite, or another option?
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?
When using the Ruby Gem > 0.0.6
I get this error: No such file or directory - /Users/user/.rvm/gems/ruby-2.0.0-p247@gemset/gems/coffeelint-0.1.1/coffeelint/src/coffeelint.coffee
It doesn't happen when using gem 'coffeelint', :git => 'git://github.com/zipcodeman/coffeelint-ruby.git', :submodules => true
so I'm guessing the submodule isn't loaded with the Ruby Gem.
Possible side-effect of f1ef116?
I've got a custom coffeelint.json that gives more errors/warns when I run
coffeelint -f lib/tasks/coffeelint.json .
than when I run a raketask using coffeelint-ruby and the config file.
Coffeelint.lint "hey: ->\n @bort()\n", missing_fat_arrows: { level: 'error' }
and
Coffeelint.lint "hey: =>\n bort()\n", no_unnecessary_fat_arrows: { level: 'error' }
both give no errors.
The cyclomatic complexity rule is also being ignored.
I'd like to provide an empty config, or a config with a couple options in it, without other rules being enabled by default. Is there any way to disable all rules?
There's an update available: http://www.coffeelint.org/#changelog
coffeelint
โก #4-44: The cyclomatic complexity is too damn high. 12.
coffeelint-ruby
โ 4: The cyclomatic complexity is too damn high, 12.
Hi,
Is it possible to add --checkstyle option to rake task?
Support for a .coffeelintignore
file was added to coffeelint back in v1.6.0, but apparently this never gets picked up when running coffeelint.rb
.
For this project, we're using coffeelint as part of our CI chain:
https://github.com/braingourmets/gethdo
With Rails 4.2.7, the coffeelint tasks gets executed when running the default Rake task:
klee@gonzales:~/src/ruby/gethdo$ bin/rake
Running via Spring preloader in process 31536
...
โ app/assets/javascripts/home.js.coffee
...
However, the coffee_lint task is not listed among the available Rake tasks:
klee@gonzales:~/src/ruby/gethdo$ bin/rake -T
Running via Spring preloader in process 31761
...
rake bundle_audit:run # Update vulnerabilities database and check gems using bundle-audit
rake bundle_audit:update # Update bundle-audit database
rake cache_digests:dependencies # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake cache_digests:nested_dependencies # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake db:create # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in...
rake db:drop # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the c...
rake db:fixtures:load # Load fixtures into the current environment's database
Now, when we upgrade to Rails 5.0.0 and run the default Rake task, coffee_lint crashes:
LoadError: cannot load such file -- /home/klee/src/ruby/gethdo/test
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:293:in `require'
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:293:in `block in require'
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:259:in `load_dependency'
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:293:in `require'
/home/klee/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/test_unit/test_requirer.rb:11:in `block in require_files'
/home/klee/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/test_unit/test_requirer.rb:10:in `each'
/home/klee/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/test_unit/test_requirer.rb:10:in `require_files'
/home/klee/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/test_unit/minitest_plugin.rb:76:in `plugin_rails_init'
/home/klee/.rvm/gems/ruby-2.3.1/gems/minitest-5.9.0/lib/minitest.rb:80:in `block in init_plugins'
/home/klee/.rvm/gems/ruby-2.3.1/gems/minitest-5.9.0/lib/minitest.rb:78:in `each'
/home/klee/.rvm/gems/ruby-2.3.1/gems/minitest-5.9.0/lib/minitest.rb:78:in `init_plugins'
/home/klee/.rvm/gems/ruby-2.3.1/gems/minitest-5.9.0/lib/minitest.rb:129:in `run'
/home/klee/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/test_unit/minitest_plugin.rb:64:in `rake_run'
/home/klee/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/test_unit/testing.rake:15:in `block in <top (required)>'
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:287:in `load'
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:287:in `block in load'
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:259:in `load_dependency'
/home/klee/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/dependencies.rb:287:in `load'
-e:1:in `<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
I've created a branch for this:
https://github.com/braingourmets/gethdo/tree/task/rails-5
https://travis-ci.org/braingourmets/gethdo/builds/145869385
So the things to solve are:
This is breaking other libraries which expect the binary to be called coffeelint
In my coffeelint.json I have some rules set to warn, but coffeelint-ruby displays them in red the same as errors.
As it is the existing rake task runs the linter with the default rule-set. It should be extended with an argument for the path of a custom config file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.