ignitebaltimore / ignitespeak

Collects and organizes Ignite speaking proposals
15 stars 18 forks source link

Add code complexity / best practices tool #11

Open subelsky opened 9 years ago

subelsky commented 9 years ago

Not sure what the state of the art here is. But I'd like to run Brakeman for security analysis, and various other Ruby projects that check the code for style / design problems.

The goal here is to make the Ignite Speak app a really shining example of the most awesome way to build (smallish) Rails apps

trendwithin commented 9 years ago

Brakeman can be run locally by installing the gem. Currently there is one issue:

Medium | ApplicationController | Cross-Site Request Forgery | protect_from_forgery should be configured with 'with: :exception'

Rubocop is a must, but it doesn't like double quotes and spits out errors for much of Rails generated code that users them. This can be configured, however. There is also houndci.com but it doesn't always agree with Rubocop. Also the CodeClimate badge now on the README has a section for style guide CC: IgniteSpeak Style

subelsky commented 9 years ago

@trendwithin I agree with that exception change, I wouldn't be surprised if it's a rails default in newer apps (this app was started a few years ago)

Is there something better we could use for code analysis besides Rubocop?

trendwithin commented 9 years ago

I'd suggest Hound since it will check against github.

Since you're looking at implementing best practice do you have any thoughts on rebooting this project from scratch and setting up all the CI from the get go? Looks like there is only one controller and model here and I'm wondering if the effort of trying to upgrade versions, gems and current codebase might be better spent from a clean codebase, user stories, BDD/TDD etc...

Or are you looking at this more as an exercise of building off of an existing codebase? I see that there is a live site that has an independent codebase so this might be part of a larger integration so you wish to keep this in tact.

subelsky commented 9 years ago

The primary user needs are to add more features so non-programmers use it. Right now most of the important stuff that organizers need to do live in Rake tasks.

The second-most important need is making this app more portable/deployable so we can share with other Ignite organizations.

But I've also tried to find a ton of useful things that would be good for new programmers, or experienced programmers who are new to Ruby, because open-source gardening is a good way to learn and contribute right away. This task would be one of those things :-)

trendwithin commented 9 years ago

Added Hound to project but remains to be seen what happens next. I've only used it on personal repos but unclear how it might behave under my account forking another repo. From what I see there currently isn't a badge to add to the README

subelsky commented 9 years ago

OK codeclimate is merged into the master branch, anything else we need to do here?

trendwithin commented 9 years ago

The one thing I mentioned about setting up RSpec for continuous test integration. Currently the badge on the README leads to a 404. I use MiniTest so my notes on set-up pertain to this alone. It might be best if I invite you so that you have access and can mod this as needed.

trendwithin commented 9 years ago

BTW, had my suspicions and they were founded. From the Hound FAQ: Only GitHub repository owners can enable Hound for style guide reviews.

subelsky commented 8 years ago

Oh ok, so how do I turn it on? is it like a webhook?

subelsky commented 8 years ago

I don't see Hound as one of the services I can add to the repo, btw

trendwithin commented 8 years ago

For Hound you can just sign in through github and then it will populate a list of your repos and you can choose which to 'Activate' If I'm not mistaken it kicks in on the ensuing push/pull cycle and will style check.

Here's a description of how CodeShip basically functions.

The issue I'm having getting the test suite to run is in the following stack trace. I've attempted to do a few things that I'm aware of but to no avail.

 rake aborted!
NameError: uninitialized constant RSpec::Support
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/formatters/progress_formatter.rb:1:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-instafail-0.4.0/lib/rspec/instafail/rspec_3.rb:1:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-instafail-0.4.0/lib/rspec/instafail/rspec_3.rb:1:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-instafail-0.4.0/lib/rspec/instafail.rb:3:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-instafail-0.4.0/lib/rspec/instafail.rb:3:in `<module:RSpec>'
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-instafail-0.4.0/lib/rspec/instafail.rb:1:in `<top (required)>'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:85:in `require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:85:in `rescue in block in require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:68:in `block in require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `each'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler.rb:134:in `require'
/home/rof/src/github.com/trendwithin/ignitespeak/config/application.rb:12:in `<top (required)>'
/home/rof/src/github.com/trendwithin/ignitespeak/Rakefile:5:in `require'
/home/rof/src/github.com/trendwithin/ignitespeak/Rakefile:5:in `<top (required)>'
LoadError: cannot load such file -- rspec-instafail
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `each'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `block in require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `each'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `require'
/home/rof/.rvm/gems/ruby-2.2.2/gems/bundler-1.9.5/lib/bundler.rb:134:in `require'
/home/rof/src/github.com/trendwithin/ignitespeak/config/application.rb:12:in `<top (required)>'
/home/rof/src/github.com/trendwithin/ignitespeak/Rakefile:5:in `require'
/home/rof/src/github.com/trendwithin/ignitespeak/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
subelsky commented 8 years ago

That looks like a bundler issue (because that gem is not available in your load path). What happens when you run bundle exec rake spec?