ruby-lint 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,240 @@
1
+ # This file was automatically generated, any manual changes will be lost the
2
+ # next time this file is generated.
3
+ #
4
+ # Platform: ruby 1.9.3
5
+
6
+ RubyLint.registry.register('Tree') do |defs|
7
+ defs.define_constant('Tree') do |klass|
8
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
9
+
10
+ end
11
+
12
+ defs.define_constant('Tree::TreeNode') do |klass|
13
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
14
+ klass.inherits(defs.constant_proxy('Tree::Utils::TreeMergeHandler', RubyLint.registry))
15
+ klass.inherits(defs.constant_proxy('Tree::Utils::JSONConverter', RubyLint.registry))
16
+ klass.inherits(defs.constant_proxy('Tree::Utils::CamelCaseMethodHandler', RubyLint.registry))
17
+ klass.inherits(defs.constant_proxy('Tree::Utils::TreeMetricsHandler', RubyLint.registry))
18
+ klass.inherits(defs.constant_proxy('Comparable', RubyLint.registry))
19
+ klass.inherits(defs.constant_proxy('Enumerable', RubyLint.registry))
20
+
21
+ klass.define_instance_method('<<') do |method|
22
+ method.define_argument('child')
23
+ end
24
+
25
+ klass.define_instance_method('<=>') do |method|
26
+ method.define_argument('other')
27
+ end
28
+
29
+ klass.define_instance_method('[]') do |method|
30
+ method.define_argument('name_or_index')
31
+ method.define_optional_argument('num_as_name')
32
+ end
33
+
34
+ klass.define_instance_method('add') do |method|
35
+ method.define_argument('child')
36
+ method.define_optional_argument('at_index')
37
+ end
38
+
39
+ klass.define_instance_method('breadth_each') do |method|
40
+ method.define_block_argument('block')
41
+ end
42
+
43
+ klass.define_instance_method('children')
44
+
45
+ klass.define_instance_method('content')
46
+
47
+ klass.define_instance_method('content=') do |method|
48
+ method.define_argument('arg1')
49
+ end
50
+
51
+ klass.define_instance_method('create_dump_rep')
52
+
53
+ klass.define_instance_method('detached_copy')
54
+
55
+ klass.define_instance_method('detached_subtree_copy')
56
+
57
+ klass.define_instance_method('dup')
58
+
59
+ klass.define_instance_method('each') do |method|
60
+ method.define_block_argument('block')
61
+ end
62
+
63
+ klass.define_instance_method('each_leaf') do |method|
64
+ method.define_block_argument('block')
65
+ end
66
+
67
+ klass.define_instance_method('first_child')
68
+
69
+ klass.define_instance_method('first_sibling')
70
+
71
+ klass.define_instance_method('freeze_tree!')
72
+
73
+ klass.define_instance_method('has_children?')
74
+
75
+ klass.define_instance_method('has_content?')
76
+
77
+ klass.define_instance_method('initialize') do |method|
78
+ method.define_argument('name')
79
+ method.define_optional_argument('content')
80
+
81
+ method.returns { |object| object.instance }
82
+ end
83
+
84
+ klass.define_instance_method('is_first_sibling?')
85
+
86
+ klass.define_instance_method('is_last_sibling?')
87
+
88
+ klass.define_instance_method('is_leaf?')
89
+
90
+ klass.define_instance_method('is_only_child?')
91
+
92
+ klass.define_instance_method('is_root?')
93
+
94
+ klass.define_instance_method('last_child')
95
+
96
+ klass.define_instance_method('last_sibling')
97
+
98
+ klass.define_instance_method('marshal_dump')
99
+
100
+ klass.define_instance_method('marshal_load') do |method|
101
+ method.define_argument('dumped_tree_array')
102
+ end
103
+
104
+ klass.define_instance_method('name')
105
+
106
+ klass.define_instance_method('next_sibling')
107
+
108
+ klass.define_instance_method('parent')
109
+
110
+ klass.define_instance_method('parent=') do |method|
111
+ method.define_argument('parent')
112
+ end
113
+
114
+ klass.define_instance_method('parentage')
115
+
116
+ klass.define_instance_method('postordered_each') do |method|
117
+ method.define_block_argument('block')
118
+ end
119
+
120
+ klass.define_instance_method('preordered_each') do |method|
121
+ method.define_block_argument('block')
122
+ end
123
+
124
+ klass.define_instance_method('previous_sibling')
125
+
126
+ klass.define_instance_method('print_tree') do |method|
127
+ method.define_optional_argument('level')
128
+ end
129
+
130
+ klass.define_instance_method('remove!') do |method|
131
+ method.define_argument('child')
132
+ end
133
+
134
+ klass.define_instance_method('remove_all!')
135
+
136
+ klass.define_instance_method('remove_from_parent!')
137
+
138
+ klass.define_instance_method('root')
139
+
140
+ klass.define_instance_method('set_as_root!')
141
+
142
+ klass.define_instance_method('siblings')
143
+
144
+ klass.define_instance_method('to_s')
145
+ end
146
+
147
+ defs.define_constant('Tree::TreeNode::ClassMethods') do |klass|
148
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
149
+
150
+ klass.define_instance_method('json_create') do |method|
151
+ method.define_argument('json_hash')
152
+ end
153
+ end
154
+
155
+ defs.define_constant('Tree::Utils') do |klass|
156
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
157
+
158
+ end
159
+
160
+ defs.define_constant('Tree::Utils::CamelCaseMethodHandler') do |klass|
161
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
162
+
163
+ klass.define_method('included') do |method|
164
+ method.define_argument('base')
165
+ end
166
+
167
+ klass.define_instance_method('method_missing') do |method|
168
+ method.define_argument('meth')
169
+ method.define_rest_argument('args')
170
+ method.define_block_argument('blk')
171
+ end
172
+ end
173
+
174
+ defs.define_constant('Tree::Utils::JSONConverter') do |klass|
175
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
176
+
177
+ klass.define_method('included') do |method|
178
+ method.define_argument('base')
179
+ end
180
+
181
+ klass.define_instance_method('as_json') do |method|
182
+ method.define_optional_argument('options')
183
+ end
184
+
185
+ klass.define_instance_method('to_json') do |method|
186
+ method.define_rest_argument('a')
187
+ end
188
+ end
189
+
190
+ defs.define_constant('Tree::Utils::JSONConverter::ClassMethods') do |klass|
191
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
192
+
193
+ klass.define_instance_method('json_create') do |method|
194
+ method.define_argument('json_hash')
195
+ end
196
+ end
197
+
198
+ defs.define_constant('Tree::Utils::TreeMergeHandler') do |klass|
199
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
200
+
201
+ klass.define_instance_method('merge') do |method|
202
+ method.define_argument('other_tree')
203
+ end
204
+
205
+ klass.define_instance_method('merge!') do |method|
206
+ method.define_argument('other_tree')
207
+ end
208
+ end
209
+
210
+ defs.define_constant('Tree::Utils::TreeMetricsHandler') do |klass|
211
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
212
+
213
+ klass.define_method('included') do |method|
214
+ method.define_argument('base')
215
+ end
216
+
217
+ klass.define_instance_method('breadth')
218
+
219
+ klass.define_instance_method('depth')
220
+
221
+ klass.define_instance_method('in_degree')
222
+
223
+ klass.define_instance_method('length')
224
+
225
+ klass.define_instance_method('level')
226
+
227
+ klass.define_instance_method('node_depth')
228
+
229
+ klass.define_instance_method('node_height')
230
+
231
+ klass.define_instance_method('out_degree')
232
+
233
+ klass.define_instance_method('size')
234
+ end
235
+
236
+ defs.define_constant('Tree::VERSION') do |klass|
237
+ klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
238
+
239
+ end
240
+ end
@@ -60,8 +60,6 @@ module RubyLint
60
60
  # @return [Array]
61
61
  #
62
62
  def scan(constant)
63
- @glob_cache ||= directories.empty? ? [] : glob_ruby_files
64
-
65
63
  unless constant_paths_cached?(constant)
66
64
  build_constant_paths_cache(constant)
67
65
  end
@@ -69,6 +67,13 @@ module RubyLint
69
67
  return @constant_paths_cache[constant]
70
68
  end
71
69
 
70
+ ##
71
+ # @return [Array]
72
+ #
73
+ def glob_cache
74
+ @glob_cache ||= directories.empty? ? [] : glob_ruby_files
75
+ end
76
+
72
77
  ##
73
78
  # @return [Array]
74
79
  #
@@ -76,7 +81,45 @@ module RubyLint
76
81
  return Dir.glob("{#{directories.join(',')}}/**/*.rb")
77
82
  end
78
83
 
79
- private
84
+ ##
85
+ # Returns the file path for the given constant.
86
+ #
87
+ # @example
88
+ # constant_to_path('FooBar::Baz') # => "foo_bar/baz.rb"
89
+ #
90
+ # @param [String] constant
91
+ # @return [String]
92
+ #
93
+ def constant_to_path(constant)
94
+ return constant.gsub('::', '/').snake_case + '.rb'
95
+ end
96
+
97
+ ##
98
+ # Returns a path similar to {#constant_to_path} but using dashes instead of
99
+ # underscores for the first directory.
100
+ #
101
+ # @example
102
+ # constant_to_dashed_path('FooBar::Baz') # => "foo-bar/baz.rb"
103
+ #
104
+ # @see [#constant_to_path]
105
+ #
106
+ def constant_to_dashed_path(constant)
107
+ const_segments = constant.split('::')
108
+ path_segments = []
109
+
110
+ const_segments.each_with_index do |segment, index|
111
+ segment = segment.snake_case
112
+
113
+ # Use dashes for the first segment (= top level directory).
114
+ if const_segments.length > 1 and index == 0
115
+ segment = segment.gsub('_', '-')
116
+ end
117
+
118
+ path_segments << segment
119
+ end
120
+
121
+ return path_segments.join('/') + '.rb'
122
+ end
80
123
 
81
124
  ##
82
125
  # Searches all the files that could potentially define the given constant
@@ -119,7 +162,7 @@ module RubyLint
119
162
  # "bar_foo.rb"). We don't want that.
120
163
  segment = "/#{segment}"
121
164
 
122
- return @glob_cache.select { |p| p.include?(segment) }
165
+ return glob_cache.select { |p| p.include?(segment) }
123
166
  end
124
167
 
125
168
  ##
@@ -128,36 +171,5 @@ module RubyLint
128
171
  def constant_paths_cached?(constant)
129
172
  return @constant_paths_cache.key?(constant)
130
173
  end
131
-
132
- ##
133
- # @param [String] constant
134
- # @return [String]
135
- #
136
- def constant_to_path(constant)
137
- return constant.gsub('::', '/').snake_case + '.rb'
138
- end
139
-
140
- ##
141
- # @see #constant_to_path
142
- #
143
- def constant_to_dashed_path(constant)
144
- segments = constant.split('::')
145
- last = segments[-1]
146
- prefix = segments[0..-2].join('/').snake_case.gsub('_', '-')
147
-
148
- unless prefix.empty?
149
- prefix += '/'
150
- end
151
-
152
- return "#{prefix}#{last.snake_case}.rb"
153
- end
154
-
155
- ##
156
- # @param [String] segment
157
- # @return [String]
158
- #
159
- def glob_pattern(segment)
160
- return "{#{directories.join(',')}}/**/#{segment}.rb"
161
- end
162
174
  end # FileScanner
163
175
  end # RubyLint
@@ -38,7 +38,7 @@ module RubyLint
38
38
  #
39
39
  def inspect_constants(source = constant, ignore = [])
40
40
  names = []
41
- source_name = source.to_s
41
+ source_name = source.name
42
42
  have_children = []
43
43
  include_source = source != Object
44
44
 
@@ -1,3 +1,3 @@
1
1
  module RubyLint
2
- VERSION = '2.0.2'
2
+ VERSION = '2.0.3'
3
3
  end # RubyLint
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-05 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -173,6 +173,7 @@ files:
173
173
  - checksum/ruby-lint-1.1.0.gem.sha512
174
174
  - checksum/ruby-lint-2.0.0.gem.sha512
175
175
  - checksum/ruby-lint-2.0.1.gem.sha512
176
+ - checksum/ruby-lint-2.0.2.gem.sha512
176
177
  - doc/DCO.md
177
178
  - doc/architecture.md
178
179
  - doc/changelog.md
@@ -185,6 +186,7 @@ files:
185
186
  - lib/ruby-lint.rb
186
187
  - lib/ruby-lint/analysis/argument_amount.rb
187
188
  - lib/ruby-lint/analysis/base.rb
189
+ - lib/ruby-lint/analysis/loop_keywords.rb
188
190
  - lib/ruby-lint/analysis/pedantics.rb
189
191
  - lib/ruby-lint/analysis/shadowing_variables.rb
190
192
  - lib/ruby-lint/analysis/undefined_methods.rb
@@ -410,14 +412,22 @@ files:
410
412
  - lib/ruby-lint/definitions/core/vector.rb
411
413
  - lib/ruby-lint/definitions/core/weak_ref.rb
412
414
  - lib/ruby-lint/definitions/core/webrick.rb
415
+ - lib/ruby-lint/definitions/core/win32ole.rb
413
416
  - lib/ruby-lint/definitions/core/xmlrpc.rb
414
417
  - lib/ruby-lint/definitions/core/yaml.rb
415
418
  - lib/ruby-lint/definitions/core/zero_division_error.rb
416
419
  - lib/ruby-lint/definitions/core/zlib.rb
420
+ - lib/ruby-lint/definitions/gems/alm.rb
417
421
  - lib/ruby-lint/definitions/gems/celluloid.rb
418
422
  - lib/ruby-lint/definitions/gems/devise.rb
423
+ - lib/ruby-lint/definitions/gems/glib.rb
424
+ - lib/ruby-lint/definitions/gems/gtk.rb
425
+ - lib/ruby-lint/definitions/gems/lib_xml.rb
419
426
  - lib/ruby-lint/definitions/gems/minitest.rb
427
+ - lib/ruby-lint/definitions/gems/mongoid.rb
420
428
  - lib/ruby-lint/definitions/gems/nokogiri.rb
429
+ - lib/ruby-lint/definitions/gems/sinatra.rb
430
+ - lib/ruby-lint/definitions/gems/tree.rb
421
431
  - lib/ruby-lint/definitions/rails/abstract_controller.rb
422
432
  - lib/ruby-lint/definitions/rails/action_controller.rb
423
433
  - lib/ruby-lint/definitions/rails/action_dispatch.rb
@@ -486,7 +496,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
486
496
  version: '0'
487
497
  requirements: []
488
498
  rubyforge_project:
489
- rubygems_version: 2.4.1
499
+ rubygems_version: 2.4.4
490
500
  signing_key:
491
501
  specification_version: 4
492
502
  summary: A linter and static code analysis tool for Ruby.