sandi_meter 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/html/script.js +1 -1
- data/lib/sandi_meter/calculator.rb +2 -2
- data/lib/sandi_meter/version.rb +1 -1
- data/spec/calculator_spec.rb +29 -0
- data/spec/test_classes/15.rb +111 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzVlYjg2ZmU3ZDdjMjhhMjQ2ZDZjZjZiMGM0ZTIwNGNlZDBlZWY1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGFjMmE3NzUyNWIxZjA1NTMxZDIwNmMxOGMwMzljZjc1NWFlNWE2YQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmNjNzA0OWRmODU4OTJkNDMwZGYyZjI4ZTNiMTI4ZTA4MjI2MzU5MjQxYzhl
|
10
|
+
NTE0MGIyZThjMzlhNTkxODFhYWU5Zjk3ZDg3ZjJiNGJlNzA1M2ZjYmQ4NDM3
|
11
|
+
OTU1ODZiMGE4MmNkNjgyNWQyNDRjYzczZTNhNGI5ZjBjNTUwNGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDRjOWQ5ZTQ2ODA2Njc3OGQwZjllZDdjMzkyNzQ2NGM0NzM2MTdlNWYyMDQ4
|
14
|
+
YWRjNmM2ODAwYzJjM2I4Y2JmNDViODA1MGU5ODNkYmM2NWI4NTI5YmY0ZmMz
|
15
|
+
YWFlOWZmN2U3YmQ4YjNkZTM0MzlhOWNlODBlNzA5NzZlNGU4MzA=
|
data/html/script.js
CHANGED
@@ -35,7 +35,7 @@ module SandiMeter
|
|
35
35
|
# TODO
|
36
36
|
# wrap each class params into class and get params with
|
37
37
|
# verbose name instead of array keys (class_params[2] should be klass.line_count)
|
38
|
-
log << [class_params.first, class_params[2], class_params.last] if class_params[-2] == false
|
38
|
+
log << [class_params.first, class_params[2] - class_params[1] - 1, class_params.last] if class_params[-2] == false
|
39
39
|
log
|
40
40
|
end
|
41
41
|
|
@@ -56,7 +56,7 @@ module SandiMeter
|
|
56
56
|
# TODO
|
57
57
|
# wrap method param to method class so method_params[1] becomes method.first_line
|
58
58
|
# and method_params[2] method.last_line
|
59
|
-
params << method_params[2] - method_params[1]
|
59
|
+
params << method_params[2] - method_params[1] - 1
|
60
60
|
params << method_params.last
|
61
61
|
|
62
62
|
@output[:second_rule][:log][:methods] << params
|
data/lib/sandi_meter/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require_relative '../lib/sandi_meter/calculator'
|
3
|
+
require_relative '../lib/sandi_meter/analyzer'
|
4
|
+
|
5
|
+
describe SandiMeter::Calculator do
|
6
|
+
let(:analyzer) { SandiMeter::Analyzer.new }
|
7
|
+
let(:calculator) { SandiMeter::Calculator.new }
|
8
|
+
|
9
|
+
describe 'line number in details' do
|
10
|
+
let(:test_class) { test_file_path(15) }
|
11
|
+
|
12
|
+
before do
|
13
|
+
data = analyzer.analyze(test_class)
|
14
|
+
calculator.push(data)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'counts class lines' do
|
18
|
+
output = calculator.calculate!(true)
|
19
|
+
class_params = output[:first_rule][:log][:classes].find { |params| params.first == "User" }
|
20
|
+
class_params[1].should eq(109)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'counts method lines' do
|
24
|
+
output = calculator.calculate!(true)
|
25
|
+
method_params = output[:second_rule][:log][:methods].find { |params| params.first == "User" && params[1] == "create" }
|
26
|
+
method_params[2].should eq(6)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
class User
|
2
|
+
def create
|
3
|
+
@category = Admin::Category.new(admin_category_params)
|
4
|
+
if @category.save
|
5
|
+
redirect_to @category, notice: 'Category was successfully created.'
|
6
|
+
else
|
7
|
+
render :form
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandi_meter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoli Makarevich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/sandi_meter/warning_scanner.rb
|
87
87
|
- bin/sandi_meter
|
88
88
|
- spec/analyzer_spec.rb
|
89
|
+
- spec/calculator_spec.rb
|
89
90
|
- spec/loc_checker_spec.rb
|
90
91
|
- spec/method_arguments_counter_spec.rb
|
91
92
|
- spec/test_classes/1.rb
|
@@ -96,6 +97,7 @@ files:
|
|
96
97
|
- spec/test_classes/13.rb
|
97
98
|
- spec/test_classes/14.rb
|
98
99
|
- spec/test_classes/14_controller.rb
|
100
|
+
- spec/test_classes/15.rb
|
99
101
|
- spec/test_classes/15_controller.rb
|
100
102
|
- spec/test_classes/2.rb
|
101
103
|
- spec/test_classes/3.rb
|