churn 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b9e47efbf25dd33432e6a632a22547482c1823786f9fcfe5cc0ddc8867a3d9f
4
- data.tar.gz: 7aa8ef62039ced894b3ca96934223fe7c231565c49c07a8fcc261896d6c1c28c
3
+ metadata.gz: 60626635b7c857bc6a5129f45d42aff3eba37caa4b478492316a2030a0bdebcc
4
+ data.tar.gz: 321cfa0f67c7c1a5b0e0ca2b6da68b925d5f598a73af631f13f293a454bcb48c
5
5
  SHA512:
6
- metadata.gz: fb77031df8cc5a6a864e9c13ffa30ed32282094f38ec126af32f026605a232e647557fd74d54bf03fcb18aaa580e77835889dfa5ef9487a2daefb17feee506ca
7
- data.tar.gz: c307331df0e19c3cb6031314ff154e5c1158c41021f0dd9ca4ce965bbe6a7c1840c80a29c4f9edc5945d0c986324085224e76cfb2dd97b0d7e67dbda6511b42a
6
+ metadata.gz: '0584e9330499a66eeabea707a4aa586ec891d6f5a71acd0d6017d5e745e50f4f9950b4feab97651599a7a279a6cfd8bad4ba1981c21bbc0ba5e564f8ad63ca6e'
7
+ data.tar.gz: 6a6a562a668f501d69a51f5bd35a59e6da48aee865431ce17b6ee934c1e2622fe84312e861b1c0d1d805172089398e16107c4201f0ba5227a64ff8d7aff04448
@@ -27,7 +27,19 @@ Gem::Specification.new do |s|
27
27
  s.add_runtime_dependency "ruby_parser", "~> 3.0"
28
28
  # TODO: Just have clean output and drop hirb
29
29
  s.add_runtime_dependency "hirb", ">= 0"
30
- # TODO: Make this an optional depency and eventually
31
- # replace dependency with straight net::http
32
- s.add_runtime_dependency "rest-client", ">= 1.6.0"
30
+
31
+ s.add_development_dependency 'pry-byebug'
32
+ s.add_development_dependency "minitest", "~> 5.3"
33
+ s.add_development_dependency "shoulda", ">= 0"
34
+ s.add_development_dependency "test_construct", "~> 2.0.0"
35
+ s.add_development_dependency "rake", ">= 0"
36
+ s.add_development_dependency "mocha", "~> 1.1.0"
37
+ s.add_development_dependency "simplecov", ">= 0"
38
+ s.add_development_dependency "yard", "~> 0.9.20"
39
+ # TODO: what is using this ronn
40
+ s.add_development_dependency "ronn"
41
+ #s.add_development_dependency "kramdown", platform: :jruby
42
+ s.add_development_dependency "redcarpet"
43
+ # TODO: what is using this? Tests I think, remove
44
+ s.add_development_dependency 'activesupport', '>= 4.0'
33
45
  end
@@ -4,8 +4,6 @@ require 'ruby_parser'
4
4
  require 'json'
5
5
  require 'hirb'
6
6
  require 'fileutils'
7
- require 'rest_client'
8
-
9
7
 
10
8
  require_relative 'scm/source_control'
11
9
  require_relative 'scm/git_analyzer'
@@ -54,21 +52,10 @@ module Churn
54
52
  else
55
53
  emit
56
54
  analyze
57
- remote_report
58
55
  print ? self.to_s : self.to_h
59
56
  end
60
57
  end
61
58
 
62
- def remote_report
63
- if @churn_options.report_host
64
- puts "posting churn results to #{@churn_options.report_host}"
65
- data = {:name => @churn_options.name, :revision => @revisions.first, :data => self.to_h}.to_json
66
- RestClient.post @churn_options.report_host, {"results" => data}, :content_type => :json, :accept => :json
67
- end
68
- rescue Errno::ECONNREFUSED
69
- puts "error posting churn results connection refused to host: #{@churn_options.report_host}"
70
- end
71
-
72
59
  # this method generates the past history of a churn project from first
73
60
  # commit to current running the report for oldest commits first so they
74
61
  # are built up correctly
@@ -284,7 +271,16 @@ module Churn
284
271
  end
285
272
 
286
273
  def reject_ignored_files(files)
287
- files.reject{ |file, _| @ignores.any?{ |ignore| /#{ignore}/ =~ file } }
274
+ files.reject do |file, _|
275
+ @ignores.any? do |ignore|
276
+ begin
277
+ /#{ignore}/ =~ file
278
+ rescue RegexpError => e
279
+ puts "churn: ignoring invalid regex: #{e}"
280
+ false
281
+ end
282
+ end
283
+ end
288
284
  end
289
285
 
290
286
  end
@@ -6,6 +6,7 @@ module Churn
6
6
  # this is based off https://github.com/seattlerb/ruby_parser which seems to have some known line number bugs
7
7
  # perhaps look at and move more to the style of line numbers from metric_fu
8
8
  # https://github.com/metricfu/metric_fu/blob/master/lib/data_structures/line_numbers.rb
9
+ # NOTE: showing more line number issues with Ruby 2.6
9
10
  class LocationMapping < SexpProcessor
10
11
 
11
12
  attr_reader :klasses_collection, :methods_collection
@@ -20,7 +21,7 @@ module Churn
20
21
  end
21
22
 
22
23
  def get_info(file)
23
- ast = @parser.process(File.read(file), file)
24
+ ast = @parser.process(File.read(file).chomp, file)
24
25
  process ast
25
26
  end
26
27
 
@@ -39,7 +40,7 @@ module Churn
39
40
 
40
41
  def deep_last_line(exp)
41
42
  lines = []
42
- exp.deep_each{|x| lines << x.line }
43
+ exp.deep_each{|x| lines << x.line; }
43
44
  lines.max + 1
44
45
  end
45
46
 
@@ -7,9 +7,8 @@ module Churn
7
7
  DEFAULT_CHURN_DIRECTORY = "tmp/churn"
8
8
  DEFAULT_MINIMUM_CHURN_COUNT = 5
9
9
  DEFAULT_START_TIME = '3 months ago'
10
- DEFAULT_REPORT_HOST = 'http://churn.picoappz.com'
11
10
 
12
- attr_accessor :data_directory, :minimum_churn_count, :ignores, :start_date, :history, :report_host, :name, :file_extension, :file_prefix
11
+ attr_accessor :data_directory, :minimum_churn_count, :ignores, :start_date, :history, :name, :file_extension, :file_prefix
13
12
 
14
13
  def initialize()
15
14
  @data_directory = DEFAULT_CHURN_DIRECTORY
@@ -17,7 +16,6 @@ module Churn
17
16
  @ignores = '/dev/null'
18
17
  @start_date = DEFAULT_START_TIME
19
18
  @history = nil
20
- @report_host = nil
21
19
  @name = nil
22
20
  @file_extension = nil
23
21
  @file_prefix = nil
@@ -35,17 +33,6 @@ module Churn
35
33
  if @history=='true'
36
34
  @history = DEFAULT_START_TIME
37
35
  end
38
- if !options[:report].nil? && options[:report]!=''
39
- @report_host = options[:report]
40
- if @report_host=='true'
41
- @report_host = DEFAULT_REPORT_HOST
42
- end
43
- end
44
-
45
- @name = options[:name] if !options[:name].nil? && options[:name]!=''
46
- if !@report_host.nil? && @name.nil?
47
- raise ArgumentError.new "If you are reporting churn results you must pass a valid github project name in the form of username/project_name"
48
- end
49
36
 
50
37
  self
51
38
  end
@@ -1,3 +1,3 @@
1
1
  module Churn
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: churn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-13 00:00:00.000000000 Z
11
+ date: 2020-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: main
@@ -81,19 +81,159 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rest-client
84
+ name: pry-byebug
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.6.0
90
- type: :runtime
89
+ version: '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'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '5.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '5.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: shoulda
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: test_construct
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 2.0.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.0.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: mocha
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.1.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.1.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 0.9.20
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 0.9.20
195
+ - !ruby/object:Gem::Dependency
196
+ name: ronn
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: redcarpet
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: activesupport
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '4.0'
230
+ type: :development
91
231
  prerelease: false
92
232
  version_requirements: !ruby/object:Gem::Requirement
93
233
  requirements:
94
234
  - - ">="
95
235
  - !ruby/object:Gem::Version
96
- version: 1.6.0
236
+ version: '4.0'
97
237
  description: 'High method and class churn has been shown to have increased bug and
98
238
  error rates. This gem helps you know what is changing a lot so you can do additional
99
239
  testing, code review, or refactoring to try to tame the volatile code. '