ruby-lint 0.0.5 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.asc +14 -14
- data/.gitignore +1 -0
- data/.yardopts +1 -1
- data/Gemfile +3 -3
- data/MANIFEST +16 -3
- data/benchmark/virtual_machine.rb +17 -0
- data/checksum/ruby-lint-0.0.5.gem.sha512 +1 -0
- data/doc/changelog.md +42 -0
- data/doc/configuration.md +133 -13
- data/lib/ruby-lint/analysis/shadowing_variables.rb +8 -14
- data/lib/ruby-lint/analysis/unused_variables.rb +17 -0
- data/lib/ruby-lint/ast/node.rb +18 -3
- data/lib/ruby-lint/cache.rb +121 -0
- data/lib/ruby-lint/cache_entry.rb +44 -0
- data/lib/ruby-lint/cli/analyze.rb +37 -18
- data/lib/ruby-lint/cli/plot.rb +94 -0
- data/lib/ruby-lint/cli.rb +1 -0
- data/lib/ruby-lint/configuration.rb +48 -3
- data/lib/ruby-lint/definition/ruby_method.rb +28 -1
- data/lib/ruby-lint/definition/ruby_object.rb +37 -3
- data/lib/ruby-lint/definition_builder/ruby_method.rb +4 -1
- data/lib/ruby-lint/definition_builder/ruby_module.rb +4 -1
- data/lib/ruby-lint/definition_generator.rb +3 -2
- data/lib/ruby-lint/definitions/core/arg0.rb +3 -1
- data/lib/ruby-lint/definitions/core/argf.rb +3 -1
- data/lib/ruby-lint/definitions/core/argument_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/argv.rb +3 -1
- data/lib/ruby-lint/definitions/core/array.rb +3 -1
- data/lib/ruby-lint/definitions/core/autoload.rb +3 -1
- data/lib/ruby-lint/definitions/core/basic_object.rb +2 -0
- data/lib/ruby-lint/definitions/core/bignum.rb +3 -1
- data/lib/ruby-lint/definitions/core/binding.rb +3 -1
- data/lib/ruby-lint/definitions/core/class.rb +2 -0
- data/lib/ruby-lint/definitions/core/comparable.rb +3 -1
- data/lib/ruby-lint/definitions/core/complex.rb +3 -1
- data/lib/ruby-lint/definitions/core/condition_variable.rb +3 -1
- data/lib/ruby-lint/definitions/core/continuation.rb +3 -1
- data/lib/ruby-lint/definitions/core/data.rb +3 -1
- data/lib/ruby-lint/definitions/core/date.rb +3 -1
- data/lib/ruby-lint/definitions/core/date_time.rb +3 -1
- data/lib/ruby-lint/definitions/core/default_record_separator.rb +3 -1
- data/lib/ruby-lint/definitions/core/digest.rb +3 -1
- data/lib/ruby-lint/definitions/core/dir.rb +3 -1
- data/lib/ruby-lint/definitions/core/encoding.rb +3 -1
- data/lib/ruby-lint/definitions/core/encoding_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/enumerable.rb +3 -1
- data/lib/ruby-lint/definitions/core/enumerator.rb +3 -1
- data/lib/ruby-lint/definitions/core/env.rb +4 -1
- data/lib/ruby-lint/definitions/core/eoferror.rb +3 -1
- data/lib/ruby-lint/definitions/core/erb.rb +2 -0
- data/lib/ruby-lint/definitions/core/errno.rb +3 -1
- data/lib/ruby-lint/definitions/core/etc.rb +3 -1
- data/lib/ruby-lint/definitions/core/exception.rb +3 -1
- data/lib/ruby-lint/definitions/core/false.rb +3 -1
- data/lib/ruby-lint/definitions/core/false_class.rb +3 -1
- data/lib/ruby-lint/definitions/core/fatal_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/fiber.rb +3 -1
- data/lib/ruby-lint/definitions/core/fiber_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/file.rb +3 -1
- data/lib/ruby-lint/definitions/core/file_list.rb +3 -1
- data/lib/ruby-lint/definitions/core/file_test.rb +3 -1
- data/lib/ruby-lint/definitions/core/file_utils.rb +3 -1
- data/lib/ruby-lint/definitions/core/fixnum.rb +3 -1
- data/lib/ruby-lint/definitions/core/float.rb +3 -1
- data/lib/ruby-lint/definitions/core/float_domain_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/gc.rb +3 -1
- data/lib/ruby-lint/definitions/core/gem.rb +3 -1
- data/lib/ruby-lint/definitions/core/hash.rb +3 -1
- data/lib/ruby-lint/definitions/core/immediate_value.rb +3 -1
- data/lib/ruby-lint/definitions/core/index_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/integer.rb +3 -1
- data/lib/ruby-lint/definitions/core/interrupt.rb +3 -1
- data/lib/ruby-lint/definitions/core/io.rb +3 -1
- data/lib/ruby-lint/definitions/core/ioerror.rb +3 -1
- data/lib/ruby-lint/definitions/core/kernel.rb +2 -0
- data/lib/ruby-lint/definitions/core/key_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/load_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/local_jump_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/marshal.rb +3 -1
- data/lib/ruby-lint/definitions/core/match_data.rb +3 -1
- data/lib/ruby-lint/definitions/core/math.rb +3 -1
- data/lib/ruby-lint/definitions/core/memory_segmention_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/method.rb +3 -1
- data/lib/ruby-lint/definitions/core/module.rb +2 -0
- data/lib/ruby-lint/definitions/core/monitor.rb +3 -1
- data/lib/ruby-lint/definitions/core/monitor_mixin.rb +3 -1
- data/lib/ruby-lint/definitions/core/mutex.rb +3 -1
- data/lib/ruby-lint/definitions/core/name_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/nil.rb +3 -1
- data/lib/ruby-lint/definitions/core/nil_class.rb +3 -1
- data/lib/ruby-lint/definitions/core/no_memory_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/no_method_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/not_implemented_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/numeric.rb +3 -1
- data/lib/ruby-lint/definitions/core/object.rb +3 -1
- data/lib/ruby-lint/definitions/core/object_space.rb +3 -1
- data/lib/ruby-lint/definitions/core/open_struct.rb +3 -1
- data/lib/ruby-lint/definitions/core/option_parser.rb +3 -1
- data/lib/ruby-lint/definitions/core/precision.rb +3 -1
- data/lib/ruby-lint/definitions/core/primitive_failure.rb +3 -1
- data/lib/ruby-lint/definitions/core/proc.rb +3 -1
- data/lib/ruby-lint/definitions/core/process.rb +3 -1
- data/lib/ruby-lint/definitions/core/queue.rb +3 -1
- data/lib/ruby-lint/definitions/core/rake.rb +3 -1
- data/lib/ruby-lint/definitions/core/rake_file_utils.rb +3 -1
- data/lib/ruby-lint/definitions/core/rakeversion.rb +3 -1
- data/lib/ruby-lint/definitions/core/random.rb +3 -1
- data/lib/ruby-lint/definitions/core/range.rb +3 -1
- data/lib/ruby-lint/definitions/core/range_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/rational.rb +3 -1
- data/lib/ruby-lint/definitions/core/rb_config.rb +3 -1
- data/lib/ruby-lint/definitions/core/regexp.rb +3 -1
- data/lib/ruby-lint/definitions/core/regexp_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/ruby_copyright.rb +3 -1
- data/lib/ruby-lint/definitions/core/ruby_description.rb +3 -1
- data/lib/ruby-lint/definitions/core/ruby_engine.rb +3 -1
- data/lib/ruby-lint/definitions/core/ruby_patchlevel.rb +3 -1
- data/lib/ruby-lint/definitions/core/ruby_platform.rb +3 -1
- data/lib/ruby-lint/definitions/core/ruby_release_date.rb +3 -1
- data/lib/ruby-lint/definitions/core/ruby_version.rb +3 -1
- data/lib/ruby-lint/definitions/core/runtime_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/scan_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/script_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/security_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/shellwords.rb +3 -1
- data/lib/ruby-lint/definitions/core/signal.rb +3 -1
- data/lib/ruby-lint/definitions/core/signal_exception.rb +3 -1
- data/lib/ruby-lint/definitions/core/singleton.rb +3 -1
- data/lib/ruby-lint/definitions/core/sized_queue.rb +3 -1
- data/lib/ruby-lint/definitions/core/standard_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/stderr.rb +2 -0
- data/lib/ruby-lint/definitions/core/stdin.rb +2 -0
- data/lib/ruby-lint/definitions/core/stdout.rb +2 -0
- data/lib/ruby-lint/definitions/core/stop_iteration.rb +3 -1
- data/lib/ruby-lint/definitions/core/string.rb +3 -1
- data/lib/ruby-lint/definitions/core/string_io.rb +3 -1
- data/lib/ruby-lint/definitions/core/string_scanner.rb +3 -1
- data/lib/ruby-lint/definitions/core/struct.rb +3 -1
- data/lib/ruby-lint/definitions/core/syck.rb +3 -1
- data/lib/ruby-lint/definitions/core/symbol.rb +3 -1
- data/lib/ruby-lint/definitions/core/syntax_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/system_call_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/system_exit.rb +3 -1
- data/lib/ruby-lint/definitions/core/system_stack_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/thread.rb +3 -1
- data/lib/ruby-lint/definitions/core/thread_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/thread_group.rb +3 -1
- data/lib/ruby-lint/definitions/core/time.rb +3 -1
- data/lib/ruby-lint/definitions/core/toplevel_binding.rb +3 -1
- data/lib/ruby-lint/definitions/core/true.rb +3 -1
- data/lib/ruby-lint/definitions/core/true_class.rb +3 -1
- data/lib/ruby-lint/definitions/core/type_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/unbound_method.rb +3 -1
- data/lib/ruby-lint/definitions/core/unmarshalable.rb +3 -1
- data/lib/ruby-lint/definitions/core/unsupported_library_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/weak_ref.rb +3 -1
- data/lib/ruby-lint/definitions/core/yaml.rb +1 -0
- data/lib/ruby-lint/definitions/core/zero_division_error.rb +3 -1
- data/lib/ruby-lint/definitions/core/zlib.rb +8840 -0
- data/lib/ruby-lint/definitions/rails/abstract_controller.rb +1 -0
- data/lib/ruby-lint/definitions/rails/action_controller.rb +1 -0
- data/lib/ruby-lint/definitions/rails/action_dispatch.rb +1 -0
- data/lib/ruby-lint/definitions/rails/action_mailer.rb +1 -0
- data/lib/ruby-lint/definitions/rails/action_pack.rb +1 -0
- data/lib/ruby-lint/definitions/rails/action_view.rb +1 -0
- data/lib/ruby-lint/definitions/rails/active_model.rb +1 -0
- data/lib/ruby-lint/definitions/rails/active_record.rb +1 -0
- data/lib/ruby-lint/definitions/rails/active_support.rb +1 -0
- data/lib/ruby-lint/definitions/rails/arel.rb +1 -0
- data/lib/ruby-lint/definitions/rails/rails.rb +1 -0
- data/lib/ruby-lint/definitions/rails/sprockets.rb +1 -0
- data/lib/ruby-lint/file_scanner.rb +2 -0
- data/lib/ruby-lint/iterator.rb +21 -12
- data/lib/ruby-lint/method_call_info.rb +31 -0
- data/lib/ruby-lint/node_hash.rb +105 -0
- data/lib/ruby-lint/parser.rb +4 -2
- data/lib/ruby-lint/runner.rb +62 -6
- data/lib/ruby-lint/template/definition.erb +2 -0
- data/lib/ruby-lint/version.rb +1 -1
- data/lib/ruby-lint/virtual_machine.rb +75 -43
- data/lib/ruby-lint.rb +20 -2
- data/profiling/virtual_machine.rb +20 -0
- data/ruby-lint.gemspec +2 -1
- data/spec/fixtures/complex/rcap.rb +29 -0
- data/spec/fixtures/complex/slop.rb +21 -0
- data/spec/fixtures/file_scanner/lib/ruby-lint/definition/constant_proxy.rb +6 -0
- data/spec/fixtures/file_scanner/lib/ruby-lint/global_scope.rb +6 -0
- data/spec/ruby-lint/analysis/unused_variables_spec.rb +114 -0
- data/spec/ruby-lint/cache_entry_spec.rb +25 -0
- data/spec/ruby-lint/cache_spec.rb +53 -0
- data/spec/ruby-lint/definition/ruby_method_spec.rb +4 -4
- data/spec/ruby-lint/definition/ruby_object_spec.rb +33 -0
- data/spec/ruby-lint/iterator_spec.rb +15 -0
- data/spec/ruby-lint/node_hash_spec.rb +56 -0
- data/spec/ruby-lint/runner_spec.rb +6 -1
- data/spec/ruby-lint/virtual_machine/assignments/variables_spec.rb +2 -2
- data/spec/ruby-lint/virtual_machine/location_spec.rb +64 -0
- data/spec/ruby-lint/virtual_machine/method_call_tracking_spec.rb +64 -0
- data/spec/spec_helper.rb +7 -0
- data/task/generate.rake +1 -1
- data.tar.gz.asc +14 -14
- metadata +34 -7
- metadata.gz.asc +14 -14
- data/debug/memory_usage.rb +0 -14
- data/debug/profile.rb +0 -18
- data/task/profile.rake +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe09b414c536802b61ad8624935086a8a190485e
|
4
|
+
data.tar.gz: 38f69287cc16982dee093653557848a8d2ce940d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e3649eb9b98b1deb98c22e38797295b1016caae028eddf3191e1b871bf0381e5bafd02b8fa6c8cdb38c1a5cf8624f020a7dde85946aeb4752b0c8e9b505ab1
|
7
|
+
data.tar.gz: 3005aaed981fb405931e820a6e757459651112d83126ad5ec83a2be1373157867a7dd1f7da5ca86e5dd3c7f91adec6283f17daa08e094944f9a0661bb956fa7b
|
checksums.yaml.gz.asc
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
-----BEGIN PGP SIGNATURE-----
|
2
|
-
Version: GnuPG v2.0.
|
2
|
+
Version: GnuPG v2.0.22 (GNU/Linux)
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
/
|
16
|
-
=
|
4
|
+
iQIcBAABAgAGBQJSWugYAAoJEPMbESk2SfREECsP/0XuJJCH46m/b8fxkAYUf2M3
|
5
|
+
GdO8/8hMQDBgBRjx6Q1vvebuJNTl6b5AdEo6LnwbZMYURA/7YGzYDjkk7rUsF9WC
|
6
|
+
Zsc5vAfOwGS5bnVpvVqjIiuCt2349lKQyVAmD57270WXKu6QYZJRQ9PQZ+0/BDGQ
|
7
|
+
3X9aOJIURWW1kTRylmYu4ZXHc5s72qGKg2zsJqBcY6GMaeEsv0+578XFuReVcsyY
|
8
|
+
xBxdp4GzLE3cK5E5a5JVwmzE5/TNZr9TzktNgqeGOYldKSdENCGkp8M1MfRhlSaN
|
9
|
+
Hm5bUtPPkpz2bUVKVN0Ipk79d65Nmk3U28MCbKgSx+w2v6nw+AaU0H/9ktLsf8iO
|
10
|
+
q2PLXsk3op/Ds3laTP3OZgKxYoW6jb/Tq4y0sjdcJimZv6ID4BRs95/iCsPsgTi3
|
11
|
+
K8uUhOHWb9wYhwB/WbFjIQcLhblgVStekcIUCMgGYGRt1Mv4rc++gMPVCFNgJ3Qa
|
12
|
+
zraKQcMB6xASwIcUhzkQ/ritgSev66V6q4iXn+sskEwXXzsaK3jvoWp4dDShMl84
|
13
|
+
sKhP+dVdXW7YAjfM1l53YwLvObHaf7u6YbykPv3bKWxrbb9E68OH66x2h1DjBAUR
|
14
|
+
4ssbGFOaXDl6EimYqoWWIaE7FPwt1FMnnoHlXZLOH/zCJkxfnZkLV6PMO8JSpvkV
|
15
|
+
zh8/IQvpvhW1oFlhLYV/
|
16
|
+
=gb/s
|
17
17
|
-----END PGP SIGNATURE-----
|
data/.gitignore
CHANGED
data/.yardopts
CHANGED
data/Gemfile
CHANGED
data/MANIFEST
CHANGED
@@ -8,12 +8,12 @@ LICENSE
|
|
8
8
|
MANIFEST
|
9
9
|
README.md
|
10
10
|
Rakefile
|
11
|
+
benchmark/virtual_machine.rb
|
11
12
|
bin/ruby-lint
|
12
13
|
checksum/.gitkeep
|
13
14
|
checksum/ruby-lint-0.0.3.gem.sha512
|
14
15
|
checksum/ruby-lint-0.0.4.gem.sha512
|
15
|
-
|
16
|
-
debug/profile.rb
|
16
|
+
checksum/ruby-lint-0.0.5.gem.sha512
|
17
17
|
doc/.gitkeep
|
18
18
|
doc/DCO.md
|
19
19
|
doc/architecture.md
|
@@ -35,10 +35,13 @@ lib/ruby-lint/analysis/undefined_variables.rb
|
|
35
35
|
lib/ruby-lint/analysis/unused_variables.rb
|
36
36
|
lib/ruby-lint/ast/builder.rb
|
37
37
|
lib/ruby-lint/ast/node.rb
|
38
|
+
lib/ruby-lint/cache.rb
|
39
|
+
lib/ruby-lint/cache_entry.rb
|
38
40
|
lib/ruby-lint/cli.rb
|
39
41
|
lib/ruby-lint/cli/analyze.rb
|
40
42
|
lib/ruby-lint/cli/ast.rb
|
41
43
|
lib/ruby-lint/cli/base.rb
|
44
|
+
lib/ruby-lint/cli/plot.rb
|
42
45
|
lib/ruby-lint/configuration.rb
|
43
46
|
lib/ruby-lint/constant_loader.rb
|
44
47
|
lib/ruby-lint/default_names.rb
|
@@ -190,6 +193,7 @@ lib/ruby-lint/definitions/core/unsupported_library_error.rb
|
|
190
193
|
lib/ruby-lint/definitions/core/weak_ref.rb
|
191
194
|
lib/ruby-lint/definitions/core/yaml.rb
|
192
195
|
lib/ruby-lint/definitions/core/zero_division_error.rb
|
196
|
+
lib/ruby-lint/definitions/core/zlib.rb
|
193
197
|
lib/ruby-lint/definitions/global_variables.rb
|
194
198
|
lib/ruby-lint/definitions/rails.rb
|
195
199
|
lib/ruby-lint/definitions/rails/abstract_controller.rb
|
@@ -222,7 +226,9 @@ lib/ruby-lint/method_call/attribute.rb
|
|
222
226
|
lib/ruby-lint/method_call/base.rb
|
223
227
|
lib/ruby-lint/method_call/define_method.rb
|
224
228
|
lib/ruby-lint/method_call/include.rb
|
229
|
+
lib/ruby-lint/method_call_info.rb
|
225
230
|
lib/ruby-lint/nested_stack.rb
|
231
|
+
lib/ruby-lint/node_hash.rb
|
226
232
|
lib/ruby-lint/parser.rb
|
227
233
|
lib/ruby-lint/presenter/json.rb
|
228
234
|
lib/ruby-lint/presenter/text.rb
|
@@ -234,6 +240,7 @@ lib/ruby-lint/template/scope.rb
|
|
234
240
|
lib/ruby-lint/variable_predicates.rb
|
235
241
|
lib/ruby-lint/version.rb
|
236
242
|
lib/ruby-lint/virtual_machine.rb
|
243
|
+
profiling/virtual_machine.rb
|
237
244
|
ruby-lint.gemspec
|
238
245
|
ruby-lint.yml
|
239
246
|
spec/fixtures/associating.rb
|
@@ -244,6 +251,8 @@ spec/fixtures/config.yml
|
|
244
251
|
spec/fixtures/file_scanner/lib/example/recursive/source.rb
|
245
252
|
spec/fixtures/file_scanner/lib/example/recursive/target.rb
|
246
253
|
spec/fixtures/file_scanner/lib/example/user.rb
|
254
|
+
spec/fixtures/file_scanner/lib/ruby-lint/definition/constant_proxy.rb
|
255
|
+
spec/fixtures/file_scanner/lib/ruby-lint/global_scope.rb
|
247
256
|
spec/fixtures/file_scanner/lib/test-dashes/foo.rb
|
248
257
|
spec/fixtures/file_scanner/rails/app/models/example/user.rb
|
249
258
|
spec/fixtures/file_scanner/rails/app/models/user.rb
|
@@ -262,6 +271,8 @@ spec/ruby-lint/analysis/undefined_methods_spec.rb
|
|
262
271
|
spec/ruby-lint/analysis/undefined_variables_spec.rb
|
263
272
|
spec/ruby-lint/analysis/unused_variables_spec.rb
|
264
273
|
spec/ruby-lint/ast/node_spec.rb
|
274
|
+
spec/ruby-lint/cache_entry_spec.rb
|
275
|
+
spec/ruby-lint/cache_spec.rb
|
265
276
|
spec/ruby-lint/cli/analyze_spec.rb
|
266
277
|
spec/ruby-lint/cli/ast_spec.rb
|
267
278
|
spec/ruby-lint/configuration_spec.rb
|
@@ -281,6 +292,7 @@ spec/ruby-lint/file_scanner_spec.rb
|
|
281
292
|
spec/ruby-lint/inspector_spec.rb
|
282
293
|
spec/ruby-lint/iterator_spec.rb
|
283
294
|
spec/ruby-lint/nested_stack_spec.rb
|
295
|
+
spec/ruby-lint/node_hash_spec.rb
|
284
296
|
spec/ruby-lint/parser_spec.rb
|
285
297
|
spec/ruby-lint/presenter/json_spec.rb
|
286
298
|
spec/ruby-lint/presenter/text_spec.rb
|
@@ -310,6 +322,8 @@ spec/ruby-lint/virtual_machine/freeze_spec.rb
|
|
310
322
|
spec/ruby-lint/virtual_machine/global_variables_spec.rb
|
311
323
|
spec/ruby-lint/virtual_machine/inherit_kernel_spec.rb
|
312
324
|
spec/ruby-lint/virtual_machine/interpolation_spec.rb
|
325
|
+
spec/ruby-lint/virtual_machine/location_spec.rb
|
326
|
+
spec/ruby-lint/virtual_machine/method_call_tracking_spec.rb
|
313
327
|
spec/ruby-lint/virtual_machine/methods/attr_spec.rb
|
314
328
|
spec/ruby-lint/virtual_machine/methods/define_method_spec.rb
|
315
329
|
spec/ruby-lint/virtual_machine/methods/defining_spec.rb
|
@@ -337,7 +351,6 @@ task/doc.rake
|
|
337
351
|
task/generate.rake
|
338
352
|
task/graphviz.rake
|
339
353
|
task/manifest.rake
|
340
|
-
task/profile.rake
|
341
354
|
task/tag.rake
|
342
355
|
task/test.rake
|
343
356
|
task/todo.rake
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This benchmarks N runs of the VM and outputs them to the console making it
|
2
|
+
# easy to pass the data to tools such as `ministat`
|
3
|
+
# (http://www.freebsd.org/cgi/man.cgi?ministat).
|
4
|
+
|
5
|
+
require_relative '../lib/ruby-lint'
|
6
|
+
require 'benchmark'
|
7
|
+
|
8
|
+
parser = RubyLint::Parser.new
|
9
|
+
file = File.expand_path('../../lib/ruby-lint/virtual_machine.rb', __FILE__)
|
10
|
+
ast = parser.parse(File.read(file), file)
|
11
|
+
amount = 1000
|
12
|
+
|
13
|
+
amount.times do
|
14
|
+
timing = Benchmark.measure { RubyLint::VirtualMachine.new.run(ast) }
|
15
|
+
|
16
|
+
puts timing.real
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
dcc8326dec9cc6bdfdcf19e73a1f69172ffcdf4105be974ab644af00a44cd08306569d1001fe5a680e1ed5158bd2b73be6af801df096a037e7e06fcc116dd086
|
data/doc/changelog.md
CHANGED
@@ -5,6 +5,47 @@ This document contains a short summary of the various releases of ruby-lint.
|
|
5
5
|
For a full list of commits included in each release see the corresponding Git
|
6
6
|
tags (named after the versions).
|
7
7
|
|
8
|
+
## 0.9.0 - 2013-10-13
|
9
|
+
|
10
|
+
Although the version number increased by quite a bit this release in itself is
|
11
|
+
fairly small. Seeing how the ruby-lint internals are slowly becoming more and
|
12
|
+
more stable I'd like the version numbers to correspond with that. I'm not
|
13
|
+
jumping to 1.0 right away since I do want to make various changes to the
|
14
|
+
internals before I release 1.0.
|
15
|
+
|
16
|
+
Having said that, this release contains the following:
|
17
|
+
|
18
|
+
* Caching of ASTs required for finding externally defined constants.
|
19
|
+
* An extra CLI command (`plot`) for plotting analysis timings.
|
20
|
+
* Method call tracking.
|
21
|
+
* Warnings for unused method/block arguments.
|
22
|
+
* Support for Rubinius 2.0.
|
23
|
+
|
24
|
+
The two most noteworthy changes are the caching system and support for method
|
25
|
+
call tracking, these are highlighted below.
|
26
|
+
|
27
|
+
### Caching
|
28
|
+
|
29
|
+
In previous releases ruby-lint would re-parse extra files needed (those that
|
30
|
+
contain the definitions of referenced constants) every time you'd analyze a
|
31
|
+
file. This was rather problematic since [parser][parser] sadly isn't the
|
32
|
+
fastest kid on the block. By caching the resulting ASTs performance of the same
|
33
|
+
file (assuming it doesn't change between runs) can be increased drastically. If
|
34
|
+
the analyzed file or an external one is changed the cache is invalidated
|
35
|
+
automatically.
|
36
|
+
|
37
|
+
Caching is enabled by default so you don't need to add any extra command-line
|
38
|
+
flags or configuration options in your ruby-lint configuration file.
|
39
|
+
|
40
|
+
### Method Call Tracking
|
41
|
+
|
42
|
+
This new features makes it possible for ruby-lint to keep track of what methods
|
43
|
+
are called from another method, both in the direction of caller to callee and
|
44
|
+
the other way around. Currently this isn't used yet for any analysis but I have
|
45
|
+
some ideas on adding useful analysis using this new feature. Another use case
|
46
|
+
for this feature is generating Graphviz call graphs without actually having to
|
47
|
+
run the corresponding Ruby source code.
|
48
|
+
|
8
49
|
## 0.0.5 - 2013-09-01
|
9
50
|
|
10
51
|
Originally slated for August 1st I decided to push this release back one month
|
@@ -121,3 +162,4 @@ Various changes to the old parser.
|
|
121
162
|
First public release of ruby-lint.
|
122
163
|
|
123
164
|
[yard]: http://yardoc.org/
|
165
|
+
[parser]: https://github.com/whitequark/parser
|
data/doc/configuration.md
CHANGED
@@ -33,25 +33,145 @@ fallback.
|
|
33
33
|
|
34
34
|
## Configuring ruby-lint
|
35
35
|
|
36
|
-
Configuration
|
36
|
+
Configuration files are simple YAML files. An example of such a configuration
|
37
|
+
file is the following:
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
---
|
40
|
+
directories:
|
41
|
+
- lib
|
42
|
+
|
43
|
+
ignore_paths:
|
44
|
+
- lib/ruby-lint/definitions
|
45
|
+
- lib/ruby-lint/cli
|
46
|
+
|
47
|
+
### requires
|
48
|
+
|
49
|
+
The `requires` option can be used to specify a list of Ruby files that should
|
50
|
+
be loaded before analysis is performed. The primary use case of this option is
|
51
|
+
to load extra definitions that don't come with ruby-lint by default.
|
43
52
|
|
44
|
-
|
53
|
+
Example:
|
45
54
|
|
46
55
|
---
|
47
56
|
requires:
|
48
|
-
- ruby-lint/definitions/
|
57
|
+
- ruby-lint/definitions/rails
|
58
|
+
|
59
|
+
By default this option is left empty.
|
60
|
+
|
61
|
+
### report_levels
|
62
|
+
|
63
|
+
The `report_levels` option can be used to specify a list of the enabled
|
64
|
+
reporting levels. The following levels are currently available:
|
65
|
+
|
66
|
+
* info
|
67
|
+
* warning
|
68
|
+
* error
|
69
|
+
|
70
|
+
By default all of these are enabled.
|
71
|
+
|
72
|
+
Example:
|
73
|
+
|
74
|
+
---
|
49
75
|
report_levels:
|
76
|
+
- warning
|
50
77
|
- error
|
78
|
+
|
79
|
+
### presenter
|
80
|
+
|
81
|
+
The short, human readable name of the presenter to use for displaying the
|
82
|
+
analysis results. The following presenters are currently available:
|
83
|
+
|
84
|
+
* text
|
85
|
+
* json
|
86
|
+
|
87
|
+
The default presenter is `text`.
|
88
|
+
|
89
|
+
Example:
|
90
|
+
|
91
|
+
---
|
92
|
+
presenter: text
|
93
|
+
|
94
|
+
### analysis_classes
|
95
|
+
|
96
|
+
A list of the short, human readable names of the analysis classes to enable.
|
97
|
+
The following analysis classes are currently available:
|
98
|
+
|
99
|
+
* `argument_amount`
|
100
|
+
* `pedantics`
|
101
|
+
* `shadowing_variables`
|
102
|
+
* `undefined_methods`
|
103
|
+
* `undefined_variables`
|
104
|
+
* `unused_variables`
|
105
|
+
|
106
|
+
By default all of these are enabled.
|
107
|
+
|
108
|
+
Example:
|
109
|
+
|
110
|
+
---
|
51
111
|
analysis_classes:
|
52
|
-
-
|
53
|
-
-
|
54
|
-
|
112
|
+
- argument_amount
|
113
|
+
- pedantics
|
114
|
+
|
115
|
+
### directories
|
55
116
|
|
56
|
-
|
57
|
-
|
117
|
+
A list of directories to search in for externally defined constants. By
|
118
|
+
default this is set to the current working directory which, for big projects,
|
119
|
+
can slow things down.
|
120
|
+
|
121
|
+
Example:
|
122
|
+
|
123
|
+
---
|
124
|
+
directories:
|
125
|
+
- app
|
126
|
+
- lib
|
127
|
+
|
128
|
+
### debug
|
129
|
+
|
130
|
+
A boolean that indicates that debugging mode should be enabled or disabled, by
|
131
|
+
default this is disabled.
|
132
|
+
|
133
|
+
Example:
|
134
|
+
|
135
|
+
---
|
136
|
+
debug: true
|
137
|
+
|
138
|
+
### ignore_paths
|
139
|
+
|
140
|
+
A list of patterns to apply to the `directories` option to filter out unwanted
|
141
|
+
directories. For example, you could use this to search for files in the lib/
|
142
|
+
directory but exclude lib/foo/bar:
|
143
|
+
|
144
|
+
---
|
145
|
+
directories:
|
146
|
+
- lib
|
147
|
+
|
148
|
+
ignore_paths:
|
149
|
+
- lib/foo/bar
|
150
|
+
|
151
|
+
Example:
|
152
|
+
|
153
|
+
---
|
154
|
+
ignore_paths:
|
155
|
+
- lib/ruby-lint/definitions
|
156
|
+
|
157
|
+
### enable_cache
|
158
|
+
|
159
|
+
A boolean that indicates that caching should be enabled or disabled, by default
|
160
|
+
this is enabled. Disabling caching can slow down ruby-lint considerably.
|
161
|
+
|
162
|
+
Example:
|
163
|
+
|
164
|
+
---
|
165
|
+
enable_cache: true
|
166
|
+
|
167
|
+
### cache_directory
|
168
|
+
|
169
|
+
The directory to store cache files in if caching is enabled. By default this is
|
170
|
+
set to `$XDG_CACHE_HOME/ruby-lint` or `$HOME/.cache/ruby-lint` if the former
|
171
|
+
variable isn't set. If the cache directory doesn't exist it's created
|
172
|
+
automatically.
|
173
|
+
|
174
|
+
Example:
|
175
|
+
|
176
|
+
---
|
177
|
+
cache_directory: ~/ruby-lint
|
@@ -17,28 +17,22 @@ module RubyLint
|
|
17
17
|
# @param [RubyLint::AST::Node] node
|
18
18
|
#
|
19
19
|
def on_block(node)
|
20
|
-
|
21
|
-
@in_block = true
|
20
|
+
arguments = node.children[1].children
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
##
|
27
|
-
# @param [RubyLint::AST::Node] node
|
28
|
-
#
|
29
|
-
def after_block(node)
|
30
|
-
@in_block = false
|
31
|
-
@outer_scope = nil
|
22
|
+
arguments.each do |arg|
|
23
|
+
validate_argument(arg)
|
24
|
+
end
|
32
25
|
|
33
26
|
super
|
34
27
|
end
|
35
28
|
|
29
|
+
private
|
30
|
+
|
36
31
|
##
|
37
32
|
# @param [RubyLint::AST::Node] node
|
38
33
|
#
|
39
|
-
def
|
40
|
-
if
|
41
|
-
and @outer_scope.has_definition?(:lvar, node.name)
|
34
|
+
def validate_argument(node)
|
35
|
+
if current_scope.has_definition?(:lvar, node.name)
|
42
36
|
warning("shadowing outer local variable #{node.name}", node)
|
43
37
|
end
|
44
38
|
end
|
@@ -57,8 +57,25 @@ module RubyLint
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
VirtualMachine::ARGUMENT_TYPES.each do |name|
|
61
|
+
define_method("on_#{name}") { |node| verify_argument(node) }
|
62
|
+
end
|
63
|
+
|
60
64
|
private
|
61
65
|
|
66
|
+
##
|
67
|
+
# Adds warnings for unused method arguments.
|
68
|
+
#
|
69
|
+
# @param [RubyLint::AST::Node] node
|
70
|
+
#
|
71
|
+
def verify_argument(node)
|
72
|
+
variable = current_scope.lookup(:lvar, node.name)
|
73
|
+
|
74
|
+
if add_warning?(variable)
|
75
|
+
warning("unused argument #{variable.name}", node)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
62
79
|
##
|
63
80
|
# @param [RubyLint::Definition::RubyObject] variable
|
64
81
|
# @return [TrueClass|FalseClass]
|