flog 2.1.2 → 2.2.0

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.
Files changed (6) hide show
  1. data/History.txt +14 -0
  2. data/bin/flog +1 -1
  3. data/lib/flog.rb +6 -11
  4. metadata +5 -26
  5. data.tar.gz.sig +0 -2
  6. metadata.gz.sig +0 -3
data/History.txt CHANGED
@@ -1,3 +1,17 @@
1
+ === 2.2.0 / 2009-08-14
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * #mass pushed up to sexp_processor
6
+
7
+ * 5 bug fixes:
8
+
9
+ * --group didn't use canonical class name.
10
+ * Fixed bin/flog to use flog, not flog_files (removed in last rev)
11
+ * Fixed crasher when processing a block with empty goalposts.
12
+ * Switching to ruby_parser broke ERB syntax error handling. (imccoy)
13
+ * skip empty files instead of crashing. yay?
14
+
1
15
  === 2.1.2 / 2009-06-24
2
16
 
3
17
  * 1 bug fix:
data/bin/flog CHANGED
@@ -8,7 +8,7 @@ options = Flog.parse_options
8
8
  ARGV << "-" if ARGV.empty?
9
9
 
10
10
  flogger = Flog.new options
11
- flogger.flog_files ARGV
11
+ flogger.flog ARGV
12
12
  flogger.report
13
13
 
14
14
  exit 0
data/lib/flog.rb CHANGED
@@ -3,15 +3,8 @@ require 'sexp_processor'
3
3
  require 'ruby_parser'
4
4
  require 'optparse'
5
5
 
6
- # REFACTOR: push up to sexp_processor. also in flay
7
- class Sexp
8
- def mass
9
- @mass ||= self.structure.flatten.size
10
- end
11
- end
12
-
13
6
  class Flog < SexpProcessor
14
- VERSION = '2.1.2'
7
+ VERSION = '2.2.0'
15
8
 
16
9
  THRESHOLD = 0.60
17
10
  SCORES = Hash.new 1
@@ -181,10 +174,11 @@ class Flog < SexpProcessor
181
174
  warn "** flogging #{file}" if options[:verbose]
182
175
 
183
176
  ast = @parser.process(ruby, file)
177
+ next unless ast
184
178
  mass[file] = ast.mass
185
179
  process ast
186
180
  rescue SyntaxError, Racc::ParseError => e
187
- if e.inspect =~ /<%|%>/ then
181
+ if e.inspect =~ /<%|%>/ or ruby =~ /<%|%>/ then
188
182
  warn "#{e.inspect} at #{e.backtrace.first(5).join(', ')}"
189
183
  warn "\n...stupid lemmings and their bad erb templates... skipping"
190
184
  else
@@ -267,7 +261,7 @@ class Flog < SexpProcessor
267
261
  methods = Hash.new { |h,k| h[k] = [] }
268
262
 
269
263
  calls.sort_by { |k,v| -my_totals[k] }.each do |class_method, call_list|
270
- klass = class_method.split(/#|::/).first
264
+ klass = class_method.split(/#/).first
271
265
  score = totals[class_method]
272
266
  methods[klass] << [class_method, score]
273
267
  scores[klass] += score
@@ -546,7 +540,8 @@ class Flog < SexpProcessor
546
540
 
547
541
  add_to_score :branch
548
542
 
549
- exp.pop if exp.last == 0
543
+ exp.delete 0
544
+
550
545
  process exp.shift # no penalty for LHS
551
546
 
552
547
  penalize_by 0.1 do
metadata CHANGED
@@ -1,36 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flog
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
- ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
16
- AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
- JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
- b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
19
- taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
20
- oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
21
- GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
- qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
- gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
- AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
26
- vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
27
- w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
28
- l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
29
- n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
30
- FBHgymkyj/AOSqKRIpXPhjC6
31
- -----END CERTIFICATE-----
10
+ cert_chain: []
32
11
 
33
- date: 2009-06-24 00:00:00 -07:00
12
+ date: 2009-08-14 00:00:00 -07:00
34
13
  default_executable:
35
14
  dependencies:
36
15
  - !ruby/object:Gem::Dependency
@@ -61,7 +40,7 @@ dependencies:
61
40
  requirements:
62
41
  - - ">="
63
42
  - !ruby/object:Gem::Version
64
- version: 2.3.0
43
+ version: 2.3.3
65
44
  version:
66
45
  description: |-
67
46
  Flog reports the most tortured code in an easy to read pain
@@ -128,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
107
  requirements: []
129
108
 
130
109
  rubyforge_project: seattlerb
131
- rubygems_version: 1.3.4
110
+ rubygems_version: 1.3.5
132
111
  signing_key:
133
112
  specification_version: 3
134
113
  summary: Flog reports the most tortured code in an easy to read pain report
data.tar.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- �?�`�ɡ�b�kT�X8��v������Ί=\0K����kWnj���;���.��5�������b���dAŦ1
2
- ��Q�@�k�` z���D��j�Vfe� ^'�Xd��yl�$1"�����0,F���� �o"\����˗�ӜU�5
metadata.gz.sig DELETED
@@ -1,3 +0,0 @@
1
- 0|�Rn���9��3x���@��p�%R�
2
- ��u�^��R�6c���Ml��#�M�tF�:L�X�(�1������ow.G�!i
3
- �J%e3a8&�t