-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
157 additions
and
56 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MethodLength: | ||
Max: 20 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,54 @@ | ||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
require 'bundler/gem_tasks' | ||
require 'rspec/core/rake_task' | ||
require 'flay' | ||
require 'flay_task' | ||
require 'flog' | ||
require 'reek/rake/task' | ||
require 'rubocop/rake_task' | ||
|
||
ruby_source = FileList['lib/**/*.rb'] | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
task default: :spec | ||
task quality: :rubocop | ||
|
||
Reek::Rake::Task.new do |t| | ||
t.fail_on_error = false | ||
t.verbose = false | ||
t.ruby_opts = ['-rubygems'] | ||
t.reek_opts = '--quiet' | ||
t.source_files = ruby_source | ||
end | ||
|
||
FlayTask.new do |t| | ||
t.dirs = ruby_source.map do |each| | ||
each[/[^\/]+/] | ||
end.uniq | ||
t.threshold = 0 | ||
t.verbose = true | ||
end | ||
|
||
desc 'Analyze for code complexity' | ||
task :flog do | ||
flog = Flog.new(continue: true) | ||
flog.flog(*ruby_source) | ||
threshold = 28 | ||
|
||
bad_methods = flog.totals.select do |name, score| | ||
!(/##{flog.no_method}$/ =~ name) && score > threshold | ||
end | ||
bad_methods.sort { |a, b| a[1] <=> b[1] }.reverse.each do |name, score| | ||
printf "%8.1f: %s\n", score, name | ||
end | ||
unless bad_methods.empty? | ||
$stderr.puts "#{bad_methods.size} methods have a complexity > #{threshold}" | ||
end | ||
end | ||
|
||
Rubocop::RakeTask.new do |task| | ||
task.patterns = %w(lib/**/*.rb | ||
spec/**/*.rb | ||
Rakefile | ||
Gemfile) | ||
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Base module | ||
module JsonCli | ||
VERSION = "0.0.1" | ||
VERSION = '0.0.1' | ||
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
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