Skip to content

Instantly share code, notes, and snippets.

@sstelfox
Created June 14, 2018 15:55
Show Gist options
  • Save sstelfox/b5fdeeb07bde4748ee58a1854cd8097b to your computer and use it in GitHub Desktop.
Save sstelfox/b5fdeeb07bde4748ee58a1854cd8097b to your computer and use it in GitHub Desktop.
# The following is broken, it doesn't consider module documentation in other
# files (mostly a problem for namespace modules), it doesn't properly respect
# :nodoc: as claimed in the documentation and it doesn't consider a module a
# namespace module if if contains a constant definition.
Style/Documentation:
Enabled: false
require:
- rubocop-rspec
require 'bundler/gem_tasks'
desc 'Run a console with the application loaded'
task console: [:environment] do
require 'pry'
pry
end
task :default do
tasks = {
docs: 'Document Generation',
flay: 'Flay Report',
flog: 'Flog Report',
reek: 'Reek Results',
rubocop: 'RuboCop Report',
spec: 'RSpec Tests'
}
tasks.each do |task, title|
next unless Rake::Task.task_defined?(task)
puts format("%s:\n", title)
Rake::Task[task].invoke
puts
end
end
begin
require 'yard'
YARD::Rake::YardocTask.new(:docs)
rescue LoadError
puts 'Yardoc isn\'t available to the rake environment'
end
task :environment do
require 'tundra'
end
begin
require 'flay'
task :flay do
files = Flay.filter_files(Flay.expand_dirs_to_files('lib/'))
flay = Flay.new
flay.process(*files)
flay.report
end
rescue LoadError
puts 'Flay isn\'t available'
end
begin
require 'flog_cli'
desc 'Analyze code complexity'
task :flog do
flog = FlogCLI.new(quiet: false, continue: false, parser: RubyParser,
score: true)
flog.flog(['lib/'])
flog.report
end
rescue LoadError
puts 'Flog isn\'t available'
end
begin
require 'reek/rake/task'
Reek::Rake::Task.new do |t|
t.source_files = 'lib/'
t.verbose = false
t.fail_on_error = false
end
rescue LoadError
puts 'Reek isn\'t available to the rake environment'
end
begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |task|
task.formatters = %w(simple offenses)
task.fail_on_error = false
task.options = %w(--format html --out doc/rubocop.html)
end
rescue LoadError
puts 'Rubocop isn\'t available to the rake environment'
end
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
puts 'RSpec isn\'t available to the rake environment'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment