Giter VIP home page Giter VIP logo

roodi's People

Contributors

anicholson avatar bf4 avatar boutil avatar davearonson avatar evjan avatar martinjandrews avatar mdub avatar mgotink avatar thejefe avatar virgilm avatar xaviershay avatar zdennis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

roodi's Issues

Identifies rescue block as empty when returning []

I have the following code in a project, and Roodi was returning the error "Rescue block should not be empty":

def directory_listing
  @path.dirname.children
rescue Errno::ENOENT
  []
end

If I add an explicit return, or change [] to Array.new the error goes away.

Remove noisy Rakefile line

Currently you need to have this in your Rakefile for Roodi to run as part of your build:

require 'roodi_task'
RoodiTask.new
task :default => [:roodi]

The middle line shouldn't be necessary, so remove it.

Incorrectly detecting method line count

I have the following private method in one of my Rails controllers:

def add_resources
  @stylesheets.push(:customer_orders)
  @javascripts.push(:finder, :effects, :controls, :lightbox, :customer_orders, :customer_alert)
end

A roodi check on this method raises the following issue:

app/controllers/customer_orders_controller.rb:123 - Method "add_resources" has 124 lines.  It should have 50 or less

RuntimeError with Ruby 2.3

Source:

https://github.com/mcandre/mcandre/tree/master/ruby

Trace:

bundle exec roodi -config=roodi.yml *.rb **/*.rb

Running Roodi checks
ccard/ccard.rb:62 - Method "main" has 52 lines.  It should have 50 or less.
tiny/tiny.rb:111 - Method "main" has 51 lines.  It should have 50 or less.

Checked 47 files
/Users/andrew.pennebaker/.gem/ruby/2.3.0/gems/roodi-4.1.1/lib/roodi/core/runner.rb:52:in `output_result': Found 2 errors. (RuntimeError)
    from /Users/andrew.pennebaker/.gem/ruby/2.3.0/gems/roodi-4.1.1/lib/roodi/core/runner.rb:41:in `start'
    from /Users/andrew.pennebaker/.gem/ruby/2.3.0/gems/roodi-4.1.1/bin/roodi:13:in `<top (required)>'
    from /Users/andrew.pennebaker/.gem/ruby/2.3.0/bin/roodi:23:in `load'
    from /Users/andrew.pennebaker/.gem/ruby/2.3.0/bin/roodi:23:in `<main>'
    from /Users/andrew.pennebaker/.gem/ruby/2.3.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/andrew.pennebaker/.gem/ruby/2.3.0/bin/ruby_executable_hooks:15:in `<main>'
rake aborted!
Command failed with status (1): [bundle exec roodi -config=roodi.yml *.rb *...]

System:

  • Ruby 2.3
  • chruby
  • rvm
  • Mac OS X El Capitan 10.11.2

Roodi doesn't work in ruby 1.9

It looks like the default roodi.yml file is bad. The new more strict parser complains and blows up.

Instead of:
ModuleLineCountCheck: { line_count: 300 }

Should be
ModuleLineCountCheck:
line_count: 300

Suggestion: Add IfMissingElseCheck check

I was wondering if you'd consider adding a new check similar to CaseMissingElseCheck, but for if statements? I think that the reasons for having an else condition on an if are just as valid as for case statements.

Can't run roodi in Windows

When I try to roodi my project, it throws EACCES.

Trace:

$ roodi .
c:/Ruby193/lib/ruby/gems/1.9.1/gems/roodi-2.2.0/lib/roodi/core/runner.rb:34:in `read': Permission denied - . (Errno::EACCES)
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/roodi-2.2.0/lib/roodi/core/runner.rb:34:in `check_file'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/roodi-2.2.0/bin/roodi:14:in `block (2 levels) in <top (required)>'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/roodi-2.2.0/bin/roodi:14:in `each'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/roodi-2.2.0/bin/roodi:14:in `block in <top (required)>'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/roodi-2.2.0/bin/roodi:13:in `each'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/roodi-2.2.0/bin/roodi:13:in `<top (required)>'
        from c:/Ruby193/bin/roodi:23:in `load'
        from c:/Ruby193/bin/roodi:23:in `<main>'

System:

$ specs ruby os
Specs:

specs 0.4
https://github.com/mcandre/specs#readme

bundle --version
Bundler version 1.3.2

gem --version
2.0.3

ruby --version
ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows XP Professional
OS Version:                5.1.2600 Service Pack 3 Build 2600

Facets breaking standard ruby methods

The standard ruby Object#extend method accepts N arguments, however facets replaces it with a method that only accepts a single argument and a block.

This is causing issues with another gem that I'm loading into my rails app - is it possible to stop using facets, or only include the bare minimum you need?

Doesn't seem to load config file

When I create a roodi.yml and put what's currently in the default roodi.yml in there and then tweak the MethodLineCountCheck to 1, roodi still doesn't find any errors in my code. I definitely have methods that are longer than 1 line.

roodi 2.0.0 ignores custom roodi.yml when called via Rake task

We instantiate a Roodi Rake task using the following code:

RoodiTask.new 'roodi', ['app//*.rb', 'lib//*.rb'], RAILS_ROOT+'/config/roodi.yml'

In roodi 1.4.0, this worked fine and allowed us to override the default configuration with our own config. After upgrading to 2.0.0, no matter what we try, only the default config is used.

Upon examining lib/roodi/core/runner.rb, I can see that the load_checks method is only called in initalize(), which is too early for the Rake task to override the DEFAULT_CONFIG value. Version 1.4.0 called load_checks in the check() method.

Roodi doesn't like the default application.html.erb in Rails 4

Gave the following error in a brand spanking new Rails 4 project:

Running Roodi checks
./app/views/layouts/application.html.erb looks like it's not a valid Ruby file.

Checked 20 files
rake aborted!
Found 1 errors.
/Users/peterevjan/projekt/roodi/lib/roodi_task.rb:35:in `block in define'

`evaluate_node': wrong number of arguments (1 for 0) (ArgumentError)

I get this when running roodi on any of my ruby code (I'm running ruby 1.9.1 p376). Happens on 2 different machines:

$ roodi app/controllers/home_controller.rb 
/usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/checks/check.rb:32:in `evaluate_node': wrong number of arguments (1 for 0) (ArgumentError)
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/checks/check.rb:36:in `evaluate_node_start'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/core/checking_visitor.rb:18:in `block in visit'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/core/checking_visitor.rb:18:in `each'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/core/checking_visitor.rb:18:in `visit'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/core/visitable_sexp.rb:6:in `accept'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/core/runner.rb:25:in `check'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/lib/roodi/core/runner.rb:33:in `check_file'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/bin/roodi:14:in `block (2 levels) in <top (required)>'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/bin/roodi:14:in `each'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/bin/roodi:14:in `block in <top (required)>'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/bin/roodi:13:in `each'
from /usr/local/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/roodi-2.0.1/bin/roodi:13:in `<top (required)>'
from /usr/local/bin/ruby_bin/roodi:19:in `load'
from /usr/local/bin/ruby_bin/roodi:19:in `<main>'

Anyone ever seen this before?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.