inch 0.4.6 → 0.4.7
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 +4 -4
- data/.rubocop.yml +15 -0
- data/.rubocop_todo.yml +113 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -2
- data/README.md +2 -2
- data/Rakefile +2 -2
- data/bin/inch +3 -2
- data/config/defaults.rb +7 -0
- data/inch.gemspec +7 -7
- data/lib/inch.rb +9 -10
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +2 -3
- data/lib/inch/api/compare/codebases.rb +1 -1
- data/lib/inch/api/diff.rb +6 -9
- data/lib/inch/api/options/base.rb +4 -4
- data/lib/inch/api/options/suggest.rb +1 -1
- data/lib/inch/api/stats.rb +0 -1
- data/lib/inch/api/suggest.rb +8 -9
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +2 -2
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +7 -8
- data/lib/inch/cli/command/inspect.rb +5 -4
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +8 -8
- data/lib/inch/cli/command/options/base_list.rb +9 -5
- data/lib/inch/cli/command/options/console.rb +4 -3
- data/lib/inch/cli/command/options/diff.rb +6 -4
- data/lib/inch/cli/command/options/inspect.rb +2 -2
- data/lib/inch/cli/command/options/list.rb +4 -3
- data/lib/inch/cli/command/options/show.rb +2 -2
- data/lib/inch/cli/command/options/stats.rb +2 -1
- data/lib/inch/cli/command/options/suggest.rb +6 -3
- data/lib/inch/cli/command/output/base.rb +2 -4
- data/lib/inch/cli/command/output/console.rb +4 -5
- data/lib/inch/cli/command/output/diff.rb +6 -6
- data/lib/inch/cli/command/output/inspect.rb +6 -8
- data/lib/inch/cli/command/output/list.rb +0 -1
- data/lib/inch/cli/command/output/show.rb +4 -5
- data/lib/inch/cli/command/output/stats.rb +21 -21
- data/lib/inch/cli/command/output/suggest.rb +28 -26
- data/lib/inch/cli/command/show.rb +4 -4
- data/lib/inch/cli/command/stats.rb +4 -4
- data/lib/inch/cli/command/suggest.rb +6 -6
- data/lib/inch/cli/command_parser.rb +6 -5
- data/lib/inch/cli/sparkline_helper.rb +2 -2
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +4 -3
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/converter.rb +6 -8
- data/lib/inch/code_object/provider.rb +1 -1
- data/lib/inch/code_object/provider/yard.rb +10 -12
- data/lib/inch/code_object/provider/yard/docstring.rb +53 -21
- data/lib/inch/code_object/provider/yard/nodoc_helper.rb +3 -3
- data/lib/inch/code_object/provider/yard/object.rb +11 -9
- data/lib/inch/code_object/provider/yard/object/base.rb +33 -9
- data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +12 -0
- data/lib/inch/code_object/provider/yard/object/method_object.rb +36 -11
- data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +2 -2
- data/lib/inch/code_object/provider/yard/object/method_signature.rb +11 -8
- data/lib/inch/code_object/provider/yard/object/namespace_object.rb +1 -4
- data/lib/inch/code_object/provider/yard/parser.rb +2 -2
- data/lib/inch/code_object/proxy.rb +10 -9
- data/lib/inch/code_object/proxy/base.rb +8 -8
- data/lib/inch/code_object/proxy/class_variable_object.rb +8 -0
- data/lib/inch/code_object/proxy/method_object.rb +3 -2
- data/lib/inch/code_object/proxy/method_parameter_object.rb +1 -1
- data/lib/inch/codebase.rb +4 -5
- data/lib/inch/codebase/objects_filter.rb +2 -4
- data/lib/inch/codebase/serializer.rb +3 -3
- data/lib/inch/config.rb +2 -2
- data/lib/inch/config/base.rb +0 -1
- data/lib/inch/config/codebase.rb +3 -3
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +16 -15
- data/lib/inch/evaluation/grade_list.rb +2 -2
- data/lib/inch/evaluation/object_schema.rb +1 -1
- data/lib/inch/evaluation/proxy.rb +8 -7
- data/lib/inch/evaluation/proxy/base.rb +12 -7
- data/lib/inch/evaluation/proxy/class_variable_object.rb +19 -0
- data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
- data/lib/inch/evaluation/proxy/method_object.rb +12 -5
- data/lib/inch/evaluation/proxy/module_object.rb +1 -1
- data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
- data/lib/inch/evaluation/role/base.rb +1 -1
- data/lib/inch/evaluation/role/class_variable.rb +55 -0
- data/lib/inch/evaluation/role/method.rb +0 -1
- data/lib/inch/evaluation/role/method_parameter.rb +2 -1
- data/lib/inch/evaluation/role/object.rb +2 -2
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +2 -2
- data/lib/inch/utils/shell_helper.rb +1 -1
- data/lib/inch/utils/ui.rb +5 -5
- data/lib/inch/utils/weighted_list.rb +2 -3
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/simple/lib/broken.rb +35 -7
- data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +7 -0
- data/test/fixtures/simple/lib/directives.rb +8 -0
- data/test/fixtures/simple/lib/foo.rb +17 -0
- data/test/integration/api/compare/codebases.rb +1 -1
- data/test/integration/cli/command/console_test.rb +5 -5
- data/test/integration/cli/command/inspect_test.rb +4 -5
- data/test/integration/cli/command/list_test.rb +3 -4
- data/test/integration/cli/command/show_test.rb +4 -4
- data/test/integration/cli/command/stats_test.rb +2 -2
- data/test/integration/cli/command/suggest_test.rb +7 -7
- data/test/integration/stats_options_test.rb +3 -3
- data/test/integration/visibility_options_test.rb +13 -13
- data/test/shared/base_list.rb +4 -3
- data/test/test_helper.rb +16 -5
- data/test/unit/api/filter_test.rb +7 -7
- data/test/unit/api/get_test.rb +1 -1
- data/test/unit/api/list_test.rb +1 -1
- data/test/unit/api/options/base_test.rb +3 -3
- data/test/unit/api/stats_test.rb +1 -1
- data/test/unit/api/suggest_test.rb +3 -3
- data/test/unit/cli/arguments_test.rb +1 -1
- data/test/unit/cli/command/base_test.rb +1 -1
- data/test/unit/cli/command/options/base_list_test.rb +2 -2
- data/test/unit/cli/command/options/base_object_test.rb +1 -1
- data/test/unit/cli/command/options/base_test.rb +1 -1
- data/test/unit/cli/command_parser_test.rb +2 -2
- data/test/unit/cli/trace_helper_test.rb +1 -1
- data/test/unit/cli/yardopts_helper_test.rb +4 -3
- data/test/unit/code_object/converter_test.rb +1 -1
- data/test/unit/code_object/provider/yard/docstring_test.rb +105 -28
- data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -5
- data/test/unit/code_object/provider/yard/object/method_object_test.rb +20 -10
- data/test/unit/code_object/provider/yard_test.rb +4 -4
- data/test/unit/code_object/provider_test.rb +1 -1
- data/test/unit/code_object/proxy/method_object_test.rb +366 -262
- data/test/unit/code_object/proxy_test.rb +1 -1
- data/test/unit/codebase/objects_test.rb +2 -2
- data/test/unit/codebase/proxy_test.rb +1 -1
- data/test/unit/config/codebase_test.rb +1 -1
- data/test/unit/evaluation/role/base_test.rb +1 -1
- data/test/unit/utils/ui_test.rb +4 -4
- data/test/unit/utils/weighted_list_test.rb +7 -4
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23c7cb734a65a10fc7e06dc15dae0ca5b845aa8e
|
4
|
+
data.tar.gz: 599a33be129999facc125af4435facc9bf7f4ab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b3402fe65142f5c2700ea5bcdec56ded001b44c5341ef72d6caf6a2f287ed6deca1bd2415d8dca953f777bc061181f3bb6f7afafdcf1bfe93c45a3109f57bc4
|
7
|
+
data.tar.gz: 0fe53ec630e0a1dec9763b59b1aebb0cf6c9941c79b6f1824a75eb5364b3bc2e2b5ce3cacecf2c749a0d7edf17f953570ef185413f55a26f7fa2b85004a2c093
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-08-06 21:26:49 +0900 using RuboCop version 0.24.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 2
|
9
|
+
Lint/AmbiguousOperator:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 87
|
13
|
+
Lint/AmbiguousRegexpLiteral:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
# Offense count: 9
|
17
|
+
# Configuration parameters: AllowSafeAssignment.
|
18
|
+
Lint/AssignmentInCondition:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
# Offense count: 1
|
22
|
+
Lint/Debugger:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
# Offense count: 3
|
26
|
+
Lint/UnderscorePrefixedVariableName:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Offense count: 6
|
30
|
+
# Cop supports --auto-correct.
|
31
|
+
Lint/UnusedMethodArgument:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# Offense count: 6
|
35
|
+
Style/AccessorMethodName:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
# Offense count: 3
|
39
|
+
Style/AsciiComments:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
# Offense count: 1
|
43
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
44
|
+
Style/ClassAndModuleChildren:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
# Offense count: 5
|
48
|
+
# Configuration parameters: CountComments.
|
49
|
+
Style/ClassLength:
|
50
|
+
Max: 201
|
51
|
+
|
52
|
+
# Offense count: 2
|
53
|
+
Style/CyclomaticComplexity:
|
54
|
+
Max: 7
|
55
|
+
|
56
|
+
# Offense count: 87
|
57
|
+
Style/Documentation:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
# Offense count: 2
|
61
|
+
Style/DoubleNegation:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
# Offense count: 11
|
65
|
+
# Configuration parameters: MinBodyLength.
|
66
|
+
Style/GuardClause:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
# Offense count: 1
|
70
|
+
# Configuration parameters: MaxLineLength.
|
71
|
+
Style/IfUnlessModifier:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
# Offense count: 31
|
75
|
+
# Configuration parameters: AllowURI.
|
76
|
+
Style/LineLength:
|
77
|
+
Max: 123
|
78
|
+
|
79
|
+
# Offense count: 22
|
80
|
+
# Configuration parameters: CountComments.
|
81
|
+
Style/MethodLength:
|
82
|
+
Max: 34
|
83
|
+
|
84
|
+
# Offense count: 2
|
85
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
86
|
+
Style/MethodName:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
# Offense count: 22
|
90
|
+
# Configuration parameters: NamePrefixBlacklist.
|
91
|
+
Style/PredicateName:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
# Offense count: 2
|
95
|
+
# Configuration parameters: Methods.
|
96
|
+
Style/SingleLineBlockParams:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
# Offense count: 45
|
100
|
+
# Cop supports --auto-correct.
|
101
|
+
Style/SingleSpaceBeforeFirstArg:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
# Offense count: 1
|
105
|
+
# Cop supports --auto-correct.
|
106
|
+
Style/SpecialGlobalVars:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
# Offense count: 9
|
110
|
+
# Cop supports --auto-correct.
|
111
|
+
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
|
112
|
+
Style/TrivialAccessors:
|
113
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in inch.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
6
|
+
group :test do
|
7
|
+
gem "simplecov", require: false
|
8
|
+
gem "rubocop", require: false
|
9
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Inch [](https://travis-ci.org/rrrene/inch) [](https://codeclimate.com/github/rrrene/inch) [](https://travis-ci.org/rrrene/inch) [](https://codeclimate.com/github/rrrene/inch) [](http://inch-ci.org/github/rrrene/inch)
|
2
2
|
|
3
3
|
`inch` gives you hints where to improve your docs. One Inch at a time.
|
4
4
|
|
@@ -18,7 +18,7 @@ If there are no inline-docs yet, `inch` can tell you where to start.
|
|
18
18
|
|
19
19
|
Add this line to your application's Gemfile:
|
20
20
|
|
21
|
-
gem 'inch'
|
21
|
+
gem 'inch', require: false
|
22
22
|
|
23
23
|
And then execute:
|
24
24
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rake/testtask"
|
4
4
|
|
5
5
|
Rake::TestTask.new do |t|
|
6
6
|
t.pattern = "test/**/*_test.rb"
|
@@ -14,4 +14,4 @@ Rake::TestTask.new(:"test:integration") do |t|
|
|
14
14
|
t.pattern = "test/integration/**/*_test.rb"
|
15
15
|
end
|
16
16
|
|
17
|
-
task :
|
17
|
+
task default: :test
|
data/bin/inch
CHANGED
@@ -12,11 +12,12 @@ def find_lib_path
|
|
12
12
|
while File.symlink?(path)
|
13
13
|
path = File.expand_path(File.readlink(path), File.dirname(path))
|
14
14
|
end
|
15
|
-
File.join(File.dirname(File.expand_path(path)),
|
15
|
+
File.join(File.dirname(File.expand_path(path)), "..", "lib")
|
16
16
|
end
|
17
17
|
|
18
18
|
$LOAD_PATH.unshift(find_lib_path)
|
19
19
|
|
20
|
-
require
|
20
|
+
require "inch"
|
21
|
+
require "inch/cli"
|
21
22
|
|
22
23
|
Inch::CLI::CommandParser.run(*ARGV)
|
data/config/defaults.rb
CHANGED
data/inch.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "inch/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "inch"
|
8
8
|
spec.version = Inch::VERSION
|
9
9
|
spec.authors = ["René Föhring"]
|
10
10
|
spec.email = ["rf@bamaru.de"]
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = "Documentation measurement tool for Ruby"
|
12
|
+
spec.description = "Documentation measurement tool for Ruby, based on YARD."
|
13
13
|
spec.homepage = "http://trivelop.de/inch/"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(
|
18
|
-
spec.test_files = spec.files.grep(
|
17
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.5"
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "minitest", "~> 5.2"
|
24
24
|
|
25
25
|
spec.add_dependency "pry"
|
26
|
-
spec.add_dependency
|
26
|
+
spec.add_dependency "sparkr", ">= 0.2.0"
|
27
27
|
spec.add_dependency "term-ansicolor"
|
28
28
|
spec.add_dependency "yard", "~> 0.8.7"
|
29
29
|
end
|
data/lib/inch.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require "inch/version"
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
end
|
5
5
|
|
6
|
-
require
|
6
|
+
require "forwardable"
|
7
7
|
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require 'inch/cli'
|
8
|
+
require "inch/api"
|
9
|
+
require "inch/core_ext"
|
10
|
+
require "inch/codebase"
|
11
|
+
require "inch/code_object"
|
12
|
+
require "inch/evaluation"
|
14
13
|
|
15
|
-
require
|
16
|
-
require File.join(File.dirname(__FILE__),
|
14
|
+
require "inch/config"
|
15
|
+
require File.join(File.dirname(__FILE__), "..", "config", "defaults.rb")
|
data/lib/inch/api.rb
CHANGED
@@ -23,14 +23,14 @@ module Inch
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
26
|
+
require "inch/api/options/base"
|
27
|
+
require "inch/api/options/filter"
|
28
|
+
require "inch/api/options/suggest"
|
29
29
|
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
30
|
+
require "inch/api/compare"
|
31
|
+
require "inch/api/filter"
|
32
|
+
require "inch/api/get"
|
33
|
+
require "inch/api/list"
|
34
|
+
require "inch/api/suggest"
|
35
|
+
require "inch/api/stats"
|
36
|
+
require "inch/api/diff"
|
data/lib/inch/api/compare.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "inch/api/compare/code_objects"
|
2
|
+
require "inch/api/compare/codebases"
|
@@ -3,11 +3,11 @@ module Inch
|
|
3
3
|
module Compare
|
4
4
|
class CodeObjects
|
5
5
|
attr_reader :before, :after
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(object1, object2)
|
8
8
|
@before, @after = object1, object2
|
9
9
|
if @before.object_id == @after.object_id
|
10
|
-
|
10
|
+
fail "@before and @after are identical ruby objects. this is bad."
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -23,7 +23,6 @@ module Inch
|
|
23
23
|
@after.grade
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
26
|
def added?
|
28
27
|
@before.nil? && !@after.nil?
|
29
28
|
end
|
data/lib/inch/api/diff.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "inch/utils/shell_helper"
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module API
|
@@ -20,10 +20,10 @@ module Inch
|
|
20
20
|
@work_dir = dir
|
21
21
|
@codebase_old = codebase_for(before_rev)
|
22
22
|
@codebase_new = if after_rev.nil?
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
Codebase.parse(work_dir)
|
24
|
+
else
|
25
|
+
codebase_for(after_rev)
|
26
|
+
end
|
27
27
|
@comparer = API::Compare::Codebases.new(@codebase_old, @codebase_new)
|
28
28
|
end
|
29
29
|
|
@@ -42,9 +42,7 @@ module Inch
|
|
42
42
|
|
43
43
|
def codebase_from_cache(revision)
|
44
44
|
filename = Codebase::Serializer.filename(revision)
|
45
|
-
if File.exist?(filename)
|
46
|
-
Codebase::Serializer.load(filename)
|
47
|
-
end
|
45
|
+
Codebase::Serializer.load(filename) if File.exist?(filename)
|
48
46
|
end
|
49
47
|
|
50
48
|
def codebase_from_copy(original_dir, revision)
|
@@ -65,7 +63,6 @@ module Inch
|
|
65
63
|
def git_reset(dir, revision = nil)
|
66
64
|
git dir, "reset --hard #{revision}"
|
67
65
|
end
|
68
|
-
|
69
66
|
end
|
70
67
|
end
|
71
68
|
end
|
@@ -33,10 +33,10 @@ module Inch
|
|
33
33
|
|
34
34
|
def read(options_or_hash, name)
|
35
35
|
value = if options_or_hash.is_a?(Hash)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
options_or_hash[name]
|
37
|
+
else
|
38
|
+
options_or_hash.send(name)
|
39
|
+
end
|
40
40
|
instance_variable_set("@#{name}", value)
|
41
41
|
end
|
42
42
|
end
|
data/lib/inch/api/stats.rb
CHANGED
data/lib/inch/api/suggest.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "inch/utils/weighted_list"
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module API
|
@@ -19,7 +19,6 @@ module Inch
|
|
19
19
|
filter_objects_to_display
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
22
|
# @return [Array] all the objects that match +@options+
|
24
23
|
def all_objects
|
25
24
|
relevant_objects
|
@@ -52,15 +51,13 @@ module Inch
|
|
52
51
|
|
53
52
|
list = Codebase::Objects.sort_by_priority(weighted_list.to_a.flatten)
|
54
53
|
|
55
|
-
if list.size > object_count
|
56
|
-
list = list[0...object_count]
|
57
|
-
end
|
54
|
+
list = list[0...object_count] if list.size > object_count
|
58
55
|
list
|
59
56
|
end
|
60
57
|
|
61
58
|
def files_sorted_by_importance
|
62
59
|
list = all_filenames(relevant_objects).uniq.map do |filename|
|
63
|
-
|
60
|
+
Evaluation::File.for(filename, relevant_objects)
|
64
61
|
end
|
65
62
|
|
66
63
|
priority_list = list.select do |f|
|
@@ -68,7 +65,8 @@ module Inch
|
|
68
65
|
relevant_priorities.include?(f.priority)
|
69
66
|
end
|
70
67
|
|
71
|
-
Codebase::Objects.sort_by_priority(
|
68
|
+
Codebase::Objects.sort_by_priority(
|
69
|
+
priority_list.empty? ? list : priority_list)
|
72
70
|
end
|
73
71
|
|
74
72
|
def all_filenames(objects)
|
@@ -87,7 +85,7 @@ module Inch
|
|
87
85
|
end
|
88
86
|
|
89
87
|
def grade_list(grade_symbol)
|
90
|
-
grade_lists.
|
88
|
+
grade_lists.find { |r| r.grade.to_sym == grade_symbol }
|
91
89
|
end
|
92
90
|
|
93
91
|
def select_by_priority(list, min_priority)
|
@@ -99,7 +97,8 @@ module Inch
|
|
99
97
|
end
|
100
98
|
|
101
99
|
def relevant_objects
|
102
|
-
@relevant_objects ||= select_by_priority(codebase.objects,
|
100
|
+
@relevant_objects ||= select_by_priority(codebase.objects,
|
101
|
+
@options.object_min_priority)
|
103
102
|
end
|
104
103
|
|
105
104
|
def relevant_priorities
|