Created
July 11, 2015 07:06
-
-
Save backus/86131c1f8ff84392e6f3 to your computer and use it in GitHub Desktop.
Guard critics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
ruby '2.2.2' | |
group :development do | |
# Handle file system changes and run things | |
gem 'guard', '~> 2.12.4' | |
# Intelligently Autorun Tests | |
gem 'guard-rspec', '~> 4.2.0' | |
# Autorun documentation critic | |
gem 'guard-inch', '~> 0.1', require: false | |
# Autorun codesmell critic | |
gem 'guard-reek', '= 0.0.2', require: false, github: 'backus/guard-reek' | |
# Autorun similar code critic | |
gem 'guard-flay', '= 0.0.3', require: false, github: 'backus/guard-flay' | |
# Autorun painful code critic | |
gem 'guard-flog', '= 0.0.4', require: false, github: 'backus/guard-flog' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Critique documentation | |
guard :inch do | |
watch(/.+\.rb/) | |
end | |
# Critique code smells | |
guard 'reek' do | |
watch(%r{.+\.rb$}) | |
end | |
# Critique the most painful code | |
guard :flog do | |
watch(%r{^lib/(.+)\.rb$}) | |
# Rails example | |
watch(%r{^app/(.+)\.rb$}) | |
end | |
# Critique code for structural similarities | |
guard :flay do | |
watch(%r{^lib/(.+)\.rb$}) | |
# Rails example | |
watch(%r{^app/(.+)\.rb$}) | |
watch(%r{^app/(.*)(\.erb|\.haml)$}) | |
watch('config/routes.rb') | |
# Flay specs | |
watch(%r{^spec/(.+)_spec\.rb$}) | |
end | |
# RSpec is often the longest running guard so we put it last | |
guard :rspec, cmd: 'bin/rspec' do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { "spec" } | |
# Rails example | |
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } | |
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } | |
watch('config/routes.rb') { "spec/routing" } | |
watch('app/controllers/application_controller.rb') { "spec/controllers" } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment