gry 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Guardfile +59 -0
- data/README.md +29 -0
- data/Rakefile +5 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/gry +5 -0
- data/gry.gemspec +39 -0
- data/lib/gry.rb +32 -0
- data/lib/gry/analyzer.rb +95 -0
- data/lib/gry/cli.rb +14 -0
- data/lib/gry/formatter.rb +34 -0
- data/lib/gry/option.rb +23 -0
- data/lib/gry/rubocop_adapter.rb +67 -0
- data/lib/gry/rubocop_runner.rb +45 -0
- data/lib/gry/strategy.rb +24 -0
- data/lib/gry/version.rb +3 -0
- metadata +261 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 63549df3c6efaaad29416336c63e294c76e73c96
|
4
|
+
data.tar.gz: bafe73cd5a538f6f528438181529c02c5a28e8c5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1d5aeaf572eded38eea5d4612e5431f003c3e3eb981ee55059ef7bbaed5a41c306136c475469466b3b4564c5115d9293d096e1967fb7020785ca08b25d75e083
|
7
|
+
data.tar.gz: 6945cbd5360f4d4783563d40460f2976c918901b7a3126fc6dce2c1f6f25f556b209396232a04672da300a5bf2fe6c1bf676aae2d4bbef3e7ec16e04eaa6f7d6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
guard :bundler do
|
19
|
+
require 'guard/bundler'
|
20
|
+
require 'guard/bundler/verify'
|
21
|
+
helper = Guard::Bundler::Verify.new
|
22
|
+
|
23
|
+
files = ['Gemfile']
|
24
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
25
|
+
|
26
|
+
# Assume files are symlinked from somewhere
|
27
|
+
files.each { |file| watch(helper.real_path(file)) }
|
28
|
+
end
|
29
|
+
|
30
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
31
|
+
# rspec may be run, below are examples of the most common uses.
|
32
|
+
# * bundler: 'bundle exec rspec'
|
33
|
+
# * bundler binstubs: 'bin/rspec'
|
34
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
35
|
+
# installed the spring binstubs per the docs)
|
36
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
37
|
+
# * 'just' rspec: 'rspec'
|
38
|
+
|
39
|
+
guard :rspec, cmd: "DONT_RUN_SLOW_SPEC=1 bundle exec rspec" do
|
40
|
+
require "guard/rspec/dsl"
|
41
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
42
|
+
|
43
|
+
# Feel free to open issues for suggestions and improvements
|
44
|
+
|
45
|
+
# RSpec files
|
46
|
+
rspec = dsl.rspec
|
47
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
48
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
49
|
+
watch(rspec.spec_files)
|
50
|
+
|
51
|
+
# Ruby files
|
52
|
+
ruby = dsl.ruby
|
53
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
54
|
+
end
|
55
|
+
|
56
|
+
guard :rubocop do
|
57
|
+
watch(%r{.+\.rb$})
|
58
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
59
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Gry (Work In Progress!)
|
2
|
+
|
3
|
+
[](https://travis-ci.org/pocke/gry)
|
4
|
+
[](https://coveralls.io/github/pocke/gry?branch=master)
|
5
|
+
|
6
|
+
Gry generates `.rubocop.yml` automatically.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```sh
|
11
|
+
$ gem install gry
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
```sh
|
17
|
+
$ gry Style/EmptyElse Style/AlignParameters
|
18
|
+
```
|
19
|
+
|
20
|
+
## Development
|
21
|
+
|
22
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
23
|
+
|
24
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pocke/gry.
|
29
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gry"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/gry
ADDED
data/gry.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gry/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gry"
|
8
|
+
spec.version = Gry::VERSION
|
9
|
+
spec.authors = ["Masataka Kuwabara"]
|
10
|
+
spec.email = ["p.ck.t22@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{}
|
13
|
+
spec.description = %q{}
|
14
|
+
spec.homepage = "https://github.com/pocke/gry"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 2.3.0'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.5.0"
|
26
|
+
spec.add_development_dependency "rspec-power_assert", "~> 0.4.0"
|
27
|
+
spec.add_development_dependency 'coveralls', '~> 0.8.16'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.12.0'
|
29
|
+
spec.add_development_dependency "guard", "~> 2.14.0"
|
30
|
+
spec.add_development_dependency "guard-rspec", "~> 4.7.3"
|
31
|
+
spec.add_development_dependency "guard-bundler", "~> 2.1.0"
|
32
|
+
spec.add_development_dependency "guard-rubocop", "~> 1.2.0"
|
33
|
+
spec.add_development_dependency "rubocop", ">= 0.46.0"
|
34
|
+
spec.add_development_dependency "meowcop", ">= 1.4.0"
|
35
|
+
|
36
|
+
# TODO: specify 0.47.0
|
37
|
+
spec.add_runtime_dependency "rubocop", ">= 0.46.0"
|
38
|
+
spec.add_runtime_dependency "parallel", "~> 1.10.0"
|
39
|
+
end
|
data/lib/gry.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'tempfile'
|
3
|
+
require 'yaml'
|
4
|
+
require 'json'
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
require 'rubocop'
|
8
|
+
require 'parallel'
|
9
|
+
|
10
|
+
require "gry/version"
|
11
|
+
require 'gry/rubocop_runner'
|
12
|
+
require 'gry/analyzer'
|
13
|
+
require "gry/option"
|
14
|
+
require 'gry/cli'
|
15
|
+
require 'gry/rubocop_adapter'
|
16
|
+
require 'gry/strategy'
|
17
|
+
require 'gry/formatter'
|
18
|
+
|
19
|
+
module Gry
|
20
|
+
@debug = false
|
21
|
+
def self.debug?
|
22
|
+
@debug
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.debug_mode!
|
26
|
+
@debug = true
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.debug_log(msg)
|
30
|
+
$stderr.puts msg if debug?
|
31
|
+
end
|
32
|
+
end
|
data/lib/gry/analyzer.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
module Gry
|
2
|
+
class Analyzer
|
3
|
+
# @param cops [Array<String>] cop names. e.g.) ['Style/EmptyElse']
|
4
|
+
def initialize(cops, process:)
|
5
|
+
@cops = cops
|
6
|
+
@process = process == 1 ? 0 : process
|
7
|
+
end
|
8
|
+
|
9
|
+
def analyze
|
10
|
+
configs = @cops.map{|cop_name| cop_configs(cop_name)}
|
11
|
+
max = configs.max_by(&:size).size
|
12
|
+
configs.each do |c|
|
13
|
+
c.fill(nil, c.size..(max-1))
|
14
|
+
end
|
15
|
+
|
16
|
+
rubocop_args = configs.transpose.map do |conf_set|
|
17
|
+
compacted = conf_set.compact
|
18
|
+
setting = compacted.inject({}) do |a, b|
|
19
|
+
a.merge(b)
|
20
|
+
end
|
21
|
+
cops = setting.keys
|
22
|
+
|
23
|
+
[cops, setting]
|
24
|
+
end
|
25
|
+
|
26
|
+
gry_result = execute_rubocop(rubocop_args)
|
27
|
+
Formatter.format(gry_result)
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# @param rubocop_args [Array]
|
34
|
+
# ['Style/DotPosition', {...}, ...]
|
35
|
+
# @param result [Hash]
|
36
|
+
# {'Style/DotPosition' => { {conf} => count}}
|
37
|
+
def execute_rubocop(rubocop_args)
|
38
|
+
res = {}
|
39
|
+
|
40
|
+
runners = rubocop_args.map do |arg|
|
41
|
+
cops, setting = *arg
|
42
|
+
setting.each do |cop_name, s|
|
43
|
+
res[cop_name] ||= {}
|
44
|
+
res[cop_name][s] ||= 0
|
45
|
+
end
|
46
|
+
|
47
|
+
RubocopRunner.new(cops, setting)
|
48
|
+
end
|
49
|
+
|
50
|
+
results = Parallel.map(runners, in_threads: @process, &:run)
|
51
|
+
|
52
|
+
results.each.with_index do |result, idx|
|
53
|
+
setting = rubocop_args[idx][1]
|
54
|
+
|
55
|
+
result['files'].each do |f|
|
56
|
+
f['offenses'].each do |offense|
|
57
|
+
cop_name = offense['cop_name']
|
58
|
+
next if cop_name == 'Syntax' # Syntax cop is not configurable.
|
59
|
+
res[cop_name][setting[cop_name]] += 1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
res
|
65
|
+
end
|
66
|
+
|
67
|
+
# @param cop_name [String]
|
68
|
+
# @return [Array<Hash>]
|
69
|
+
def cop_configs(cop_name)
|
70
|
+
cop_config = RubocopAdapter.default_config[cop_name]
|
71
|
+
|
72
|
+
# e.g. %w[EnforcedHashRocketStyle EnforcedColonStyle EnforcedLastArgumentHashStyle]
|
73
|
+
enforced_style_names = RubocopAdapter.configurable_styles(cop_config)
|
74
|
+
|
75
|
+
# e.g. [
|
76
|
+
# %w[key separator table],
|
77
|
+
# %w[key separator table],
|
78
|
+
# w[always_inspect always_ignore ignore_implicit ignore_explicit],
|
79
|
+
# ]
|
80
|
+
supported_styles = enforced_style_names
|
81
|
+
.map{|style_name| RubocopAdapter.to_supported_styles(style_name)}
|
82
|
+
.map{|supported_style_name| cop_config[supported_style_name]}
|
83
|
+
|
84
|
+
supported_styles[0].product(*supported_styles[1..-1]).map do |style_values|
|
85
|
+
conf = style_values
|
86
|
+
.map.with_index{|value, idx| [enforced_style_names[idx], value]}
|
87
|
+
.to_h
|
88
|
+
conf['Enabled'] = true
|
89
|
+
{
|
90
|
+
cop_name => conf
|
91
|
+
}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
data/lib/gry/cli.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Gry
|
2
|
+
class CLI
|
3
|
+
def initialize(argv)
|
4
|
+
@argv = argv
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
opt = Option.new(@argv)
|
9
|
+
cops = opt.all ? RubocopAdapter.configurable_cops : opt.args
|
10
|
+
analyzer = Gry::Analyzer.new(cops, process: opt.process)
|
11
|
+
puts analyzer.analyze
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Gry
|
2
|
+
module Formatter
|
3
|
+
# @param gry_result [Hash]
|
4
|
+
# {'Style/DotPosition' => { {conf} => count}}
|
5
|
+
# @return [String] a yaml string
|
6
|
+
def self.format(gry_result)
|
7
|
+
confs = gry_result.map do |cop_name, set_count|
|
8
|
+
setting = Strategy.results_to_config(set_count)
|
9
|
+
next unless setting
|
10
|
+
to_comment(set_count) + to_yaml({cop_name => setting})
|
11
|
+
end.compact
|
12
|
+
|
13
|
+
to_yaml(RubocopAdapter.config_base) +
|
14
|
+
"\n" +
|
15
|
+
confs.join("\n")
|
16
|
+
end
|
17
|
+
|
18
|
+
private_class_method
|
19
|
+
|
20
|
+
def self.to_yaml(hash)
|
21
|
+
YAML.dump(hash)[4..-1]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.to_comment(set_count)
|
25
|
+
set_count.map do |setting, count|
|
26
|
+
x = setting
|
27
|
+
.reject{|key, _| key == 'Enabled'}
|
28
|
+
.map{|key, value| "#{key}: #{value}"}
|
29
|
+
.join(', ')
|
30
|
+
"# #{x} => #{count}\n"
|
31
|
+
end.join
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/gry/option.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Gry
|
2
|
+
class Option
|
3
|
+
class ParseError < StandardError; end
|
4
|
+
|
5
|
+
attr_reader :args, :all, :process
|
6
|
+
|
7
|
+
def initialize(argv)
|
8
|
+
opt = OptionParser.new
|
9
|
+
@all = false
|
10
|
+
@process = Parallel.processor_count
|
11
|
+
|
12
|
+
opt.on('-d', '--debug') {Gry.debug_mode!}
|
13
|
+
opt.on('-a', '--all') {@all = true}
|
14
|
+
opt.on('-p', '--process=VAL') {|v| @process = v.to_i}
|
15
|
+
|
16
|
+
@args = opt.parse(argv)
|
17
|
+
|
18
|
+
if @all && !@args.empty?
|
19
|
+
raise ParseError, 'Do not specify cop name with --all option'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Gry
|
2
|
+
module RubocopAdapter
|
3
|
+
module_function
|
4
|
+
|
5
|
+
def default_config
|
6
|
+
RuboCop::ConfigLoader.default_configuration
|
7
|
+
end
|
8
|
+
|
9
|
+
def configurable_cops
|
10
|
+
conf = RuboCop::ConfigLoader.default_configuration.to_h
|
11
|
+
conf
|
12
|
+
.reject{|_key, cop_conf| configurable_styles(cop_conf).empty?}
|
13
|
+
.reject{|key, _cop_conf| !rails? && key.start_with?('Rails/')}
|
14
|
+
.select{|key, _cop_conf| conf = config_specified_by_user.for_cop(key); conf.empty? || !conf['Enabled']}
|
15
|
+
.keys
|
16
|
+
end
|
17
|
+
|
18
|
+
# @param cop_conf [Hash]
|
19
|
+
def configurable_styles(cop_conf)
|
20
|
+
cop_conf.keys.select do |key|
|
21
|
+
key.start_with?('Enforced')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_supported_styles(enforced_style)
|
26
|
+
RuboCop::Cop::Util.to_supported_styles(enforced_style)
|
27
|
+
end
|
28
|
+
|
29
|
+
def target_ruby_version
|
30
|
+
current_config.target_ruby_version
|
31
|
+
end
|
32
|
+
|
33
|
+
def rails?
|
34
|
+
return @rails if defined?(@rails)
|
35
|
+
@rails = current_config.to_h.dig('Rails', 'Enabled') ||
|
36
|
+
File.exist?('./bin/rails') ||
|
37
|
+
File.exist?('./script/rails')
|
38
|
+
end
|
39
|
+
|
40
|
+
def current_config
|
41
|
+
RuboCop::ConfigStore.new.for(Dir.pwd)
|
42
|
+
end
|
43
|
+
|
44
|
+
def config_specified_by_user
|
45
|
+
path = RuboCop::ConfigLoader.configuration_file_for(Dir.pwd)
|
46
|
+
if path == RuboCop::ConfigLoader::DEFAULT_FILE
|
47
|
+
RuboCop::Config.new
|
48
|
+
else
|
49
|
+
RuboCop::ConfigLoader.load_file(path)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def config_base
|
54
|
+
base = {
|
55
|
+
'AllCops' => {
|
56
|
+
'TargetRubyVersion' => RubocopAdapter.target_ruby_version,
|
57
|
+
},
|
58
|
+
}
|
59
|
+
return base unless rails?
|
60
|
+
base.merge({
|
61
|
+
'Rails' => {
|
62
|
+
'Enabled' => true,
|
63
|
+
}
|
64
|
+
})
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Gry
|
2
|
+
# Run RuboCop with spwcify cops and config
|
3
|
+
class RubocopRunner
|
4
|
+
# @param cops [Array<String>] cop names. e.g.) ['Style/EmptyElse']
|
5
|
+
# @param setting [Hash] e.g.) {'Style/EmptyElse' => {'EnforcedStyle' => 'both'}}
|
6
|
+
def initialize(cops, setting)
|
7
|
+
@cops = cops
|
8
|
+
setting_base = RubocopAdapter.config_base
|
9
|
+
@setting = setting_base.merge(setting)
|
10
|
+
@tmp_setting_path = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
prepare
|
15
|
+
out = run_rubocop
|
16
|
+
JSON.parse(out)
|
17
|
+
ensure
|
18
|
+
clean
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def prepare
|
25
|
+
f = Tempfile.create(['gry-rubocop-config-', '.yml'])
|
26
|
+
@tmp_setting_path = f.path
|
27
|
+
|
28
|
+
f.write(YAML.dump(@setting))
|
29
|
+
f.close
|
30
|
+
end
|
31
|
+
|
32
|
+
def run_rubocop
|
33
|
+
only = "--only #{@cops.join(',')}"
|
34
|
+
conf = "--config #{@tmp_setting_path}"
|
35
|
+
cmd = "rubocop #{only} #{conf} --format json"
|
36
|
+
Gry.debug_log "Execute: #{cmd}"
|
37
|
+
# TODO: error handling
|
38
|
+
`#{cmd}`
|
39
|
+
end
|
40
|
+
|
41
|
+
def clean
|
42
|
+
FileUtils.rm(@tmp_setting_path) if @tmp_setting_path && !Gry.debug?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/gry/strategy.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Gry
|
2
|
+
# Strategy decides a rule config from rubocop results.
|
3
|
+
module Strategy
|
4
|
+
# The method returns
|
5
|
+
# @param results [Hash{Hash => Integer}] rubocop results
|
6
|
+
# {
|
7
|
+
# {config1} => 20,
|
8
|
+
# {config2} => 0,
|
9
|
+
# {config3} => 10,
|
10
|
+
# }
|
11
|
+
# @return [Hash{}] returns a config decided from received configs
|
12
|
+
# {
|
13
|
+
# EnforcedStyle: 'foobar',
|
14
|
+
# }
|
15
|
+
# @return [NilClass] if config is not available, retunrs nil
|
16
|
+
def self.results_to_config(results, count_limit: 10)
|
17
|
+
results
|
18
|
+
.select{|_conf, count| count <= count_limit }
|
19
|
+
.sort_by{|_conf, count| count}
|
20
|
+
.first # to get minimum conf and count
|
21
|
+
&.first # to get conf
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/gry/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masataka Kuwabara
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.5.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.5.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-power_assert
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.4.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.4.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.8.16
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.8.16
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.12.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.12.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.14.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.14.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 4.7.3
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 4.7.3
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: guard-bundler
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.1.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.1.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: guard-rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.2.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.2.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.46.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.46.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: meowcop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.4.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 1.4.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.46.0
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.46.0
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: parallel
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 1.10.0
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 1.10.0
|
209
|
+
description: ''
|
210
|
+
email:
|
211
|
+
- p.ck.t22@gmail.com
|
212
|
+
executables:
|
213
|
+
- gry
|
214
|
+
extensions: []
|
215
|
+
extra_rdoc_files: []
|
216
|
+
files:
|
217
|
+
- ".gitignore"
|
218
|
+
- ".rspec"
|
219
|
+
- ".rubocop.yml"
|
220
|
+
- ".travis.yml"
|
221
|
+
- Gemfile
|
222
|
+
- Guardfile
|
223
|
+
- README.md
|
224
|
+
- Rakefile
|
225
|
+
- bin/console
|
226
|
+
- bin/setup
|
227
|
+
- exe/gry
|
228
|
+
- gry.gemspec
|
229
|
+
- lib/gry.rb
|
230
|
+
- lib/gry/analyzer.rb
|
231
|
+
- lib/gry/cli.rb
|
232
|
+
- lib/gry/formatter.rb
|
233
|
+
- lib/gry/option.rb
|
234
|
+
- lib/gry/rubocop_adapter.rb
|
235
|
+
- lib/gry/rubocop_runner.rb
|
236
|
+
- lib/gry/strategy.rb
|
237
|
+
- lib/gry/version.rb
|
238
|
+
homepage: https://github.com/pocke/gry
|
239
|
+
licenses: []
|
240
|
+
metadata: {}
|
241
|
+
post_install_message:
|
242
|
+
rdoc_options: []
|
243
|
+
require_paths:
|
244
|
+
- lib
|
245
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 2.3.0
|
250
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '0'
|
255
|
+
requirements: []
|
256
|
+
rubyforge_project:
|
257
|
+
rubygems_version: 2.5.2
|
258
|
+
signing_key:
|
259
|
+
specification_version: 4
|
260
|
+
summary: ''
|
261
|
+
test_files: []
|