ruby-lint 0.9.1 → 1.0.0.pre.preview1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CONTRIBUTING.md +9 -11
  4. data/Gemfile +6 -3
  5. data/MANIFEST +7 -1
  6. data/README.md +15 -24
  7. data/benchmark/bootup.rb +13 -0
  8. data/checksum/ruby-lint-0.9.1.gem.sha512 +1 -0
  9. data/doc/code_analysis.md +20 -0
  10. data/doc/css/common.css +1 -0
  11. data/doc/images/flow.png +0 -0
  12. data/lib/ruby-lint.rb +1 -3
  13. data/lib/ruby-lint/analysis/base.rb +12 -2
  14. data/lib/ruby-lint/analysis/undefined_variables.rb +3 -2
  15. data/lib/ruby-lint/analysis/unused_variables.rb +3 -2
  16. data/lib/ruby-lint/ast/node.rb +1 -1
  17. data/lib/ruby-lint/benchmark/average.rb +115 -0
  18. data/lib/ruby-lint/cli/analyze.rb +19 -1
  19. data/lib/ruby-lint/constant_loader.rb +1 -3
  20. data/lib/ruby-lint/constant_path.rb +112 -0
  21. data/lib/ruby-lint/definition_builder/base.rb +0 -2
  22. data/lib/ruby-lint/definition_builder/ruby_module.rb +1 -1
  23. data/lib/ruby-lint/definitions/core/array.rb +304 -73
  24. data/lib/ruby-lint/definitions/core/fixnum.rb +575 -19
  25. data/lib/ruby-lint/definitions/core/float.rb +2650 -95
  26. data/lib/ruby-lint/definitions/core/hash.rb +926 -85
  27. data/lib/ruby-lint/definitions/core/ruby_copyright.rb +3 -1
  28. data/lib/ruby-lint/definitions/core/ruby_description.rb +3 -1
  29. data/lib/ruby-lint/definitions/core/ruby_engine.rb +3 -1
  30. data/lib/ruby-lint/definitions/core/ruby_patchlevel.rb +3 -1
  31. data/lib/ruby-lint/definitions/core/ruby_platform.rb +3 -1
  32. data/lib/ruby-lint/definitions/core/ruby_release_date.rb +3 -1
  33. data/lib/ruby-lint/definitions/core/ruby_version.rb +3 -1
  34. data/lib/ruby-lint/definitions/core/string.rb +847 -134
  35. data/lib/ruby-lint/definitions/core/string_io.rb +370 -25
  36. data/lib/ruby-lint/definitions/core/struct.rb +611 -146
  37. data/lib/ruby-lint/file_loader.rb +5 -6
  38. data/lib/ruby-lint/file_scanner.rb +44 -11
  39. data/lib/ruby-lint/inspector.rb +12 -2
  40. data/lib/ruby-lint/runner.rb +6 -2
  41. data/lib/ruby-lint/version.rb +1 -1
  42. data/lib/ruby-lint/virtual_machine.rb +19 -5
  43. data/ruby-lint.gemspec +1 -3
  44. data/spec/ruby-lint/analysis/argument_amount_spec.rb +5 -5
  45. data/spec/ruby-lint/analysis/base_spec.rb +4 -0
  46. data/spec/ruby-lint/analysis/shadowing_variables_spec.rb +4 -4
  47. data/spec/ruby-lint/analysis/undefined_methods_spec.rb +6 -6
  48. data/spec/ruby-lint/analysis/undefined_variables_spec.rb +5 -5
  49. data/spec/ruby-lint/analysis/unused_variables_spec.rb +12 -12
  50. data/spec/ruby-lint/cli/analyze_spec.rb +10 -0
  51. data/spec/ruby-lint/constant_path.rb +63 -0
  52. data/spec/ruby-lint/definition/ruby_object_spec.rb +2 -2
  53. data/spec/ruby-lint/report_spec.rb +2 -2
  54. data/spec/ruby-lint/runner_spec.rb +17 -0
  55. data/spec/ruby-lint/virtual_machine/assignments/assignment_arguments_spec.rb +14 -0
  56. data/spec/ruby-lint/virtual_machine/assignments/constants_spec.rb +23 -0
  57. data/spec/ruby-lint/virtual_machine/location_spec.rb +4 -4
  58. data/spec/ruby-lint/virtual_machine/method_call_tracking_spec.rb +4 -4
  59. data/task/build.rake +2 -7
  60. data/task/doc.rake +3 -1
  61. data/task/generate.rake +3 -0
  62. metadata +20 -36
  63. checksums.yaml.gz.asc +0 -17
  64. data.tar.gz.asc +0 -17
  65. data/lib/ruby-lint/helper/constant_paths.rb +0 -50
  66. metadata.gz.asc +0 -17
@@ -1,17 +1,18 @@
1
- ##
2
- # Constant: Hash
3
- # Created: 2013-04-01 18:33:54 +0200
4
- # Platform: rbx 2.0.0.rc1
1
+ # This file was automatically generated, any manual changes will be lost the
2
+ # next time this file is generated.
5
3
  #
4
+ # Created: 2013-11-11 20:14:14 +0100
5
+ # Platform: rbx 2.1.1
6
+
6
7
  RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
7
8
  klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
8
9
 
10
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Enumerable'))
11
+
9
12
  klass.define_method('[]') do |method|
10
13
  method.define_rest_argument('args')
11
14
  end
12
15
 
13
- klass.define_method('__class_init__')
14
-
15
16
  klass.define_method('allocate')
16
17
 
17
18
  klass.define_method('new_from_literal') do |method|
@@ -46,18 +47,38 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
46
47
  method.define_argument('value')
47
48
  end
48
49
 
50
+ klass.define_instance_method('all?')
51
+
52
+ klass.define_instance_method('any?')
53
+
49
54
  klass.define_instance_method('assoc') do |method|
50
55
  method.define_argument('key')
51
56
  end
52
57
 
53
58
  klass.define_instance_method('capacity')
54
59
 
60
+ klass.define_instance_method('chunk') do |method|
61
+ method.define_optional_argument('initial_state')
62
+ end
63
+
55
64
  klass.define_instance_method('clear')
56
65
 
66
+ klass.define_instance_method('collect')
67
+
68
+ klass.define_instance_method('collect_concat')
69
+
57
70
  klass.define_instance_method('compare_by_identity')
58
71
 
59
72
  klass.define_instance_method('compare_by_identity?')
60
73
 
74
+ klass.define_instance_method('count') do |method|
75
+ method.define_optional_argument('item')
76
+ end
77
+
78
+ klass.define_instance_method('cycle') do |method|
79
+ method.define_optional_argument('many')
80
+ end
81
+
61
82
  klass.define_instance_method('default') do |method|
62
83
  method.define_optional_argument('key')
63
84
  end
@@ -76,22 +97,54 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
76
97
  method.define_argument('key')
77
98
  end
78
99
 
79
- klass.define_instance_method('delete_if') do |method|
80
- method.define_block_argument('block')
100
+ klass.define_instance_method('delete_if')
101
+
102
+ klass.define_instance_method('detect') do |method|
103
+ method.define_optional_argument('ifnone')
104
+ end
105
+
106
+ klass.define_instance_method('drop') do |method|
107
+ method.define_argument('n')
81
108
  end
82
109
 
110
+ klass.define_instance_method('drop_while')
111
+
83
112
  klass.define_instance_method('each')
84
113
 
114
+ klass.define_instance_method('each_cons') do |method|
115
+ method.define_argument('num')
116
+ end
117
+
118
+ klass.define_instance_method('each_entry') do |method|
119
+ method.define_rest_argument('pass')
120
+ end
121
+
85
122
  klass.define_instance_method('each_item')
86
123
 
87
124
  klass.define_instance_method('each_key')
88
125
 
89
126
  klass.define_instance_method('each_pair')
90
127
 
128
+ klass.define_instance_method('each_slice') do |method|
129
+ method.define_argument('slice_size')
130
+ end
131
+
91
132
  klass.define_instance_method('each_value')
92
133
 
134
+ klass.define_instance_method('each_with_index') do |method|
135
+ method.define_rest_argument('args')
136
+ end
137
+
138
+ klass.define_instance_method('each_with_object') do |method|
139
+ method.define_argument('memo')
140
+ end
141
+
93
142
  klass.define_instance_method('empty?')
94
143
 
144
+ klass.define_instance_method('entries') do |method|
145
+ method.define_rest_argument('arg')
146
+ end
147
+
95
148
  klass.define_instance_method('eql?') do |method|
96
149
  method.define_argument('other')
97
150
  end
@@ -101,14 +154,36 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
101
154
  method.define_optional_argument('default')
102
155
  end
103
156
 
157
+ klass.define_instance_method('find') do |method|
158
+ method.define_optional_argument('ifnone')
159
+ end
160
+
161
+ klass.define_instance_method('find_all')
162
+
163
+ klass.define_instance_method('find_index') do |method|
164
+ method.define_optional_argument('value')
165
+ end
166
+
104
167
  klass.define_instance_method('find_item') do |method|
105
168
  method.define_argument('key')
106
169
  end
107
170
 
171
+ klass.define_instance_method('first') do |method|
172
+ method.define_optional_argument('n')
173
+ end
174
+
175
+ klass.define_instance_method('flat_map')
176
+
108
177
  klass.define_instance_method('flatten') do |method|
109
178
  method.define_optional_argument('level')
110
179
  end
111
180
 
181
+ klass.define_instance_method('grep') do |method|
182
+ method.define_argument('pattern')
183
+ end
184
+
185
+ klass.define_instance_method('group_by')
186
+
112
187
  klass.define_instance_method('has_key?') do |method|
113
188
  method.define_argument('key')
114
189
  end
@@ -135,13 +210,16 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
135
210
  method.define_rest_argument('args')
136
211
  end
137
212
 
213
+ klass.define_instance_method('inject') do |method|
214
+ method.define_optional_argument('initial')
215
+ method.define_optional_argument('sym')
216
+ end
217
+
138
218
  klass.define_instance_method('inspect')
139
219
 
140
220
  klass.define_instance_method('invert')
141
221
 
142
- klass.define_instance_method('keep_if') do |method|
143
- method.define_block_argument('block')
144
- end
222
+ klass.define_instance_method('keep_if')
145
223
 
146
224
  klass.define_instance_method('key') do |method|
147
225
  method.define_argument('value')
@@ -153,8 +231,16 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
153
231
 
154
232
  klass.define_instance_method('keys')
155
233
 
234
+ klass.define_instance_method('lazy')
235
+
156
236
  klass.define_instance_method('length')
157
237
 
238
+ klass.define_instance_method('map')
239
+
240
+ klass.define_instance_method('max')
241
+
242
+ klass.define_instance_method('max_by')
243
+
158
244
  klass.define_instance_method('max_entries')
159
245
 
160
246
  klass.define_instance_method('member?') do |method|
@@ -163,13 +249,26 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
163
249
 
164
250
  klass.define_instance_method('merge') do |method|
165
251
  method.define_argument('other')
166
- method.define_block_argument('block')
167
252
  end
168
253
 
169
254
  klass.define_instance_method('merge!') do |method|
170
255
  method.define_argument('other')
171
256
  end
172
257
 
258
+ klass.define_instance_method('min')
259
+
260
+ klass.define_instance_method('min_by')
261
+
262
+ klass.define_instance_method('minmax')
263
+
264
+ klass.define_instance_method('minmax_by')
265
+
266
+ klass.define_instance_method('none?')
267
+
268
+ klass.define_instance_method('one?')
269
+
270
+ klass.define_instance_method('partition')
271
+
173
272
  klass.define_instance_method('rassoc') do |method|
174
273
  method.define_argument('value')
175
274
  end
@@ -178,20 +277,23 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
178
277
  method.define_argument('entries')
179
278
  end
180
279
 
280
+ klass.define_instance_method('reduce') do |method|
281
+ method.define_optional_argument('initial')
282
+ method.define_optional_argument('sym')
283
+ end
284
+
181
285
  klass.define_instance_method('rehash')
182
286
 
183
- klass.define_instance_method('reject') do |method|
184
- method.define_block_argument('block')
185
- end
287
+ klass.define_instance_method('reject')
186
288
 
187
- klass.define_instance_method('reject!') do |method|
188
- method.define_block_argument('block')
189
- end
289
+ klass.define_instance_method('reject!')
190
290
 
191
291
  klass.define_instance_method('replace') do |method|
192
292
  method.define_argument('other')
193
293
  end
194
294
 
295
+ klass.define_instance_method('reverse_each')
296
+
195
297
  klass.define_instance_method('select')
196
298
 
197
299
  klass.define_instance_method('select!')
@@ -200,23 +302,41 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
200
302
 
201
303
  klass.define_instance_method('size')
202
304
 
203
- klass.define_instance_method('sort') do |method|
204
- method.define_block_argument('block')
305
+ klass.define_instance_method('slice_before') do |method|
306
+ method.define_optional_argument('arg')
205
307
  end
206
308
 
309
+ klass.define_instance_method('sort')
310
+
311
+ klass.define_instance_method('sort_by')
312
+
207
313
  klass.define_instance_method('store') do |method|
208
314
  method.define_argument('key')
209
315
  method.define_argument('value')
210
316
  end
211
317
 
318
+ klass.define_instance_method('take') do |method|
319
+ method.define_argument('n')
320
+ end
321
+
322
+ klass.define_instance_method('take_while')
323
+
212
324
  klass.define_instance_method('to_a')
213
325
 
326
+ klass.define_instance_method('to_h')
327
+
214
328
  klass.define_instance_method('to_hash')
215
329
 
216
330
  klass.define_instance_method('to_iter')
217
331
 
218
332
  klass.define_instance_method('to_s')
219
333
 
334
+ klass.define_instance_method('to_set') do |method|
335
+ method.define_optional_argument('klass')
336
+ method.define_rest_argument('args')
337
+ method.define_block_argument('block')
338
+ end
339
+
220
340
  klass.define_instance_method('update') do |method|
221
341
  method.define_argument('other')
222
342
  end
@@ -230,18 +350,19 @@ RubyLint::GlobalScope.definitions.define_constant('Hash') do |klass|
230
350
  klass.define_instance_method('values_at') do |method|
231
351
  method.define_rest_argument('args')
232
352
  end
353
+
354
+ klass.define_instance_method('with_object') do |method|
355
+ method.define_argument('memo')
356
+ end
357
+
358
+ klass.define_instance_method('zip') do |method|
359
+ method.define_rest_argument('args')
360
+ end
233
361
  end
234
362
 
235
- ##
236
- # Constant: Hash::Bucket
237
- # Created: 2013-04-01 18:33:54 +0200
238
- # Platform: rbx 2.0.0.rc1
239
- #
240
363
  RubyLint::GlobalScope.definitions.define_constant('Hash::Bucket') do |klass|
241
364
  klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
242
365
 
243
- klass.define_method('__class_init__')
244
-
245
366
  klass.define_instance_method('delete') do |method|
246
367
  method.define_argument('key')
247
368
  method.define_argument('key_hash')
@@ -285,20 +406,15 @@ RubyLint::GlobalScope.definitions.define_constant('Hash::Bucket') do |klass|
285
406
  klass.define_instance_method('value=')
286
407
  end
287
408
 
288
- ##
289
- # Constant: Hash::Entries
290
- # Created: 2013-04-01 18:33:54 +0200
291
- # Platform: rbx 2.0.0.rc1
292
- #
293
409
  RubyLint::GlobalScope.definitions.define_constant('Hash::Entries') do |klass|
294
410
  klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
295
411
 
412
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Enumerable'))
413
+
296
414
  klass.define_method('[]') do |method|
297
415
  method.define_rest_argument('args')
298
416
  end
299
417
 
300
- klass.define_method('__class_init__')
301
-
302
418
  klass.define_method('_load') do |method|
303
419
  method.define_argument('str')
304
420
  end
@@ -339,10 +455,22 @@ RubyLint::GlobalScope.definitions.define_constant('Hash::Entries') do |klass|
339
455
  method.define_argument('depth')
340
456
  end
341
457
 
458
+ klass.define_instance_method('all?')
459
+
460
+ klass.define_instance_method('any?')
461
+
342
462
  klass.define_instance_method('at') do |method|
343
463
  method.define_argument('idx')
344
464
  end
345
465
 
466
+ klass.define_instance_method('chunk') do |method|
467
+ method.define_optional_argument('initial_state')
468
+ end
469
+
470
+ klass.define_instance_method('collect')
471
+
472
+ klass.define_instance_method('collect_concat')
473
+
346
474
  klass.define_instance_method('copy_from') do |method|
347
475
  method.define_argument('other')
348
476
  method.define_argument('start')
@@ -350,6 +478,14 @@ RubyLint::GlobalScope.definitions.define_constant('Hash::Entries') do |klass|
350
478
  method.define_argument('dest')
351
479
  end
352
480
 
481
+ klass.define_instance_method('count') do |method|
482
+ method.define_optional_argument('item')
483
+ end
484
+
485
+ klass.define_instance_method('cycle') do |method|
486
+ method.define_optional_argument('many')
487
+ end
488
+
353
489
  klass.define_instance_method('delete') do |method|
354
490
  method.define_argument('start')
355
491
  method.define_argument('length')
@@ -360,16 +496,77 @@ RubyLint::GlobalScope.definitions.define_constant('Hash::Entries') do |klass|
360
496
  method.define_argument('index')
361
497
  end
362
498
 
499
+ klass.define_instance_method('detect') do |method|
500
+ method.define_optional_argument('ifnone')
501
+ end
502
+
503
+ klass.define_instance_method('drop') do |method|
504
+ method.define_argument('n')
505
+ end
506
+
507
+ klass.define_instance_method('drop_while')
508
+
363
509
  klass.define_instance_method('dup')
364
510
 
365
511
  klass.define_instance_method('each')
366
512
 
513
+ klass.define_instance_method('each_cons') do |method|
514
+ method.define_argument('num')
515
+ end
516
+
517
+ klass.define_instance_method('each_entry') do |method|
518
+ method.define_rest_argument('pass')
519
+ end
520
+
521
+ klass.define_instance_method('each_slice') do |method|
522
+ method.define_argument('slice_size')
523
+ end
524
+
525
+ klass.define_instance_method('each_with_index') do |method|
526
+ method.define_rest_argument('args')
527
+ end
528
+
529
+ klass.define_instance_method('each_with_object') do |method|
530
+ method.define_argument('memo')
531
+ end
532
+
367
533
  klass.define_instance_method('empty?')
368
534
 
535
+ klass.define_instance_method('entries') do |method|
536
+ method.define_rest_argument('arg')
537
+ end
538
+
369
539
  klass.define_instance_method('fields')
370
540
 
541
+ klass.define_instance_method('find') do |method|
542
+ method.define_optional_argument('ifnone')
543
+ end
544
+
545
+ klass.define_instance_method('find_all')
546
+
547
+ klass.define_instance_method('find_index') do |method|
548
+ method.define_optional_argument('value')
549
+ end
550
+
371
551
  klass.define_instance_method('first')
372
552
 
553
+ klass.define_instance_method('flat_map')
554
+
555
+ klass.define_instance_method('grep') do |method|
556
+ method.define_argument('pattern')
557
+ end
558
+
559
+ klass.define_instance_method('group_by')
560
+
561
+ klass.define_instance_method('include?') do |method|
562
+ method.define_argument('obj')
563
+ end
564
+
565
+ klass.define_instance_method('inject') do |method|
566
+ method.define_optional_argument('initial')
567
+ method.define_optional_argument('sym')
568
+ end
569
+
373
570
  klass.define_instance_method('insert_at_index') do |method|
374
571
  method.define_argument('index')
375
572
  method.define_argument('value')
@@ -390,100 +587,744 @@ RubyLint::GlobalScope.definitions.define_constant('Hash::Entries') do |klass|
390
587
 
391
588
  klass.define_instance_method('last')
392
589
 
590
+ klass.define_instance_method('lazy')
591
+
393
592
  klass.define_instance_method('length')
394
593
 
594
+ klass.define_instance_method('map')
595
+
596
+ klass.define_instance_method('max')
597
+
598
+ klass.define_instance_method('max_by')
599
+
600
+ klass.define_instance_method('member?') do |method|
601
+ method.define_argument('obj')
602
+ end
603
+
604
+ klass.define_instance_method('min')
605
+
606
+ klass.define_instance_method('min_by')
607
+
608
+ klass.define_instance_method('minmax')
609
+
610
+ klass.define_instance_method('minmax_by')
611
+
612
+ klass.define_instance_method('none?')
613
+
614
+ klass.define_instance_method('one?')
615
+
616
+ klass.define_instance_method('partition')
617
+
395
618
  klass.define_instance_method('put') do |method|
396
619
  method.define_argument('idx')
397
620
  method.define_argument('val')
398
621
  end
399
622
 
623
+ klass.define_instance_method('reduce') do |method|
624
+ method.define_optional_argument('initial')
625
+ method.define_optional_argument('sym')
626
+ end
627
+
628
+ klass.define_instance_method('reject')
629
+
400
630
  klass.define_instance_method('reverse!') do |method|
401
631
  method.define_argument('start')
402
632
  method.define_argument('total')
403
633
  end
404
634
 
635
+ klass.define_instance_method('reverse_each')
636
+
637
+ klass.define_instance_method('select')
638
+
405
639
  klass.define_instance_method('shift')
406
640
 
407
641
  klass.define_instance_method('size')
408
642
 
643
+ klass.define_instance_method('slice_before') do |method|
644
+ method.define_optional_argument('arg')
645
+ end
646
+
647
+ klass.define_instance_method('sort')
648
+
649
+ klass.define_instance_method('sort_by')
650
+
409
651
  klass.define_instance_method('swap') do |method|
410
652
  method.define_argument('a')
411
653
  method.define_argument('b')
412
654
  end
413
655
 
656
+ klass.define_instance_method('take') do |method|
657
+ method.define_argument('n')
658
+ end
659
+
660
+ klass.define_instance_method('take_while')
661
+
414
662
  klass.define_instance_method('to_a')
415
663
 
416
664
  klass.define_instance_method('to_s')
665
+
666
+ klass.define_instance_method('to_set') do |method|
667
+ method.define_optional_argument('klass')
668
+ method.define_rest_argument('args')
669
+ method.define_block_argument('block')
670
+ end
671
+
672
+ klass.define_instance_method('with_object') do |method|
673
+ method.define_argument('memo')
674
+ end
675
+
676
+ klass.define_instance_method('zip') do |method|
677
+ method.define_rest_argument('args')
678
+ end
417
679
  end
418
680
 
419
- ##
420
- # Constant: Hash::Iterator
421
- # Created: 2013-04-01 18:33:54 +0200
422
- # Platform: rbx 2.0.0.rc1
423
- #
424
- RubyLint::GlobalScope.definitions.define_constant('Hash::Iterator') do |klass|
681
+ RubyLint::GlobalScope.definitions.define_constant('Hash::Enumerator') do |klass|
425
682
  klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
426
683
 
427
- klass.define_method('__class_init__')
684
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Enumerable'))
428
685
 
429
- klass.define_instance_method('initialize') do |method|
430
- method.define_argument('state')
686
+ klass.define_instance_method('all?')
687
+
688
+ klass.define_instance_method('any?')
689
+
690
+ klass.define_instance_method('chunk') do |method|
691
+ method.define_optional_argument('initial_state')
431
692
  end
432
693
 
433
- klass.define_instance_method('next') do |method|
434
- method.define_argument('item')
694
+ klass.define_instance_method('collect')
695
+
696
+ klass.define_instance_method('collect_concat')
697
+
698
+ klass.define_instance_method('count') do |method|
699
+ method.define_optional_argument('item')
435
700
  end
436
- end
437
701
 
438
- ##
439
- # Constant: Hash::MAX_ENTRIES
440
- # Created: 2013-04-01 18:33:54 +0200
441
- # Platform: rbx 2.0.0.rc1
442
- #
443
- RubyLint::GlobalScope.definitions.define_constant('Hash::MAX_ENTRIES') do |klass|
444
- end
702
+ klass.define_instance_method('cycle') do |method|
703
+ method.define_optional_argument('many')
704
+ end
445
705
 
446
- ##
447
- # Constant: Hash::MIN_SIZE
448
- # Created: 2013-04-01 18:33:54 +0200
449
- # Platform: rbx 2.0.0.rc1
450
- #
451
- RubyLint::GlobalScope.definitions.define_constant('Hash::MIN_SIZE') do |klass|
452
- end
706
+ klass.define_instance_method('detect') do |method|
707
+ method.define_optional_argument('ifnone')
708
+ end
453
709
 
454
- ##
455
- # Constant: Hash::SortedElement
456
- # Created: 2013-04-01 18:33:54 +0200
457
- # Platform: rbx 2.0.0.rc1
458
- #
459
- RubyLint::GlobalScope.definitions.define_constant('Hash::SortedElement') do |klass|
460
- klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
710
+ klass.define_instance_method('drop') do |method|
711
+ method.define_argument('n')
712
+ end
461
713
 
462
- klass.define_method('__class_init__')
714
+ klass.define_instance_method('drop_while')
463
715
 
464
- klass.define_instance_method('<=>') do |method|
465
- method.define_argument('other')
716
+ klass.define_instance_method('each') do |method|
717
+ method.define_rest_argument('args')
466
718
  end
467
719
 
468
- klass.define_instance_method('initialize') do |method|
469
- method.define_argument('val')
470
- method.define_argument('sort_id')
720
+ klass.define_instance_method('each_cons') do |method|
721
+ method.define_argument('num')
471
722
  end
472
723
 
473
- klass.define_instance_method('sort_id')
724
+ klass.define_instance_method('each_entry') do |method|
725
+ method.define_rest_argument('pass')
726
+ end
474
727
 
475
- klass.define_instance_method('value')
476
- end
728
+ klass.define_instance_method('each_slice') do |method|
729
+ method.define_argument('slice_size')
730
+ end
477
731
 
478
- ##
479
- # Constant: Hash::State
480
- # Created: 2013-04-01 18:33:54 +0200
481
- # Platform: rbx 2.0.0.rc1
482
- #
483
- RubyLint::GlobalScope.definitions.define_constant('Hash::State') do |klass|
484
- klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
732
+ klass.define_instance_method('each_with_index')
733
+
734
+ klass.define_instance_method('each_with_object') do |method|
735
+ method.define_argument('memo')
736
+ end
737
+
738
+ klass.define_instance_method('entries') do |method|
739
+ method.define_rest_argument('arg')
740
+ end
741
+
742
+ klass.define_instance_method('find') do |method|
743
+ method.define_optional_argument('ifnone')
744
+ end
745
+
746
+ klass.define_instance_method('find_all')
747
+
748
+ klass.define_instance_method('find_index') do |method|
749
+ method.define_optional_argument('value')
750
+ end
751
+
752
+ klass.define_instance_method('first') do |method|
753
+ method.define_optional_argument('n')
754
+ end
755
+
756
+ klass.define_instance_method('flat_map')
757
+
758
+ klass.define_instance_method('grep') do |method|
759
+ method.define_argument('pattern')
760
+ end
761
+
762
+ klass.define_instance_method('group_by')
763
+
764
+ klass.define_instance_method('include?') do |method|
765
+ method.define_argument('obj')
766
+ end
767
+
768
+ klass.define_instance_method('inject') do |method|
769
+ method.define_optional_argument('initial')
770
+ method.define_optional_argument('sym')
771
+ end
772
+
773
+ klass.define_instance_method('lazy')
774
+
775
+ klass.define_instance_method('map')
776
+
777
+ klass.define_instance_method('max')
778
+
779
+ klass.define_instance_method('max_by')
780
+
781
+ klass.define_instance_method('member?') do |method|
782
+ method.define_argument('obj')
783
+ end
784
+
785
+ klass.define_instance_method('min')
786
+
787
+ klass.define_instance_method('min_by')
788
+
789
+ klass.define_instance_method('minmax')
790
+
791
+ klass.define_instance_method('minmax_by')
792
+
793
+ klass.define_instance_method('next')
794
+
795
+ klass.define_instance_method('next_values')
796
+
797
+ klass.define_instance_method('none?')
798
+
799
+ klass.define_instance_method('one?')
800
+
801
+ klass.define_instance_method('partition')
802
+
803
+ klass.define_instance_method('peek')
804
+
805
+ klass.define_instance_method('peek_values')
806
+
807
+ klass.define_instance_method('reduce') do |method|
808
+ method.define_optional_argument('initial')
809
+ method.define_optional_argument('sym')
810
+ end
811
+
812
+ klass.define_instance_method('reject')
813
+
814
+ klass.define_instance_method('reverse_each')
815
+
816
+ klass.define_instance_method('rewind')
817
+
818
+ klass.define_instance_method('select')
819
+
820
+ klass.define_instance_method('size')
821
+
822
+ klass.define_instance_method('slice_before') do |method|
823
+ method.define_optional_argument('arg')
824
+ end
825
+
826
+ klass.define_instance_method('sort')
485
827
 
486
- klass.define_method('__class_init__')
828
+ klass.define_instance_method('sort_by')
829
+
830
+ klass.define_instance_method('take') do |method|
831
+ method.define_argument('n')
832
+ end
833
+
834
+ klass.define_instance_method('take_while')
835
+
836
+ klass.define_instance_method('to_a') do |method|
837
+ method.define_rest_argument('arg')
838
+ end
839
+
840
+ klass.define_instance_method('to_set') do |method|
841
+ method.define_optional_argument('klass')
842
+ method.define_rest_argument('args')
843
+ method.define_block_argument('block')
844
+ end
845
+
846
+ klass.define_instance_method('with_index') do |method|
847
+ method.define_optional_argument('offset')
848
+ end
849
+
850
+ klass.define_instance_method('with_object') do |method|
851
+ method.define_argument('memo')
852
+ end
853
+
854
+ klass.define_instance_method('zip') do |method|
855
+ method.define_rest_argument('args')
856
+ end
857
+ end
858
+
859
+ RubyLint::GlobalScope.definitions.define_constant('Hash::Iterator') do |klass|
860
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
861
+
862
+ klass.define_instance_method('initialize') do |method|
863
+ method.define_argument('state')
864
+ end
865
+
866
+ klass.define_instance_method('next') do |method|
867
+ method.define_argument('item')
868
+ end
869
+ end
870
+
871
+ RubyLint::GlobalScope.definitions.define_constant('Hash::MAX_ENTRIES') do |klass|
872
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
873
+
874
+ klass.define_method('%') do |method|
875
+ method.define_argument('o')
876
+ end
877
+
878
+ klass.define_method('&') do |method|
879
+ method.define_argument('o')
880
+ end
881
+
882
+ klass.define_method('*') do |method|
883
+ method.define_argument('o')
884
+ end
885
+
886
+ klass.define_method('**') do |method|
887
+ method.define_argument('o')
888
+ end
889
+
890
+ klass.define_method('+') do |method|
891
+ method.define_argument('o')
892
+ end
893
+
894
+ klass.define_method('+@')
895
+
896
+ klass.define_method('-') do |method|
897
+ method.define_argument('o')
898
+ end
899
+
900
+ klass.define_method('-@')
901
+
902
+ klass.define_method('/') do |method|
903
+ method.define_argument('o')
904
+ end
905
+
906
+ klass.define_method('<<') do |method|
907
+ method.define_argument('other')
908
+ end
909
+
910
+ klass.define_method('>>') do |method|
911
+ method.define_argument('other')
912
+ end
913
+
914
+ klass.define_method('[]') do |method|
915
+ method.define_argument('index')
916
+ end
917
+
918
+ klass.define_method('^') do |method|
919
+ method.define_argument('o')
920
+ end
921
+
922
+ klass.define_method('abs')
923
+
924
+ klass.define_method('abs2')
925
+
926
+ klass.define_method('angle')
927
+
928
+ klass.define_method('arg')
929
+
930
+ klass.define_method('between?') do |method|
931
+ method.define_argument('min')
932
+ method.define_argument('max')
933
+ end
934
+
935
+ klass.define_method('ceil')
936
+
937
+ klass.define_method('chr') do |method|
938
+ method.define_optional_argument('enc')
939
+ end
940
+
941
+ klass.define_method('coerce') do |method|
942
+ method.define_argument('other')
943
+ end
944
+
945
+ klass.define_method('conj')
946
+
947
+ klass.define_method('conjugate')
948
+
949
+ klass.define_method('denominator')
950
+
951
+ klass.define_method('div') do |method|
952
+ method.define_argument('o')
953
+ end
954
+
955
+ klass.define_method('divide') do |method|
956
+ method.define_argument('o')
957
+ end
958
+
959
+ klass.define_method('divmod') do |method|
960
+ method.define_argument('other')
961
+ end
962
+
963
+ klass.define_method('downto') do |method|
964
+ method.define_argument('val')
965
+ end
966
+
967
+ klass.define_method('even?')
968
+
969
+ klass.define_method('fdiv') do |method|
970
+ method.define_argument('n')
971
+ end
972
+
973
+ klass.define_method('floor')
974
+
975
+ klass.define_method('gcd') do |method|
976
+ method.define_argument('other')
977
+ end
978
+
979
+ klass.define_method('gcdlcm') do |method|
980
+ method.define_argument('other')
981
+ end
982
+
983
+ klass.define_method('i')
984
+
985
+ klass.define_method('imag')
986
+
987
+ klass.define_method('imaginary')
988
+
989
+ klass.define_method('integer?')
990
+
991
+ klass.define_method('lcm') do |method|
992
+ method.define_argument('other')
993
+ end
994
+
995
+ klass.define_method('magnitude')
996
+
997
+ klass.define_method('modulo') do |method|
998
+ method.define_argument('o')
999
+ end
1000
+
1001
+ klass.define_method('next')
1002
+
1003
+ klass.define_method('nonzero?')
1004
+
1005
+ klass.define_method('numerator')
1006
+
1007
+ klass.define_method('odd?')
1008
+
1009
+ klass.define_method('ord')
1010
+
1011
+ klass.define_method('phase')
1012
+
1013
+ klass.define_method('polar')
1014
+
1015
+ klass.define_method('prec') do |method|
1016
+ method.define_argument('klass')
1017
+ end
1018
+
1019
+ klass.define_method('prec_f')
1020
+
1021
+ klass.define_method('prec_i')
1022
+
1023
+ klass.define_method('pred')
1024
+
1025
+ klass.define_method('quo') do |method|
1026
+ method.define_argument('other')
1027
+ end
1028
+
1029
+ klass.define_method('rationalize') do |method|
1030
+ method.define_optional_argument('eps')
1031
+ end
1032
+
1033
+ klass.define_method('real')
1034
+
1035
+ klass.define_method('real?')
1036
+
1037
+ klass.define_method('rect')
1038
+
1039
+ klass.define_method('rectangular')
1040
+
1041
+ klass.define_method('redo_compare') do |method|
1042
+ method.define_argument('meth')
1043
+ method.define_argument('right')
1044
+ end
1045
+
1046
+ klass.define_method('remainder') do |method|
1047
+ method.define_argument('other')
1048
+ end
1049
+
1050
+ klass.define_method('round') do |method|
1051
+ method.define_optional_argument('ndigits')
1052
+ end
1053
+
1054
+ klass.define_method('size')
1055
+
1056
+ klass.define_method('step') do |method|
1057
+ method.define_argument('limit')
1058
+ method.define_optional_argument('step')
1059
+ end
1060
+
1061
+ klass.define_method('succ')
1062
+
1063
+ klass.define_method('times')
1064
+
1065
+ klass.define_method('to_c')
1066
+
1067
+ klass.define_method('to_f')
1068
+
1069
+ klass.define_method('to_i')
1070
+
1071
+ klass.define_method('to_int')
1072
+
1073
+ klass.define_method('to_r')
1074
+
1075
+ klass.define_method('truncate')
1076
+
1077
+ klass.define_method('upto') do |method|
1078
+ method.define_argument('val')
1079
+ end
1080
+
1081
+ klass.define_method('zero?')
1082
+
1083
+ klass.define_method('|') do |method|
1084
+ method.define_argument('o')
1085
+ end
1086
+
1087
+ klass.define_method('~')
1088
+ end
1089
+
1090
+ RubyLint::GlobalScope.definitions.define_constant('Hash::MIN_SIZE') do |klass|
1091
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
1092
+
1093
+ klass.define_method('%') do |method|
1094
+ method.define_argument('o')
1095
+ end
1096
+
1097
+ klass.define_method('&') do |method|
1098
+ method.define_argument('o')
1099
+ end
1100
+
1101
+ klass.define_method('*') do |method|
1102
+ method.define_argument('o')
1103
+ end
1104
+
1105
+ klass.define_method('**') do |method|
1106
+ method.define_argument('o')
1107
+ end
1108
+
1109
+ klass.define_method('+') do |method|
1110
+ method.define_argument('o')
1111
+ end
1112
+
1113
+ klass.define_method('+@')
1114
+
1115
+ klass.define_method('-') do |method|
1116
+ method.define_argument('o')
1117
+ end
1118
+
1119
+ klass.define_method('-@')
1120
+
1121
+ klass.define_method('/') do |method|
1122
+ method.define_argument('o')
1123
+ end
1124
+
1125
+ klass.define_method('<<') do |method|
1126
+ method.define_argument('other')
1127
+ end
1128
+
1129
+ klass.define_method('>>') do |method|
1130
+ method.define_argument('other')
1131
+ end
1132
+
1133
+ klass.define_method('[]') do |method|
1134
+ method.define_argument('index')
1135
+ end
1136
+
1137
+ klass.define_method('^') do |method|
1138
+ method.define_argument('o')
1139
+ end
1140
+
1141
+ klass.define_method('abs')
1142
+
1143
+ klass.define_method('abs2')
1144
+
1145
+ klass.define_method('angle')
1146
+
1147
+ klass.define_method('arg')
1148
+
1149
+ klass.define_method('between?') do |method|
1150
+ method.define_argument('min')
1151
+ method.define_argument('max')
1152
+ end
1153
+
1154
+ klass.define_method('ceil')
1155
+
1156
+ klass.define_method('chr') do |method|
1157
+ method.define_optional_argument('enc')
1158
+ end
1159
+
1160
+ klass.define_method('coerce') do |method|
1161
+ method.define_argument('other')
1162
+ end
1163
+
1164
+ klass.define_method('conj')
1165
+
1166
+ klass.define_method('conjugate')
1167
+
1168
+ klass.define_method('denominator')
1169
+
1170
+ klass.define_method('div') do |method|
1171
+ method.define_argument('o')
1172
+ end
1173
+
1174
+ klass.define_method('divide') do |method|
1175
+ method.define_argument('o')
1176
+ end
1177
+
1178
+ klass.define_method('divmod') do |method|
1179
+ method.define_argument('other')
1180
+ end
1181
+
1182
+ klass.define_method('downto') do |method|
1183
+ method.define_argument('val')
1184
+ end
1185
+
1186
+ klass.define_method('even?')
1187
+
1188
+ klass.define_method('fdiv') do |method|
1189
+ method.define_argument('n')
1190
+ end
1191
+
1192
+ klass.define_method('floor')
1193
+
1194
+ klass.define_method('gcd') do |method|
1195
+ method.define_argument('other')
1196
+ end
1197
+
1198
+ klass.define_method('gcdlcm') do |method|
1199
+ method.define_argument('other')
1200
+ end
1201
+
1202
+ klass.define_method('i')
1203
+
1204
+ klass.define_method('imag')
1205
+
1206
+ klass.define_method('imaginary')
1207
+
1208
+ klass.define_method('integer?')
1209
+
1210
+ klass.define_method('lcm') do |method|
1211
+ method.define_argument('other')
1212
+ end
1213
+
1214
+ klass.define_method('magnitude')
1215
+
1216
+ klass.define_method('modulo') do |method|
1217
+ method.define_argument('o')
1218
+ end
1219
+
1220
+ klass.define_method('next')
1221
+
1222
+ klass.define_method('nonzero?')
1223
+
1224
+ klass.define_method('numerator')
1225
+
1226
+ klass.define_method('odd?')
1227
+
1228
+ klass.define_method('ord')
1229
+
1230
+ klass.define_method('phase')
1231
+
1232
+ klass.define_method('polar')
1233
+
1234
+ klass.define_method('prec') do |method|
1235
+ method.define_argument('klass')
1236
+ end
1237
+
1238
+ klass.define_method('prec_f')
1239
+
1240
+ klass.define_method('prec_i')
1241
+
1242
+ klass.define_method('pred')
1243
+
1244
+ klass.define_method('quo') do |method|
1245
+ method.define_argument('other')
1246
+ end
1247
+
1248
+ klass.define_method('rationalize') do |method|
1249
+ method.define_optional_argument('eps')
1250
+ end
1251
+
1252
+ klass.define_method('real')
1253
+
1254
+ klass.define_method('real?')
1255
+
1256
+ klass.define_method('rect')
1257
+
1258
+ klass.define_method('rectangular')
1259
+
1260
+ klass.define_method('redo_compare') do |method|
1261
+ method.define_argument('meth')
1262
+ method.define_argument('right')
1263
+ end
1264
+
1265
+ klass.define_method('remainder') do |method|
1266
+ method.define_argument('other')
1267
+ end
1268
+
1269
+ klass.define_method('round') do |method|
1270
+ method.define_optional_argument('ndigits')
1271
+ end
1272
+
1273
+ klass.define_method('size')
1274
+
1275
+ klass.define_method('step') do |method|
1276
+ method.define_argument('limit')
1277
+ method.define_optional_argument('step')
1278
+ end
1279
+
1280
+ klass.define_method('succ')
1281
+
1282
+ klass.define_method('times')
1283
+
1284
+ klass.define_method('to_c')
1285
+
1286
+ klass.define_method('to_f')
1287
+
1288
+ klass.define_method('to_i')
1289
+
1290
+ klass.define_method('to_int')
1291
+
1292
+ klass.define_method('to_r')
1293
+
1294
+ klass.define_method('truncate')
1295
+
1296
+ klass.define_method('upto') do |method|
1297
+ method.define_argument('val')
1298
+ end
1299
+
1300
+ klass.define_method('zero?')
1301
+
1302
+ klass.define_method('|') do |method|
1303
+ method.define_argument('o')
1304
+ end
1305
+
1306
+ klass.define_method('~')
1307
+ end
1308
+
1309
+ RubyLint::GlobalScope.definitions.define_constant('Hash::SortedElement') do |klass|
1310
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
1311
+
1312
+ klass.define_instance_method('<=>') do |method|
1313
+ method.define_argument('other')
1314
+ end
1315
+
1316
+ klass.define_instance_method('initialize') do |method|
1317
+ method.define_argument('val')
1318
+ method.define_argument('sort_id')
1319
+ end
1320
+
1321
+ klass.define_instance_method('sort_id')
1322
+
1323
+ klass.define_instance_method('value')
1324
+ end
1325
+
1326
+ RubyLint::GlobalScope.definitions.define_constant('Hash::State') do |klass|
1327
+ klass.inherits(RubyLint::GlobalScope.constant_proxy('Object'))
487
1328
 
488
1329
  klass.define_method('from') do |method|
489
1330
  method.define_argument('state')
@@ -511,4 +1352,4 @@ RubyLint::GlobalScope.definitions.define_constant('Hash::State') do |klass|
511
1352
  klass.define_instance_method('tail=')
512
1353
  end
513
1354
 
514
- RubyLint::GlobalScope.definitions.lookup(:const, 'Hash').deep_freeze
1355
+ RubyLint::GlobalScope.definitions.lookup(:const, 'Hash').deep_freeze