ruby-lint 0.9.1 → 1.0.0.pre.preview1
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/.travis.yml +1 -1
- data/CONTRIBUTING.md +9 -11
- data/Gemfile +6 -3
- data/MANIFEST +7 -1
- data/README.md +15 -24
- data/benchmark/bootup.rb +13 -0
- data/checksum/ruby-lint-0.9.1.gem.sha512 +1 -0
- data/doc/code_analysis.md +20 -0
- data/doc/css/common.css +1 -0
- data/doc/images/flow.png +0 -0
- data/lib/ruby-lint.rb +1 -3
- data/lib/ruby-lint/analysis/base.rb +12 -2
- data/lib/ruby-lint/analysis/undefined_variables.rb +3 -2
- data/lib/ruby-lint/analysis/unused_variables.rb +3 -2
- data/lib/ruby-lint/ast/node.rb +1 -1
- data/lib/ruby-lint/benchmark/average.rb +115 -0
- data/lib/ruby-lint/cli/analyze.rb +19 -1
- data/lib/ruby-lint/constant_loader.rb +1 -3
- data/lib/ruby-lint/constant_path.rb +112 -0
- data/lib/ruby-lint/definition_builder/base.rb +0 -2
- data/lib/ruby-lint/definition_builder/ruby_module.rb +1 -1
- data/lib/ruby-lint/definitions/core/array.rb +304 -73
- data/lib/ruby-lint/definitions/core/fixnum.rb +575 -19
- data/lib/ruby-lint/definitions/core/float.rb +2650 -95
- data/lib/ruby-lint/definitions/core/hash.rb +926 -85
- 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/string.rb +847 -134
- data/lib/ruby-lint/definitions/core/string_io.rb +370 -25
- data/lib/ruby-lint/definitions/core/struct.rb +611 -146
- data/lib/ruby-lint/file_loader.rb +5 -6
- data/lib/ruby-lint/file_scanner.rb +44 -11
- data/lib/ruby-lint/inspector.rb +12 -2
- data/lib/ruby-lint/runner.rb +6 -2
- data/lib/ruby-lint/version.rb +1 -1
- data/lib/ruby-lint/virtual_machine.rb +19 -5
- data/ruby-lint.gemspec +1 -3
- data/spec/ruby-lint/analysis/argument_amount_spec.rb +5 -5
- data/spec/ruby-lint/analysis/base_spec.rb +4 -0
- data/spec/ruby-lint/analysis/shadowing_variables_spec.rb +4 -4
- data/spec/ruby-lint/analysis/undefined_methods_spec.rb +6 -6
- data/spec/ruby-lint/analysis/undefined_variables_spec.rb +5 -5
- data/spec/ruby-lint/analysis/unused_variables_spec.rb +12 -12
- data/spec/ruby-lint/cli/analyze_spec.rb +10 -0
- data/spec/ruby-lint/constant_path.rb +63 -0
- data/spec/ruby-lint/definition/ruby_object_spec.rb +2 -2
- data/spec/ruby-lint/report_spec.rb +2 -2
- data/spec/ruby-lint/runner_spec.rb +17 -0
- data/spec/ruby-lint/virtual_machine/assignments/assignment_arguments_spec.rb +14 -0
- data/spec/ruby-lint/virtual_machine/assignments/constants_spec.rb +23 -0
- data/spec/ruby-lint/virtual_machine/location_spec.rb +4 -4
- data/spec/ruby-lint/virtual_machine/method_call_tracking_spec.rb +4 -4
- data/task/build.rake +2 -7
- data/task/doc.rake +3 -1
- data/task/generate.rake +3 -0
- metadata +20 -36
- checksums.yaml.gz.asc +0 -17
- data.tar.gz.asc +0 -17
- data/lib/ruby-lint/helper/constant_paths.rb +0 -50
- 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-----
|