ruby-lint 1.0.3 → 1.1.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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -5
- data/Gemfile +9 -4
- data/MANIFEST +32 -28
- data/README.md +18 -5
- data/Rakefile +7 -3
- data/checksum/ruby-lint-1.0.2.gem.sha512 +1 -0
- data/checksum/ruby-lint-1.0.3.gem.sha512 +1 -0
- data/doc/changelog.md +40 -0
- data/doc/definitions.md +182 -0
- data/gen/rails/constants.txt +12 -0
- data/gen/rails/requires.rb +2 -0
- data/gen/stdlib/constants.rb +30 -0
- data/gen/stdlib/constants.txt +214 -0
- data/gen/stdlib/requires.rb +64 -0
- data/lib/ruby-lint.rb +7 -14
- data/lib/ruby-lint/analysis/undefined_methods.rb +8 -1
- data/lib/ruby-lint/analysis/useless_equality_checks.rb +92 -0
- data/lib/ruby-lint/cli.rb +1 -2
- data/lib/ruby-lint/cli/analyze.rb +55 -26
- data/lib/ruby-lint/cli/cache.rb +60 -0
- data/lib/ruby-lint/configuration.rb +10 -4
- data/lib/ruby-lint/constant_loader.rb +75 -22
- data/lib/ruby-lint/definition/constant_proxy.rb +51 -3
- data/lib/ruby-lint/definition/registry.rb +126 -0
- data/lib/ruby-lint/definition/ruby_method.rb +0 -11
- data/lib/ruby-lint/definition/ruby_object.rb +32 -24
- data/lib/ruby-lint/definition_builder/base.rb +9 -12
- data/lib/ruby-lint/definition_builder/primitive.rb +1 -1
- data/lib/ruby-lint/definition_builder/ruby_array.rb +1 -1
- data/lib/ruby-lint/definition_builder/ruby_block.rb +3 -3
- data/lib/ruby-lint/definition_builder/ruby_class.rb +2 -2
- data/lib/ruby-lint/definition_builder/ruby_hash.rb +1 -1
- data/lib/ruby-lint/definition_builder/ruby_method.rb +1 -1
- data/lib/ruby-lint/definition_builder/ruby_module.rb +4 -4
- data/lib/ruby-lint/definition_generator.rb +12 -2
- data/lib/ruby-lint/definitions/core/abbrev.rb +8 -11
- data/lib/ruby-lint/definitions/core/argf.rb +9 -7
- data/lib/ruby-lint/definitions/core/argument_error.rb +8 -10
- data/lib/ruby-lint/definitions/core/argv.rb +9 -9
- data/lib/ruby-lint/definitions/core/array.rb +296 -534
- data/lib/ruby-lint/definitions/core/base64.rb +22 -25
- data/lib/ruby-lint/definitions/core/basic_object.rb +30 -30
- data/lib/ruby-lint/definitions/core/basic_socket.rb +341 -455
- data/lib/ruby-lint/definitions/core/benchmark.rb +157 -24
- data/lib/ruby-lint/definitions/core/bignum.rb +110 -95
- data/lib/ruby-lint/definitions/core/binding.rb +38 -35
- data/lib/ruby-lint/definitions/core/cgi.rb +333 -49
- data/lib/ruby-lint/definitions/core/class.rb +16 -16
- data/lib/ruby-lint/definitions/core/common_headers.rb +4 -548
- data/lib/ruby-lint/definitions/core/common_libs.rb +4 -421
- data/lib/ruby-lint/definitions/core/comparable.rb +28 -29
- data/lib/ruby-lint/definitions/core/complex.rb +103 -141
- data/lib/ruby-lint/definitions/core/condition_variable.rb +14 -14
- data/lib/ruby-lint/definitions/core/config.rb +4 -318
- data/lib/ruby-lint/definitions/core/conftest_c.rb +4 -548
- data/lib/ruby-lint/definitions/core/coutflag.rb +4 -548
- data/lib/ruby-lint/definitions/core/csv.rb +729 -329
- data/lib/ruby-lint/definitions/core/data.rb +9 -8
- data/lib/ruby-lint/definitions/core/date.rb +452 -526
- data/lib/ruby-lint/definitions/core/date_time.rb +234 -303
- data/lib/ruby-lint/definitions/core/delegator.rb +57 -48
- data/lib/ruby-lint/definitions/core/digest.rb +94 -115
- data/lib/ruby-lint/definitions/core/dir.rb +89 -459
- data/lib/ruby-lint/definitions/core/drb.rb +531 -36
- data/lib/ruby-lint/definitions/core/drb_id_conv.rb +10 -19
- data/lib/ruby-lint/definitions/core/drb_object.rb +53 -58
- data/lib/ruby-lint/definitions/core/drb_undumped.rb +7 -10
- data/lib/ruby-lint/definitions/core/encoding.rb +1026 -1718
- data/lib/ruby-lint/definitions/core/encoding_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/enumerable.rb +123 -292
- data/lib/ruby-lint/definitions/core/enumerator.rb +28 -26
- data/lib/ruby-lint/definitions/core/env.rb +8 -9
- data/lib/ruby-lint/definitions/core/eoferror.rb +9 -8
- data/lib/ruby-lint/definitions/core/erb.rb +201 -226
- data/lib/ruby-lint/definitions/core/errno.rb +1593 -2917
- data/lib/ruby-lint/definitions/core/etc.rb +86 -107
- data/lib/ruby-lint/definitions/core/exception.rb +70 -50
- data/lib/ruby-lint/definitions/core/exception_for_matrix.rb +24 -37
- data/lib/ruby-lint/definitions/core/export_prefix.rb +4 -16
- data/lib/ruby-lint/definitions/core/failed_message.rb +4 -548
- data/lib/ruby-lint/definitions/core/false.rb +9 -7
- data/lib/ruby-lint/definitions/core/false_class.rb +40 -22
- data/lib/ruby-lint/definitions/core/fcntl.rb +120 -7
- data/lib/ruby-lint/definitions/core/fiber.rb +25 -26
- data/lib/ruby-lint/definitions/core/fiber_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/file.rb +1119 -860
- data/lib/ruby-lint/definitions/core/file_test.rb +79 -80
- data/lib/ruby-lint/definitions/core/file_utils.rb +1203 -765
- data/lib/ruby-lint/definitions/core/find.rb +9 -12
- data/lib/ruby-lint/definitions/core/fixnum.rb +113 -663
- data/lib/ruby-lint/definitions/core/float.rb +171 -2755
- data/lib/ruby-lint/definitions/core/float_domain_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/forwardable.rb +37 -30
- data/lib/ruby-lint/definitions/core/gc.rb +31 -38
- data/lib/ruby-lint/definitions/core/gem.rb +2324 -2183
- data/lib/ruby-lint/definitions/core/getopt_long.rb +107 -32
- data/lib/ruby-lint/definitions/core/gserver.rb +61 -61
- data/lib/ruby-lint/definitions/core/hash.rb +354 -1172
- data/lib/ruby-lint/definitions/core/hdr_ext.rb +4 -421
- data/lib/ruby-lint/definitions/core/index_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/install_dirs.rb +4 -421
- data/lib/ruby-lint/definitions/core/integer.rb +93 -67
- data/lib/ruby-lint/definitions/core/interrupt.rb +11 -11
- data/lib/ruby-lint/definitions/core/io.rb +574 -673
- data/lib/ruby-lint/definitions/core/ioerror.rb +9 -8
- data/lib/ruby-lint/definitions/core/ipaddr.rb +115 -90
- data/lib/ruby-lint/definitions/core/ipsocket.rb +301 -472
- data/lib/ruby-lint/definitions/core/irb.rb +1206 -34
- data/lib/ruby-lint/definitions/core/json.rb +483 -74
- data/lib/ruby-lint/definitions/core/kconv.rb +88 -36
- data/lib/ruby-lint/definitions/core/kernel.rb +408 -412
- data/lib/ruby-lint/definitions/core/key_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/libarg.rb +4 -548
- data/lib/ruby-lint/definitions/core/libpathflag.rb +4 -548
- data/lib/ruby-lint/definitions/core/link_so.rb +4 -548
- data/lib/ruby-lint/definitions/core/load_error.rb +24 -25
- data/lib/ruby-lint/definitions/core/local_jump_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/logger.rb +294 -61
- data/lib/ruby-lint/definitions/core/logging.rb +17 -20
- data/lib/ruby-lint/definitions/core/make_makefile.rb +548 -384
- data/lib/ruby-lint/definitions/core/marshal.rb +260 -358
- data/lib/ruby-lint/definitions/core/match_data.rb +51 -48
- data/lib/ruby-lint/definitions/core/math.rb +170 -178
- data/lib/ruby-lint/definitions/core/matrix.rb +354 -297
- data/lib/ruby-lint/definitions/core/method.rb +41 -42
- data/lib/ruby-lint/definitions/core/module.rb +219 -223
- data/lib/ruby-lint/definitions/core/monitor.rb +26 -28
- data/lib/ruby-lint/definitions/core/monitor_mixin.rb +36 -42
- data/lib/ruby-lint/definitions/core/mutex.rb +20 -22
- data/lib/ruby-lint/definitions/core/mutex_m.rb +24 -27
- data/lib/ruby-lint/definitions/core/name_error.rb +13 -13
- data/lib/ruby-lint/definitions/core/nil.rb +9 -7
- data/lib/ruby-lint/definitions/core/nil_class.rb +47 -31
- data/lib/ruby-lint/definitions/core/nkf.rb +76 -9
- data/lib/ruby-lint/definitions/core/no_memory_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/no_method_error.rb +14 -14
- data/lib/ruby-lint/definitions/core/not_implemented_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/numeric.rb +88 -80
- data/lib/ruby-lint/definitions/core/object.rb +20 -20
- data/lib/ruby-lint/definitions/core/object_space.rb +28 -31
- data/lib/ruby-lint/definitions/core/observable.rb +20 -23
- data/lib/ruby-lint/definitions/core/open3.rb +47 -50
- data/lib/ruby-lint/definitions/core/open_ssl.rb +4158 -13
- data/lib/ruby-lint/definitions/core/open_struct.rb +40 -37
- data/lib/ruby-lint/definitions/core/open_uri.rb +142 -25
- data/lib/ruby-lint/definitions/core/option_parser.rb +919 -981
- data/lib/ruby-lint/definitions/core/orig_libpath.rb +4 -32
- data/lib/ruby-lint/definitions/core/outflag.rb +4 -548
- data/lib/ruby-lint/definitions/core/pathname.rb +211 -186
- data/lib/ruby-lint/definitions/core/pp.rb +160 -99
- data/lib/ruby-lint/definitions/core/pretty_print.rb +170 -56
- data/lib/ruby-lint/definitions/core/prime.rb +329 -234
- data/lib/ruby-lint/definitions/core/proc.rb +63 -75
- data/lib/ruby-lint/definitions/core/process.rb +504 -412
- data/lib/ruby-lint/definitions/core/profiler__.rb +13 -16
- data/lib/ruby-lint/definitions/core/pstore.rb +66 -36
- data/lib/ruby-lint/definitions/core/queue.rb +32 -32
- data/lib/ruby-lint/definitions/core/random.rb +29 -29
- data/lib/ruby-lint/definitions/core/range.rb +123 -77
- data/lib/ruby-lint/definitions/core/range_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/rational.rb +84 -67
- data/lib/ruby-lint/definitions/core/rb_config.rb +18 -29
- data/lib/ruby-lint/definitions/core/readline.rb +85 -41
- data/lib/ruby-lint/definitions/core/regexp.rb +239 -293
- data/lib/ruby-lint/definitions/core/regexp_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/resolv.rb +1365 -38
- data/lib/ruby-lint/definitions/core/rpathflag.rb +4 -548
- data/lib/ruby-lint/definitions/core/ruby_copyright.rb +9 -9
- data/lib/ruby-lint/definitions/core/ruby_description.rb +9 -9
- data/lib/ruby-lint/definitions/core/ruby_engine.rb +9 -9
- data/lib/ruby-lint/definitions/core/ruby_patchlevel.rb +9 -9
- data/lib/ruby-lint/definitions/core/ruby_platform.rb +9 -9
- data/lib/ruby-lint/definitions/core/ruby_release_date.rb +9 -9
- data/lib/ruby-lint/definitions/core/ruby_revision.rb +4 -246
- data/lib/ruby-lint/definitions/core/ruby_version.rb +9 -9
- data/lib/ruby-lint/definitions/core/runtime_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/scan_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/scanf.rb +83 -7
- data/lib/ruby-lint/definitions/core/script_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/secure_random.rb +22 -25
- data/lib/ruby-lint/definitions/core/security_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/set.rb +154 -504
- data/lib/ruby-lint/definitions/core/shellwords.rb +27 -28
- data/lib/ruby-lint/definitions/core/signal.rb +21 -29
- data/lib/ruby-lint/definitions/core/signal_exception.rb +15 -15
- data/lib/ruby-lint/definitions/core/simple_delegator.rb +10 -26
- data/lib/ruby-lint/definitions/core/single_forwardable.rb +35 -38
- data/lib/ruby-lint/definitions/core/singleton.rb +21 -28
- data/lib/ruby-lint/definitions/core/sized_queue.rb +35 -31
- data/lib/ruby-lint/definitions/core/socket.rb +2942 -438
- data/lib/ruby-lint/definitions/core/socket_error.rb +4 -54
- data/lib/ruby-lint/definitions/core/sorted_set.rb +49 -263
- data/lib/ruby-lint/definitions/core/src_ext.rb +4 -421
- data/lib/ruby-lint/definitions/core/standard_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/stderr.rb +9 -9
- data/lib/ruby-lint/definitions/core/stdin.rb +9 -9
- data/lib/ruby-lint/definitions/core/stdout.rb +9 -9
- data/lib/ruby-lint/definitions/core/stop_iteration.rb +10 -8
- data/lib/ruby-lint/definitions/core/string.rb +451 -1222
- data/lib/ruby-lint/definitions/core/string_io.rb +226 -518
- data/lib/ruby-lint/definitions/core/string_scanner.rb +107 -108
- data/lib/ruby-lint/definitions/core/struct.rb +113 -761
- data/lib/ruby-lint/definitions/core/syck.rb +1292 -25
- data/lib/ruby-lint/definitions/core/symbol.rb +78 -59
- data/lib/ruby-lint/definitions/core/syntax_error.rb +23 -33
- data/lib/ruby-lint/definitions/core/system_call_error.rb +26 -24
- data/lib/ruby-lint/definitions/core/system_exit.rb +15 -15
- data/lib/ruby-lint/definitions/core/system_stack_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/tcpserver.rb +291 -486
- data/lib/ruby-lint/definitions/core/tcpsocket.rb +302 -483
- data/lib/ruby-lint/definitions/core/tempfile.rb +39 -832
- data/lib/ruby-lint/definitions/core/th_wait.rb +35 -70
- data/lib/ruby-lint/definitions/core/thread.rb +131 -144
- data/lib/ruby-lint/definitions/core/thread_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/thread_group.rb +23 -16
- data/lib/ruby-lint/definitions/core/threads_wait.rb +43 -63
- data/lib/ruby-lint/definitions/core/time.rb +236 -159
- data/lib/ruby-lint/definitions/core/timeout.rb +40 -14
- data/lib/ruby-lint/definitions/core/timeout_error.rb +4 -54
- data/lib/ruby-lint/definitions/core/toplevel_binding.rb +9 -7
- data/lib/ruby-lint/definitions/core/true.rb +9 -7
- data/lib/ruby-lint/definitions/core/true_class.rb +40 -22
- data/lib/ruby-lint/definitions/core/try_link.rb +4 -548
- data/lib/ruby-lint/definitions/core/tsort.rb +21 -19
- data/lib/ruby-lint/definitions/core/type_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/udpsocket.rb +302 -487
- data/lib/ruby-lint/definitions/core/unbound_method.rb +35 -36
- data/lib/ruby-lint/definitions/core/universal_ints.rb +4 -421
- data/lib/ruby-lint/definitions/core/unixserver.rb +291 -490
- data/lib/ruby-lint/definitions/core/unixsocket.rb +314 -476
- data/lib/ruby-lint/definitions/core/uri.rb +1309 -38
- data/lib/ruby-lint/definitions/core/vector.rb +143 -242
- data/lib/ruby-lint/definitions/core/weak_ref.rb +29 -32
- data/lib/ruby-lint/definitions/core/webrick.rb +2430 -7
- data/lib/ruby-lint/definitions/core/xmlrpc.rb +5 -7
- data/lib/ruby-lint/definitions/core/yaml.rb +109 -2325
- data/lib/ruby-lint/definitions/core/zero_division_error.rb +9 -8
- data/lib/ruby-lint/definitions/core/zlib.rb +272 -8526
- data/lib/ruby-lint/definitions/gems/.gitkeep +0 -0
- data/lib/ruby-lint/definitions/gems/devise.rb +2271 -0
- data/lib/ruby-lint/definitions/gems/nokogiri.rb +7668 -0
- data/lib/ruby-lint/definitions/rails/abstract_controller.rb +508 -322
- data/lib/ruby-lint/definitions/rails/action_controller.rb +2252 -4462
- data/lib/ruby-lint/definitions/rails/action_dispatch.rb +3448 -1846
- data/lib/ruby-lint/definitions/rails/action_mailer.rb +750 -1349
- data/lib/ruby-lint/definitions/rails/action_pack.rb +31 -14
- data/lib/ruby-lint/definitions/rails/action_view.rb +5788 -5748
- data/lib/ruby-lint/definitions/rails/active_model.rb +1015 -1065
- data/lib/ruby-lint/definitions/rails/active_record.rb +8080 -8075
- data/lib/ruby-lint/definitions/rails/active_support.rb +3844 -4153
- data/lib/ruby-lint/definitions/rails/arel.rb +6752 -2301
- data/lib/ruby-lint/definitions/rails/rails.rb +1553 -2383
- data/lib/ruby-lint/definitions/rails/sprockets.rb +1131 -3140
- data/lib/ruby-lint/file_list.rb +43 -0
- data/lib/ruby-lint/file_scanner.rb +3 -3
- data/lib/ruby-lint/generated_constant.rb +5 -1
- data/lib/ruby-lint/inspector.rb +108 -46
- data/lib/ruby-lint/method_call/attribute.rb +3 -1
- data/lib/ruby-lint/rake_task.rb +98 -0
- data/lib/ruby-lint/ruby_lint.rb +11 -0
- data/lib/ruby-lint/runner.rb +0 -11
- data/lib/ruby-lint/template/definition.erb +26 -19
- data/lib/ruby-lint/template/scope.rb +12 -0
- data/lib/ruby-lint/variable_predicates.rb +14 -0
- data/lib/ruby-lint/version.rb +1 -1
- data/lib/ruby-lint/virtual_machine.rb +82 -46
- data/ruby-lint.gemspec +3 -14
- data/spec/ruby-lint/analysis/undefined_methods_spec.rb +20 -3
- data/spec/ruby-lint/analysis/useless_equality_checks_spec.rb +107 -0
- data/spec/ruby-lint/configuration_spec.rb +20 -0
- data/spec/ruby-lint/constant_loader_spec.rb +79 -0
- data/spec/ruby-lint/definition/constant_proxy_spec.rb +65 -34
- data/spec/ruby-lint/definition/registry_spec.rb +106 -0
- data/spec/ruby-lint/definition/ruby_object_spec.rb +25 -25
- data/spec/ruby-lint/definition_builder/primitive_spec.rb +10 -10
- data/spec/ruby-lint/definition_builder/ruby_class_spec.rb +18 -19
- data/spec/ruby-lint/definition_builder/ruby_method_spec.rb +12 -12
- data/spec/ruby-lint/definition_builder/ruby_module_spec.rb +14 -14
- data/spec/ruby-lint/definitions/argv_spec.rb +3 -2
- data/spec/ruby-lint/definitions/env_spec.rb +5 -3
- data/spec/ruby-lint/definitions/file_spec.rb +17 -0
- data/spec/ruby-lint/definitions/fixnum_spec.rb +18 -0
- data/spec/ruby-lint/definitions/io_spec.rb +5 -3
- data/spec/ruby-lint/definitions/kernel_spec.rb +18 -0
- data/spec/ruby-lint/definitions/range_spec.rb +21 -0
- data/spec/ruby-lint/definitions/string_spec.rb +20 -0
- data/spec/ruby-lint/file_list_spec.rb +25 -0
- data/spec/ruby-lint/file_scanner_spec.rb +12 -0
- data/spec/ruby-lint/inspector_spec.rb +203 -23
- data/spec/ruby-lint/method_call/.gitkeep +0 -0
- data/spec/ruby-lint/variable_predicates_spec.rb +30 -0
- data/spec/ruby-lint/virtual_machine/associate_nodes_spec.rb +6 -4
- data/spec/ruby-lint/virtual_machine/autoloading_spec.rb +3 -16
- data/spec/ruby-lint/virtual_machine/classes/redefining_spec.rb +28 -1
- data/spec/ruby-lint/virtual_machine/complex/rails_spec.rb +12 -9
- data/spec/ruby-lint/virtual_machine/global_variables_spec.rb +8 -5
- data/spec/ruby-lint/virtual_machine/method_call_tracking_spec.rb +0 -7
- data/spec/ruby-lint/virtual_machine/methods/attr_spec.rb +66 -0
- data/spec/ruby-lint/virtual_machine/methods/calls_spec.rb +25 -0
- data/spec/ruby-lint/virtual_machine/methods/define_method_spec.rb +1 -1
- data/spec/ruby-lint/virtual_machine/methods/docstrings_spec.rb +20 -9
- data/spec/ruby-lint/virtual_machine/methods/kernel_spec.rb +25 -0
- data/spec/ruby-lint/virtual_machine/methods/patching_spec.rb +0 -6
- data/spec/ruby-lint/virtual_machine/methods/square_bracket_spec.rb +32 -0
- data/spec/ruby-lint/virtual_machine/self_spec.rb +37 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/support/building.rb +0 -4
- data/spec/support/definitions.rb +16 -0
- data/task/generate.rake +35 -33
- data/task/todo.rake +1 -1
- metadata +73 -100
- data/lib/ruby-lint/cli/ast.rb +0 -50
- data/lib/ruby-lint/cli/plot.rb +0 -94
- data/lib/ruby-lint/definitions/core/arg0.rb +0 -9
- data/lib/ruby-lint/definitions/core/autoload.rb +0 -41
- data/lib/ruby-lint/definitions/core/continuation.rb +0 -10
- data/lib/ruby-lint/definitions/core/default_record_separator.rb +0 -9
- data/lib/ruby-lint/definitions/core/fatal_error.rb +0 -10
- data/lib/ruby-lint/definitions/core/file_list.rb +0 -729
- data/lib/ruby-lint/definitions/core/immediate_value.rb +0 -21
- data/lib/ruby-lint/definitions/core/md5.rb +0 -80
- data/lib/ruby-lint/definitions/core/memory_segmention_error.rb +0 -10
- data/lib/ruby-lint/definitions/core/precision.rb +0 -23
- data/lib/ruby-lint/definitions/core/primitive_failure.rb +0 -10
- data/lib/ruby-lint/definitions/core/psych.rb +0 -139
- data/lib/ruby-lint/definitions/core/rake.rb +0 -4786
- data/lib/ruby-lint/definitions/core/rake_file_utils.rb +0 -205
- data/lib/ruby-lint/definitions/core/rakeversion.rb +0 -9
- data/lib/ruby-lint/definitions/core/rdoc.rb +0 -15
- data/lib/ruby-lint/definitions/core/rexml.rb +0 -13
- data/lib/ruby-lint/definitions/core/rss.rb +0 -13
- data/lib/ruby-lint/definitions/core/sha1.rb +0 -80
- data/lib/ruby-lint/definitions/core/unmarshalable.rb +0 -15
- data/lib/ruby-lint/definitions/core/unsupported_library_error.rb +0 -10
- data/lib/ruby-lint/definitions/global_variables.rb +0 -9
- data/lib/ruby-lint/definitions/rails.rb +0 -12
- data/lib/ruby-lint/global_scope.rb +0 -56
- data/spec/ruby-lint/cli/ast_spec.rb +0 -23
- data/spec/ruby-lint/method_call/assign_member_spec.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd18d2ac845d4520591324dc3491cbd5a3d9b0ca
|
|
4
|
+
data.tar.gz: b7a344031e1b300104e1331486dbc4b8903ff9c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78ad431d97cef27b33f53842e36b46771895a3d1cef0ce8982a77245e5ce3b1c1400318ece043a24a594277eb21ab5dad6026d74473c9d1c9354a5289ddf6309
|
|
7
|
+
data.tar.gz: c6010baaeb8aec96bdaf8a00eb80c92a186be594fa20136e45a3a374749c20588a3a0dd8bac2dd659d7f911eb40cd321f28f291dd1c3dd92daf6932d7fd3234f
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.1
|
data/.travis.yml
CHANGED
|
@@ -4,7 +4,8 @@ script: bundle exec rake travis
|
|
|
4
4
|
rvm:
|
|
5
5
|
- 1.9.3
|
|
6
6
|
- 2.0.0
|
|
7
|
-
-
|
|
7
|
+
- 2.1.0
|
|
8
|
+
- rbx-2.2
|
|
8
9
|
- jruby-19mode
|
|
9
10
|
|
|
10
11
|
notifications:
|
|
@@ -15,8 +16,4 @@ notifications:
|
|
|
15
16
|
on_success: change
|
|
16
17
|
on_failure: always
|
|
17
18
|
|
|
18
|
-
branches:
|
|
19
|
-
only:
|
|
20
|
-
- master
|
|
21
|
-
|
|
22
19
|
cache: bundler
|
data/Gemfile
CHANGED
|
@@ -3,8 +3,13 @@ source 'https://rubygems.org/'
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
5
|
group :testing do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
platform :rbx do
|
|
7
|
+
gem 'rubysl'
|
|
8
|
+
gem 'rubinius-developer_tools'
|
|
9
|
+
gem 'racc'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
platform :mri do
|
|
13
|
+
gem 'ruby-prof'
|
|
14
|
+
end
|
|
10
15
|
end
|
data/MANIFEST
CHANGED
|
@@ -21,6 +21,8 @@ checksum/ruby-lint-0.9.1.gem.sha512
|
|
|
21
21
|
checksum/ruby-lint-1.0.0.gem.sha512
|
|
22
22
|
checksum/ruby-lint-1.0.0.pre.preview1.gem.sha512
|
|
23
23
|
checksum/ruby-lint-1.0.1.gem.sha512
|
|
24
|
+
checksum/ruby-lint-1.0.2.gem.sha512
|
|
25
|
+
checksum/ruby-lint-1.0.3.gem.sha512
|
|
24
26
|
doc/.gitkeep
|
|
25
27
|
doc/DCO.md
|
|
26
28
|
doc/architecture.md
|
|
@@ -29,9 +31,15 @@ doc/code_analysis.md
|
|
|
29
31
|
doc/configuration.md
|
|
30
32
|
doc/css/.gitkeep
|
|
31
33
|
doc/css/common.css
|
|
34
|
+
doc/definitions.md
|
|
32
35
|
doc/graphviz/flow.dot
|
|
33
36
|
doc/images/.gitkeep
|
|
34
37
|
doc/images/flow.png
|
|
38
|
+
gen/rails/constants.txt
|
|
39
|
+
gen/rails/requires.rb
|
|
40
|
+
gen/stdlib/constants.rb
|
|
41
|
+
gen/stdlib/constants.txt
|
|
42
|
+
gen/stdlib/requires.rb
|
|
35
43
|
lib/ruby-lint.rb
|
|
36
44
|
lib/ruby-lint/analysis/argument_amount.rb
|
|
37
45
|
lib/ruby-lint/analysis/base.rb
|
|
@@ -40,6 +48,7 @@ lib/ruby-lint/analysis/shadowing_variables.rb
|
|
|
40
48
|
lib/ruby-lint/analysis/undefined_methods.rb
|
|
41
49
|
lib/ruby-lint/analysis/undefined_variables.rb
|
|
42
50
|
lib/ruby-lint/analysis/unused_variables.rb
|
|
51
|
+
lib/ruby-lint/analysis/useless_equality_checks.rb
|
|
43
52
|
lib/ruby-lint/ast/builder.rb
|
|
44
53
|
lib/ruby-lint/ast/node.rb
|
|
45
54
|
lib/ruby-lint/benchmark/average.rb
|
|
@@ -47,14 +56,14 @@ lib/ruby-lint/cache.rb
|
|
|
47
56
|
lib/ruby-lint/cache_entry.rb
|
|
48
57
|
lib/ruby-lint/cli.rb
|
|
49
58
|
lib/ruby-lint/cli/analyze.rb
|
|
50
|
-
lib/ruby-lint/cli/ast.rb
|
|
51
59
|
lib/ruby-lint/cli/base.rb
|
|
52
|
-
lib/ruby-lint/cli/
|
|
60
|
+
lib/ruby-lint/cli/cache.rb
|
|
53
61
|
lib/ruby-lint/configuration.rb
|
|
54
62
|
lib/ruby-lint/constant_loader.rb
|
|
55
63
|
lib/ruby-lint/constant_path.rb
|
|
56
64
|
lib/ruby-lint/default_names.rb
|
|
57
65
|
lib/ruby-lint/definition/constant_proxy.rb
|
|
66
|
+
lib/ruby-lint/definition/registry.rb
|
|
58
67
|
lib/ruby-lint/definition/ruby_method.rb
|
|
59
68
|
lib/ruby-lint/definition/ruby_object.rb
|
|
60
69
|
lib/ruby-lint/definition_builder/base.rb
|
|
@@ -68,12 +77,10 @@ lib/ruby-lint/definition_builder/ruby_module.rb
|
|
|
68
77
|
lib/ruby-lint/definition_generator.rb
|
|
69
78
|
lib/ruby-lint/definitions/core.rb
|
|
70
79
|
lib/ruby-lint/definitions/core/abbrev.rb
|
|
71
|
-
lib/ruby-lint/definitions/core/arg0.rb
|
|
72
80
|
lib/ruby-lint/definitions/core/argf.rb
|
|
73
81
|
lib/ruby-lint/definitions/core/argument_error.rb
|
|
74
82
|
lib/ruby-lint/definitions/core/argv.rb
|
|
75
83
|
lib/ruby-lint/definitions/core/array.rb
|
|
76
|
-
lib/ruby-lint/definitions/core/autoload.rb
|
|
77
84
|
lib/ruby-lint/definitions/core/base64.rb
|
|
78
85
|
lib/ruby-lint/definitions/core/basic_object.rb
|
|
79
86
|
lib/ruby-lint/definitions/core/basic_socket.rb
|
|
@@ -89,13 +96,11 @@ lib/ruby-lint/definitions/core/complex.rb
|
|
|
89
96
|
lib/ruby-lint/definitions/core/condition_variable.rb
|
|
90
97
|
lib/ruby-lint/definitions/core/config.rb
|
|
91
98
|
lib/ruby-lint/definitions/core/conftest_c.rb
|
|
92
|
-
lib/ruby-lint/definitions/core/continuation.rb
|
|
93
99
|
lib/ruby-lint/definitions/core/coutflag.rb
|
|
94
100
|
lib/ruby-lint/definitions/core/csv.rb
|
|
95
101
|
lib/ruby-lint/definitions/core/data.rb
|
|
96
102
|
lib/ruby-lint/definitions/core/date.rb
|
|
97
103
|
lib/ruby-lint/definitions/core/date_time.rb
|
|
98
|
-
lib/ruby-lint/definitions/core/default_record_separator.rb
|
|
99
104
|
lib/ruby-lint/definitions/core/delegator.rb
|
|
100
105
|
lib/ruby-lint/definitions/core/digest.rb
|
|
101
106
|
lib/ruby-lint/definitions/core/dir.rb
|
|
@@ -118,12 +123,10 @@ lib/ruby-lint/definitions/core/export_prefix.rb
|
|
|
118
123
|
lib/ruby-lint/definitions/core/failed_message.rb
|
|
119
124
|
lib/ruby-lint/definitions/core/false.rb
|
|
120
125
|
lib/ruby-lint/definitions/core/false_class.rb
|
|
121
|
-
lib/ruby-lint/definitions/core/fatal_error.rb
|
|
122
126
|
lib/ruby-lint/definitions/core/fcntl.rb
|
|
123
127
|
lib/ruby-lint/definitions/core/fiber.rb
|
|
124
128
|
lib/ruby-lint/definitions/core/fiber_error.rb
|
|
125
129
|
lib/ruby-lint/definitions/core/file.rb
|
|
126
|
-
lib/ruby-lint/definitions/core/file_list.rb
|
|
127
130
|
lib/ruby-lint/definitions/core/file_test.rb
|
|
128
131
|
lib/ruby-lint/definitions/core/file_utils.rb
|
|
129
132
|
lib/ruby-lint/definitions/core/find.rb
|
|
@@ -137,7 +140,6 @@ lib/ruby-lint/definitions/core/getopt_long.rb
|
|
|
137
140
|
lib/ruby-lint/definitions/core/gserver.rb
|
|
138
141
|
lib/ruby-lint/definitions/core/hash.rb
|
|
139
142
|
lib/ruby-lint/definitions/core/hdr_ext.rb
|
|
140
|
-
lib/ruby-lint/definitions/core/immediate_value.rb
|
|
141
143
|
lib/ruby-lint/definitions/core/index_error.rb
|
|
142
144
|
lib/ruby-lint/definitions/core/install_dirs.rb
|
|
143
145
|
lib/ruby-lint/definitions/core/integer.rb
|
|
@@ -163,8 +165,6 @@ lib/ruby-lint/definitions/core/marshal.rb
|
|
|
163
165
|
lib/ruby-lint/definitions/core/match_data.rb
|
|
164
166
|
lib/ruby-lint/definitions/core/math.rb
|
|
165
167
|
lib/ruby-lint/definitions/core/matrix.rb
|
|
166
|
-
lib/ruby-lint/definitions/core/md5.rb
|
|
167
|
-
lib/ruby-lint/definitions/core/memory_segmention_error.rb
|
|
168
168
|
lib/ruby-lint/definitions/core/method.rb
|
|
169
169
|
lib/ruby-lint/definitions/core/module.rb
|
|
170
170
|
lib/ruby-lint/definitions/core/monitor.rb
|
|
@@ -191,32 +191,23 @@ lib/ruby-lint/definitions/core/orig_libpath.rb
|
|
|
191
191
|
lib/ruby-lint/definitions/core/outflag.rb
|
|
192
192
|
lib/ruby-lint/definitions/core/pathname.rb
|
|
193
193
|
lib/ruby-lint/definitions/core/pp.rb
|
|
194
|
-
lib/ruby-lint/definitions/core/precision.rb
|
|
195
194
|
lib/ruby-lint/definitions/core/pretty_print.rb
|
|
196
195
|
lib/ruby-lint/definitions/core/prime.rb
|
|
197
|
-
lib/ruby-lint/definitions/core/primitive_failure.rb
|
|
198
196
|
lib/ruby-lint/definitions/core/proc.rb
|
|
199
197
|
lib/ruby-lint/definitions/core/process.rb
|
|
200
198
|
lib/ruby-lint/definitions/core/profiler__.rb
|
|
201
199
|
lib/ruby-lint/definitions/core/pstore.rb
|
|
202
|
-
lib/ruby-lint/definitions/core/psych.rb
|
|
203
200
|
lib/ruby-lint/definitions/core/queue.rb
|
|
204
|
-
lib/ruby-lint/definitions/core/rake.rb
|
|
205
|
-
lib/ruby-lint/definitions/core/rake_file_utils.rb
|
|
206
|
-
lib/ruby-lint/definitions/core/rakeversion.rb
|
|
207
201
|
lib/ruby-lint/definitions/core/random.rb
|
|
208
202
|
lib/ruby-lint/definitions/core/range.rb
|
|
209
203
|
lib/ruby-lint/definitions/core/range_error.rb
|
|
210
204
|
lib/ruby-lint/definitions/core/rational.rb
|
|
211
205
|
lib/ruby-lint/definitions/core/rb_config.rb
|
|
212
|
-
lib/ruby-lint/definitions/core/rdoc.rb
|
|
213
206
|
lib/ruby-lint/definitions/core/readline.rb
|
|
214
207
|
lib/ruby-lint/definitions/core/regexp.rb
|
|
215
208
|
lib/ruby-lint/definitions/core/regexp_error.rb
|
|
216
209
|
lib/ruby-lint/definitions/core/resolv.rb
|
|
217
|
-
lib/ruby-lint/definitions/core/rexml.rb
|
|
218
210
|
lib/ruby-lint/definitions/core/rpathflag.rb
|
|
219
|
-
lib/ruby-lint/definitions/core/rss.rb
|
|
220
211
|
lib/ruby-lint/definitions/core/ruby_copyright.rb
|
|
221
212
|
lib/ruby-lint/definitions/core/ruby_description.rb
|
|
222
213
|
lib/ruby-lint/definitions/core/ruby_engine.rb
|
|
@@ -232,7 +223,6 @@ lib/ruby-lint/definitions/core/script_error.rb
|
|
|
232
223
|
lib/ruby-lint/definitions/core/secure_random.rb
|
|
233
224
|
lib/ruby-lint/definitions/core/security_error.rb
|
|
234
225
|
lib/ruby-lint/definitions/core/set.rb
|
|
235
|
-
lib/ruby-lint/definitions/core/sha1.rb
|
|
236
226
|
lib/ruby-lint/definitions/core/shellwords.rb
|
|
237
227
|
lib/ruby-lint/definitions/core/signal.rb
|
|
238
228
|
lib/ruby-lint/definitions/core/signal_exception.rb
|
|
@@ -281,8 +271,6 @@ lib/ruby-lint/definitions/core/unbound_method.rb
|
|
|
281
271
|
lib/ruby-lint/definitions/core/universal_ints.rb
|
|
282
272
|
lib/ruby-lint/definitions/core/unixserver.rb
|
|
283
273
|
lib/ruby-lint/definitions/core/unixsocket.rb
|
|
284
|
-
lib/ruby-lint/definitions/core/unmarshalable.rb
|
|
285
|
-
lib/ruby-lint/definitions/core/unsupported_library_error.rb
|
|
286
274
|
lib/ruby-lint/definitions/core/uri.rb
|
|
287
275
|
lib/ruby-lint/definitions/core/vector.rb
|
|
288
276
|
lib/ruby-lint/definitions/core/weak_ref.rb
|
|
@@ -291,8 +279,9 @@ lib/ruby-lint/definitions/core/xmlrpc.rb
|
|
|
291
279
|
lib/ruby-lint/definitions/core/yaml.rb
|
|
292
280
|
lib/ruby-lint/definitions/core/zero_division_error.rb
|
|
293
281
|
lib/ruby-lint/definitions/core/zlib.rb
|
|
294
|
-
lib/ruby-lint/definitions/
|
|
295
|
-
lib/ruby-lint/definitions/
|
|
282
|
+
lib/ruby-lint/definitions/gems/.gitkeep
|
|
283
|
+
lib/ruby-lint/definitions/gems/devise.rb
|
|
284
|
+
lib/ruby-lint/definitions/gems/nokogiri.rb
|
|
296
285
|
lib/ruby-lint/definitions/rails/abstract_controller.rb
|
|
297
286
|
lib/ruby-lint/definitions/rails/action_controller.rb
|
|
298
287
|
lib/ruby-lint/definitions/rails/action_dispatch.rb
|
|
@@ -310,10 +299,10 @@ lib/ruby-lint/docstring/param_tag.rb
|
|
|
310
299
|
lib/ruby-lint/docstring/parser.rb
|
|
311
300
|
lib/ruby-lint/docstring/return_tag.rb
|
|
312
301
|
lib/ruby-lint/extensions/string.rb
|
|
302
|
+
lib/ruby-lint/file_list.rb
|
|
313
303
|
lib/ruby-lint/file_loader.rb
|
|
314
304
|
lib/ruby-lint/file_scanner.rb
|
|
315
305
|
lib/ruby-lint/generated_constant.rb
|
|
316
|
-
lib/ruby-lint/global_scope.rb
|
|
317
306
|
lib/ruby-lint/inspector.rb
|
|
318
307
|
lib/ruby-lint/iterator.rb
|
|
319
308
|
lib/ruby-lint/method_call/alias.rb
|
|
@@ -329,8 +318,10 @@ lib/ruby-lint/parser.rb
|
|
|
329
318
|
lib/ruby-lint/presenter/json.rb
|
|
330
319
|
lib/ruby-lint/presenter/syntastic.rb
|
|
331
320
|
lib/ruby-lint/presenter/text.rb
|
|
321
|
+
lib/ruby-lint/rake_task.rb
|
|
332
322
|
lib/ruby-lint/report.rb
|
|
333
323
|
lib/ruby-lint/report/entry.rb
|
|
324
|
+
lib/ruby-lint/ruby_lint.rb
|
|
334
325
|
lib/ruby-lint/runner.rb
|
|
335
326
|
lib/ruby-lint/template/definition.erb
|
|
336
327
|
lib/ruby-lint/template/scope.rb
|
|
@@ -369,15 +360,17 @@ spec/ruby-lint/analysis/shadowing_variables_spec.rb
|
|
|
369
360
|
spec/ruby-lint/analysis/undefined_methods_spec.rb
|
|
370
361
|
spec/ruby-lint/analysis/undefined_variables_spec.rb
|
|
371
362
|
spec/ruby-lint/analysis/unused_variables_spec.rb
|
|
363
|
+
spec/ruby-lint/analysis/useless_equality_checks_spec.rb
|
|
372
364
|
spec/ruby-lint/ast/node_spec.rb
|
|
373
365
|
spec/ruby-lint/cache_entry_spec.rb
|
|
374
366
|
spec/ruby-lint/cache_spec.rb
|
|
375
367
|
spec/ruby-lint/cli/analyze_spec.rb
|
|
376
|
-
spec/ruby-lint/cli/ast_spec.rb
|
|
377
368
|
spec/ruby-lint/configuration_spec.rb
|
|
369
|
+
spec/ruby-lint/constant_loader_spec.rb
|
|
378
370
|
spec/ruby-lint/constant_path.rb
|
|
379
371
|
spec/ruby-lint/definition/constant_proxy_spec.rb
|
|
380
372
|
spec/ruby-lint/definition/dsl_spec.rb
|
|
373
|
+
spec/ruby-lint/definition/registry_spec.rb
|
|
381
374
|
spec/ruby-lint/definition/ruby_method_spec.rb
|
|
382
375
|
spec/ruby-lint/definition/ruby_object_spec.rb
|
|
383
376
|
spec/ruby-lint/definition_builder/primitive_spec.rb
|
|
@@ -386,15 +379,21 @@ spec/ruby-lint/definition_builder/ruby_method_spec.rb
|
|
|
386
379
|
spec/ruby-lint/definition_builder/ruby_module_spec.rb
|
|
387
380
|
spec/ruby-lint/definitions/argv_spec.rb
|
|
388
381
|
spec/ruby-lint/definitions/env_spec.rb
|
|
382
|
+
spec/ruby-lint/definitions/file_spec.rb
|
|
383
|
+
spec/ruby-lint/definitions/fixnum_spec.rb
|
|
389
384
|
spec/ruby-lint/definitions/io_spec.rb
|
|
385
|
+
spec/ruby-lint/definitions/kernel_spec.rb
|
|
386
|
+
spec/ruby-lint/definitions/range_spec.rb
|
|
387
|
+
spec/ruby-lint/definitions/string_spec.rb
|
|
390
388
|
spec/ruby-lint/docstring/mapping.rb
|
|
391
389
|
spec/ruby-lint/docstring/parser_spec.rb
|
|
392
390
|
spec/ruby-lint/extensions/string_spec.rb
|
|
391
|
+
spec/ruby-lint/file_list_spec.rb
|
|
393
392
|
spec/ruby-lint/file_loader_spec.rb
|
|
394
393
|
spec/ruby-lint/file_scanner_spec.rb
|
|
395
394
|
spec/ruby-lint/inspector_spec.rb
|
|
396
395
|
spec/ruby-lint/iterator_spec.rb
|
|
397
|
-
spec/ruby-lint/method_call
|
|
396
|
+
spec/ruby-lint/method_call/.gitkeep
|
|
398
397
|
spec/ruby-lint/nested_stack_spec.rb
|
|
399
398
|
spec/ruby-lint/node_hash_spec.rb
|
|
400
399
|
spec/ruby-lint/parser_spec.rb
|
|
@@ -404,6 +403,7 @@ spec/ruby-lint/presenter/text_spec.rb
|
|
|
404
403
|
spec/ruby-lint/report/entry_spec.rb
|
|
405
404
|
spec/ruby-lint/report_spec.rb
|
|
406
405
|
spec/ruby-lint/runner_spec.rb
|
|
406
|
+
spec/ruby-lint/variable_predicates_spec.rb
|
|
407
407
|
spec/ruby-lint/virtual_machine/alias_spec.rb
|
|
408
408
|
spec/ruby-lint/virtual_machine/assignments/arrays_spec.rb
|
|
409
409
|
spec/ruby-lint/virtual_machine/assignments/assignment_arguments_spec.rb
|
|
@@ -433,16 +433,20 @@ spec/ruby-lint/virtual_machine/interpolation_spec.rb
|
|
|
433
433
|
spec/ruby-lint/virtual_machine/location_spec.rb
|
|
434
434
|
spec/ruby-lint/virtual_machine/method_call_tracking_spec.rb
|
|
435
435
|
spec/ruby-lint/virtual_machine/methods/attr_spec.rb
|
|
436
|
+
spec/ruby-lint/virtual_machine/methods/calls_spec.rb
|
|
436
437
|
spec/ruby-lint/virtual_machine/methods/define_method_spec.rb
|
|
437
438
|
spec/ruby-lint/virtual_machine/methods/defining_spec.rb
|
|
438
439
|
spec/ruby-lint/virtual_machine/methods/docstrings_spec.rb
|
|
439
440
|
spec/ruby-lint/virtual_machine/methods/exporting_spec.rb
|
|
441
|
+
spec/ruby-lint/virtual_machine/methods/kernel_spec.rb
|
|
440
442
|
spec/ruby-lint/virtual_machine/methods/parameters_spec.rb
|
|
441
443
|
spec/ruby-lint/virtual_machine/methods/patching_spec.rb
|
|
442
444
|
spec/ruby-lint/virtual_machine/methods/scoping_spec.rb
|
|
445
|
+
spec/ruby-lint/virtual_machine/methods/square_bracket_spec.rb
|
|
443
446
|
spec/ruby-lint/virtual_machine/methods/visibility_spec.rb
|
|
444
447
|
spec/ruby-lint/virtual_machine/modules_spec.rb
|
|
445
448
|
spec/ruby-lint/virtual_machine/reference_amount_spec.rb
|
|
449
|
+
spec/ruby-lint/virtual_machine/self_spec.rb
|
|
446
450
|
spec/ruby-lint/virtual_machine/unused_spec.rb
|
|
447
451
|
spec/spec_helper.rb
|
|
448
452
|
spec/support/building.rb
|
data/README.md
CHANGED
|
@@ -4,10 +4,21 @@
|
|
|
4
4
|
[](https://coveralls.io/r/YorickPeterse/ruby-lint)
|
|
5
5
|
[](https://codeclimate.com/github/YorickPeterse/ruby-lint)
|
|
6
6
|
|
|
7
|
-
ruby-lint is a
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
ruby-lint is a static code analysis tool for Ruby. It is inspired by tools such
|
|
8
|
+
as jshint, flake8 and similar tools. ruby-lint primarily focuses on logic
|
|
9
|
+
related errors such as the use of non existing variables instead of focusing on
|
|
10
|
+
semantics (e.g. the amount of characters per line).
|
|
11
|
+
|
|
12
|
+
The features of ruby-lint include but are not limited to the detection of
|
|
13
|
+
unused variables, the use of undefined methods and method calls with invalid
|
|
14
|
+
argument amounts and more. More in-depth analysis will be added over time.
|
|
15
|
+
|
|
16
|
+
The aim of ruby-lint is to provide analysis that is as accurate as possible.
|
|
17
|
+
However, due to the dynamic nature of Ruby and the sheer amount of meta-magic
|
|
18
|
+
in third-party code there will at times be false positives. Analysis can be
|
|
19
|
+
improved by documenting your code using [YARD][yard], in particular the
|
|
20
|
+
`@param` and `@return` tags are used by ruby-lint to obtain extra information
|
|
21
|
+
when processing methods.
|
|
11
22
|
|
|
12
23
|
## Requirements
|
|
13
24
|
|
|
@@ -16,7 +27,7 @@ instead of focusing on semantics (e.g. the amount of characters per line).
|
|
|
16
27
|
|
|
17
28
|
The following Ruby implementations/versions are officially supported:
|
|
18
29
|
|
|
19
|
-
* MRI 1.9.3
|
|
30
|
+
* MRI 1.9.3, 2.0 or 2.1
|
|
20
31
|
* Rubinius 2.0 and newer
|
|
21
32
|
* Jruby 1.7 and newer
|
|
22
33
|
|
|
@@ -123,6 +134,7 @@ In the past Gems were also signed using PGP, this is no longer the case.
|
|
|
123
134
|
* {file:architecture Architecture}
|
|
124
135
|
* {file:code\_analysis Code Analysis}
|
|
125
136
|
* {file:configuration Configuration}
|
|
137
|
+
* {file:definitions Definitions}
|
|
126
138
|
|
|
127
139
|
## License
|
|
128
140
|
|
|
@@ -133,3 +145,4 @@ in the root directory of this repository.
|
|
|
133
145
|
[syntastic]: https://github.com/scrooloose/syntastic
|
|
134
146
|
[flycheck]: https://github.com/flycheck/flycheck/
|
|
135
147
|
[rubocop]: https://github.com/bbatsov/rubocop
|
|
148
|
+
[yard]: http://yardoc.org/
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require File.expand_path('../lib/ruby-lint/definition_generator', __FILE__)
|
|
1
|
+
require_relative 'lib/ruby-lint/definition_generator'
|
|
2
|
+
require_relative 'lib/ruby-lint/rake_task'
|
|
4
3
|
|
|
5
4
|
require 'yaml'
|
|
6
5
|
require 'bundler/gem_tasks'
|
|
@@ -8,6 +7,11 @@ require 'digest/sha2'
|
|
|
8
7
|
require 'coveralls/rake/task'
|
|
9
8
|
require 'rake/clean'
|
|
10
9
|
|
|
10
|
+
RubyLint::RakeTask.new do |task|
|
|
11
|
+
task.name = 'lint'
|
|
12
|
+
task.files = ['./lib/ruby-lint']
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
Coveralls::RakeTask.new
|
|
12
16
|
|
|
13
17
|
GEMSPEC = Gem::Specification.load('ruby-lint.gemspec')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
01bdfe10f10950d2035dc1a0289e0cf1b6f40a0b23fead3ee1f39391e309ed00972bdc0a2b35859539660ebb1a2cc5a222f9eded6d511a28daa32fdeb9829786
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dc93aa3a5f196b8badbab5c06975e7da6710508e2f6efebf16f063413d4f1d80d8f02897c0aced4a7593e16d1f2f53465a3be9ff16d0b6b084086ec6a169aa1a
|
data/doc/changelog.md
CHANGED
|
@@ -5,6 +5,46 @@ 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
|
+
## 1.1.0 - 2014-02-02
|
|
9
|
+
|
|
10
|
+
This release changes the way the definitions system works so that it no longer
|
|
11
|
+
stores a set of global definition objects. Instead "templates" (so to speak)
|
|
12
|
+
are provided which are applied to individual `RubyLint::VirtualMachine`
|
|
13
|
+
instances. This makes it much easier to analyze code that patches core classes
|
|
14
|
+
such as `String` or `Fixnum`.
|
|
15
|
+
|
|
16
|
+
There have also been various other, smaller changes. The ones worth mentioning
|
|
17
|
+
as following:
|
|
18
|
+
|
|
19
|
+
* A new analysis class, UselessEqualityChecks, has been added. This class adds
|
|
20
|
+
warnings for expressions such as `"foo" == true`.
|
|
21
|
+
* A Rake task class has been added, making it easier to integrate ruby-lint in
|
|
22
|
+
a Rakefile.
|
|
23
|
+
* The CLI has been cleaned up and the `plot` and `ast` commands have been
|
|
24
|
+
removed. A new command, `cache` has been introduced to manage ruby-lint cache
|
|
25
|
+
files more easily.
|
|
26
|
+
* A bug has been fixed that would prevent ruby-lint from properly loading files
|
|
27
|
+
from multiple directories, see Git commit
|
|
28
|
+
`292bb2b73aa6adfdc750fb846884025afc841393`.
|
|
29
|
+
* Definitions have been added for Devise and Nokogiri.
|
|
30
|
+
* Most built-in definitions have been re-generated.
|
|
31
|
+
* Definitions system has been overhauled to no longer use a global state and a
|
|
32
|
+
complex data copying system. Instead the definitions are applied to every
|
|
33
|
+
individual `RubyLint::VirtualMachine` instance.
|
|
34
|
+
* Updated the version of the parser Gem to use.
|
|
35
|
+
|
|
36
|
+
The following bugs/issues have been resolved in this release:
|
|
37
|
+
|
|
38
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/89
|
|
39
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/85
|
|
40
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/91
|
|
41
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/92
|
|
42
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/93
|
|
43
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/94
|
|
44
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/100
|
|
45
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/101
|
|
46
|
+
* https://github.com/YorickPeterse/ruby-lint/issues/102
|
|
47
|
+
|
|
8
48
|
## 1.0.3 - 2013-12-23
|
|
9
49
|
|
|
10
50
|
* `self` is now defined as a class and instance method to ensure that the right
|
data/doc/definitions.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# @title Definitions
|
|
2
|
+
# Definitions
|
|
3
|
+
|
|
4
|
+
To obtain extra information used in the analysis process ruby-lint uses a set
|
|
5
|
+
of so called "definitions". These definitions describe constants and their
|
|
6
|
+
methods and the associated arguments of said methods. The definitions can be
|
|
7
|
+
created using a basic DSL. Typically end users don't have to write these
|
|
8
|
+
manually as ruby-lint comes with a set of Rake tasks to ease the process of
|
|
9
|
+
creating these definitions. However, manual tweaking might be required in rare
|
|
10
|
+
cases.
|
|
11
|
+
|
|
12
|
+
## Rationale
|
|
13
|
+
|
|
14
|
+
The definitions exist for 3 reasons:
|
|
15
|
+
|
|
16
|
+
1. Both MRI and JRuby provide insufficient runtime reflection on method
|
|
17
|
+
arguments (more on this below), a rather crucial aspect in performing
|
|
18
|
+
meaningful analysis.
|
|
19
|
+
2. Relying on the current runtime for extra information means that users will
|
|
20
|
+
have to load all their used libraries into a ruby-lint session. This will
|
|
21
|
+
often result in degraded performance, in particular startup times will
|
|
22
|
+
increase.
|
|
23
|
+
3. It's not possible to, during runtime, determine the return type(s) of a
|
|
24
|
+
method. This can only be done by either relying on source documentation or
|
|
25
|
+
by other manual means.
|
|
26
|
+
|
|
27
|
+
These 3 topics are described in detail below.
|
|
28
|
+
|
|
29
|
+
### Argument Reflection
|
|
30
|
+
|
|
31
|
+
Ruby as a language provides the means to, during runtime, find out what
|
|
32
|
+
arguments a method has, their types and names. For example, consider the
|
|
33
|
+
following code:
|
|
34
|
+
|
|
35
|
+
def example(a, b)
|
|
36
|
+
return a + b
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
We can obtain the arguments list by running the following code:
|
|
40
|
+
|
|
41
|
+
method(:example).parameters
|
|
42
|
+
|
|
43
|
+
This would result in the following value being returned:
|
|
44
|
+
|
|
45
|
+
[[:req, :a], [:req, :b]]
|
|
46
|
+
|
|
47
|
+
Using this we can see that the method takes two required arguments, `a` and
|
|
48
|
+
`b`.
|
|
49
|
+
|
|
50
|
+
Although this works great for methods that are defined in Ruby itself this does
|
|
51
|
+
not work reliably for methods defined in C (in case of MRI) or in Java (in case
|
|
52
|
+
of JRuby).
|
|
53
|
+
|
|
54
|
+
As an example, lets take a look at `String#gsub`. The RDoc documentation of
|
|
55
|
+
this method states the following about its arguments:
|
|
56
|
+
|
|
57
|
+
= String#gsub
|
|
58
|
+
|
|
59
|
+
(from ruby core)
|
|
60
|
+
------------------------------------------------------------------------------
|
|
61
|
+
str.gsub(pattern, replacement) -> new_str
|
|
62
|
+
str.gsub(pattern, hash) -> new_str
|
|
63
|
+
str.gsub(pattern) {|match| block } -> new_str
|
|
64
|
+
str.gsub(pattern) -> enumerator
|
|
65
|
+
|
|
66
|
+
This states that the method takes 1 required argument (`pattern`), one optional
|
|
67
|
+
argument (`replacement` / `hash`) and a block. However, when we inspect the
|
|
68
|
+
arguments list of this method in MRI we get different results:
|
|
69
|
+
|
|
70
|
+
String.instance_method(:gsub).parameters # => [[:rest]]
|
|
71
|
+
|
|
72
|
+
This would indicate that the method instead takes a single rest argument. This
|
|
73
|
+
however is simply false as calling the method without any arguments (rest
|
|
74
|
+
arguments being optional) results in an argument error:
|
|
75
|
+
|
|
76
|
+
'foo'.gsub # => ArgumentError: wrong number of arguments (0 for 1..2)
|
|
77
|
+
|
|
78
|
+
This is due to the fact that `String#gsub` method (and many other methods in
|
|
79
|
+
MRI) are defined in C. Since the C API doesn't expose proper systems for
|
|
80
|
+
exposing the argument amounts/types this information is lost.
|
|
81
|
+
|
|
82
|
+
JRuby is also affected by this though at present it's unclear to me if this is
|
|
83
|
+
intentional (in order to mimic MRI's broken behaviour) or a side effect.
|
|
84
|
+
Currently Rubinius is the only Ruby implementation that I know of that does not
|
|
85
|
+
suffer from this problem, largely due to it actually using Ruby for a large
|
|
86
|
+
amount of its core.
|
|
87
|
+
|
|
88
|
+
The above problem also affects every Ruby C extension such as Nokogiri and many
|
|
89
|
+
others.
|
|
90
|
+
|
|
91
|
+
This particular lack of information is problematic for ruby-lint as it means
|
|
92
|
+
that it can not perform meaningful analysis when it relies on the current
|
|
93
|
+
runtime. After all, the accuracy of the analysis process would change depending
|
|
94
|
+
on the Ruby implementation leading to confusing behaviour and false positives.
|
|
95
|
+
|
|
96
|
+
To combat this ruby-lint doesn't use the current runtime for obtaining method
|
|
97
|
+
information. Instead it uses definitions that are pre-generated using Rubinius.
|
|
98
|
+
However, even on Rubinius the accuracy of these definitions will vary for C
|
|
99
|
+
extensions depending on how much these extensions define in C opposed to Ruby.
|
|
100
|
+
|
|
101
|
+
### Degraded Performance
|
|
102
|
+
|
|
103
|
+
The second reason for not using the current runtime is that by doing so users
|
|
104
|
+
would be required to load their libraries into a ruby-lint session. For
|
|
105
|
+
example, for a Rails project this means loading all of Rails, all the used
|
|
106
|
+
Gems, custom code defined in the `app/` directory and so forth. Doing so will
|
|
107
|
+
increase the startup time of ruby-lint up to a point where it becomes downright
|
|
108
|
+
annoying.
|
|
109
|
+
|
|
110
|
+
To give an example, merely loading Rails using `require 'rails/all'` will add
|
|
111
|
+
around 500 milliseconds to the startup time. Add a few more Gems such as
|
|
112
|
+
Devise, Mongoid and what not and you'll quickly end up having to wait seconds
|
|
113
|
+
for ruby-lint to start up (or any other Ruby program for that matter).
|
|
114
|
+
|
|
115
|
+
As a result of this it was decided that this was less than optimal, which in
|
|
116
|
+
turn was another reason to use pre-generated definitions.
|
|
117
|
+
|
|
118
|
+
### Return Types
|
|
119
|
+
|
|
120
|
+
Due to Ruby being dynamically typed it's impossible to deduce the return type
|
|
121
|
+
of a method. As a result of this ruby-lint would not be able to figure out what
|
|
122
|
+
`SomeClass.new` would return. This means that for code such as
|
|
123
|
+
`SomeClass.new.foo` ruby-lint would have no other choice but to completely
|
|
124
|
+
ignore it.
|
|
125
|
+
|
|
126
|
+
ruby-lint tries to work around this using two methods:
|
|
127
|
+
|
|
128
|
+
1. Using YARD documentation (in particular the `@return` and `@param` tags) to
|
|
129
|
+
obtain more information during runtime.
|
|
130
|
+
2. Using pre-generated definitions that specify return types such as those for
|
|
131
|
+
the `new` and `initialize` methods.
|
|
132
|
+
|
|
133
|
+
This means that ruby-lint is capable of understanding that `String.new` returns
|
|
134
|
+
an instance of `String`. ruby-lint makes the assumption that the class method
|
|
135
|
+
`new` returns an instance of the constant it is defined in, unless the method
|
|
136
|
+
is explicitly overwritten.
|
|
137
|
+
|
|
138
|
+
## Generating Definitions
|
|
139
|
+
|
|
140
|
+
In most cases one does not need to write these definitions manually, instead
|
|
141
|
+
they are generated using a set of Rake tasks. For best results it's recommended
|
|
142
|
+
to use Rubinius in case you're generating definitions for the Ruby standard
|
|
143
|
+
library.
|
|
144
|
+
|
|
145
|
+
Assuming you have a local copy of ruby-lint you can generate your definitions
|
|
146
|
+
by running the following Rake task:
|
|
147
|
+
|
|
148
|
+
rake -r YOUR_GEM generate:definitions[CONSTANT,lib/ruby-lint/definitions/gems]
|
|
149
|
+
|
|
150
|
+
Here `YOUR_GEM` would be the name of your Gem, `CONSTANT` would be the
|
|
151
|
+
top-level constant. For example, to generate the definitions for Devise you'd
|
|
152
|
+
run the following:
|
|
153
|
+
|
|
154
|
+
rake -r devise generate:definitions[Devise,lib/ruby-lint/definitions/gems]
|
|
155
|
+
|
|
156
|
+
If you are comfortable with the resulting definitions you can submit a pull
|
|
157
|
+
request and I'll take a look at it. I prefer for the definitions to be included
|
|
158
|
+
with ruby-lint itself as this makes it easier to maintain and distribute them
|
|
159
|
+
without requiring users to install a bunch of extra Gems.
|
|
160
|
+
|
|
161
|
+
## Using Definitions
|
|
162
|
+
|
|
163
|
+
When processing source code ruby-lint will try to automatically load
|
|
164
|
+
definitions where needed. For this to work the definitions should be available
|
|
165
|
+
in the load path defined in {RubyLint::Definition::Registry#load\_path}. By
|
|
166
|
+
default the following directories are searched in for definitions:
|
|
167
|
+
|
|
168
|
+
* lib/ruby-lint/definitions/core
|
|
169
|
+
* lib/ruby-lint/definitions/rails
|
|
170
|
+
* lib/ruby-lint/definitions/gems
|
|
171
|
+
|
|
172
|
+
There should be no need to add extra paths to this list.
|
|
173
|
+
|
|
174
|
+
Definitions are looked up based on the top-level constant referenced in a file.
|
|
175
|
+
For example, of ruby-lint bumps into the constant path `Foo::Bar::Baz` it will
|
|
176
|
+
try to look for a file called `foo.rb` in the above directories. It is expected
|
|
177
|
+
that if this file exists it defines the `Foo` constant (and its child
|
|
178
|
+
constants).
|
|
179
|
+
|
|
180
|
+
The process of loading definitions is handled by
|
|
181
|
+
{RubyLint::Definition::Registry#load} and
|
|
182
|
+
{RubyLint::ConstantLoader#load\_constant}.
|