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,50 +0,0 @@
1
- module RubyLint
2
- module Helper
3
- ##
4
- # The ConstantPaths helper module can be used to easily iterate over the
5
- # segments of a constant path and perform lookups on each segment.
6
- #
7
- module ConstantPaths
8
- ##
9
- # Looks up a definition for a given constant path. If no constant could
10
- # be found `nil` is returned.
11
- #
12
- # The first constant segment in the path can inherit constants from the
13
- # outer scope, any following constants will be limited to the scope of
14
- # the constant itself.
15
- #
16
- # @param [RubyLint::AST::Node] node
17
- # @return [RubyLint::Definition::RubyObject|NilClass]
18
- #
19
- def resolve_constant_path(node)
20
- current = current_scope
21
-
22
- constant_segments(node).each_with_index do |segment, index|
23
- found = current.lookup(:const, segment, index == 0)
24
-
25
- found ? current = found : return
26
- end
27
-
28
- return current
29
- end
30
-
31
- ##
32
- # Returns an Array containing the segments of a constant path.
33
- #
34
- # @param [RubyLint::AST::Node] node
35
- # @return [Array<String>]
36
- #
37
- def constant_segments(node)
38
- segments = []
39
-
40
- if node.children[0]
41
- segments.concat(constant_segments(node.children[0]))
42
- end
43
-
44
- segments << node.children[1].to_s
45
-
46
- return segments
47
- end
48
- end # ConstantPaths
49
- end # Helper
50
- end # RubyLint
metadata.gz.asc DELETED
@@ -1,17 +0,0 @@
1
- -----BEGIN PGP SIGNATURE-----
2
- Version: GnuPG v2.0.22 (GNU/Linux)
3
-
4
- iQIcBAABAgAGBQJSZaGYAAoJEPMbESk2SfRE3wEQALDJMjrK0WO5I/p8KSFeoAKo
5
- /hiw9O0wUwre2r/LcZiMPlU+6r8gMIZakZ3osTh1IK9UbEkf7alVdE+pd+tOTKyn
6
- HNWVGw5z+HxhIgMjCOy5q8xtZ31TvCOLZdzOXbYFYB1sqBH8s88pnUg7yXDpFwsi
7
- 16Ov4oSzNXZQZe/eMOoc/7+frcfel966ZuBnlmgluDZEUvKnKEYg/f/DCQP/1Y6Z
8
- VDuFXwWvjhXBG9KAWlJTKwvgotgy7Uc2CQOR29RuS+/GsxFS4d7dnF6WGdKhRfHD
9
- bGG8KBO/WoCvvfCYBhsOdijxpExELJl/vhKMdH0IH26LhmcBUizrW5jpR2a0QtfX
10
- MrA0RgZiW8pZuABdwOv7UHMOw7yWQzeWltc1lhBtJb0YnZ9Tf2Ye0YXF/8nZbvRV
11
- 4+Gz4UOeo1SYYkr85jBzi7nQeAPx+bXsRGr/4bPGv2ojN2nPNx9PqYs8vIMP73aZ
12
- j7MzfYc5Auav9YWD9biQ12epd9pDdOn3+mtoVHiCx0SKeGUDl0kkRl7zv3ZySw/D
13
- mW5LosYE1Kf/yyGBzkaqliWfwwISabL9eSoE+2Y7yVJZbEDrfqT3lznYsIi4YxqE
14
- 83sW5edNmXyidBYIcyc9bqBwYP56wAeoxgPMgrVspheicYlx9rpNxhwNU9SDq0j8
15
- dQEG+I0UB8hIYeuq5q5D
16
- =WGBc
17
- -----END PGP SIGNATURE-----