ruby-lint 0.0.1a → 0.0.1a1

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.
Files changed (77) hide show
  1. data/.yardopts +1 -1
  2. data/MANIFEST +65 -62
  3. data/README.md +114 -13
  4. data/bin/ruby-lint +6 -0
  5. data/lib/ruby-lint.rb +36 -0
  6. data/lib/{rlint → ruby-lint}/analyze/coding_style.rb +32 -32
  7. data/lib/{rlint → ruby-lint}/analyze/definitions.rb +13 -13
  8. data/lib/{rlint → ruby-lint}/analyze/method_validation.rb +5 -5
  9. data/lib/{rlint → ruby-lint}/analyze/shadowing_variables.rb +5 -5
  10. data/lib/{rlint → ruby-lint}/analyze/undefined_variables.rb +7 -7
  11. data/lib/{rlint → ruby-lint}/analyze/unused_variables.rb +6 -6
  12. data/lib/{rlint → ruby-lint}/callback.rb +11 -11
  13. data/lib/{rlint → ruby-lint}/cli.rb +17 -17
  14. data/lib/{rlint → ruby-lint}/constant_importer.rb +18 -8
  15. data/lib/{rlint → ruby-lint}/definition.rb +10 -10
  16. data/lib/{rlint → ruby-lint}/formatter/text.rb +6 -6
  17. data/lib/{rlint → ruby-lint}/helper/definition_resolver.rb +11 -11
  18. data/lib/{rlint → ruby-lint}/helper/scoping.rb +14 -14
  19. data/lib/{rlint → ruby-lint}/iterator.rb +22 -22
  20. data/lib/{rlint → ruby-lint}/options.rb +9 -9
  21. data/lib/{rlint → ruby-lint}/parser.rb +111 -111
  22. data/lib/{rlint → ruby-lint}/parser_error.rb +3 -3
  23. data/lib/{rlint → ruby-lint}/report.rb +8 -8
  24. data/lib/{rlint → ruby-lint}/token/assignment_token.rb +4 -4
  25. data/lib/{rlint → ruby-lint}/token/begin_rescue_token.rb +7 -7
  26. data/lib/{rlint → ruby-lint}/token/block_token.rb +12 -3
  27. data/lib/{rlint → ruby-lint}/token/case_token.rb +5 -5
  28. data/lib/{rlint → ruby-lint}/token/class_token.rb +3 -3
  29. data/lib/{rlint → ruby-lint}/token/method_definition_token.rb +8 -8
  30. data/lib/{rlint → ruby-lint}/token/method_token.rb +9 -7
  31. data/lib/{rlint → ruby-lint}/token/parameters_token.rb +6 -6
  32. data/lib/{rlint → ruby-lint}/token/regexp_token.rb +2 -2
  33. data/lib/{rlint → ruby-lint}/token/statement_token.rb +6 -6
  34. data/lib/{rlint → ruby-lint}/token/token.rb +8 -6
  35. data/lib/{rlint → ruby-lint}/token/variable_token.rb +3 -3
  36. data/lib/ruby-lint/version.rb +3 -0
  37. data/ruby-lint.gemspec +5 -5
  38. data/spec/benchmarks/memory.rb +7 -7
  39. data/spec/benchmarks/parse_parser.rb +5 -5
  40. data/spec/fixtures/stdlib/un.rb +348 -0
  41. data/spec/helper.rb +3 -1
  42. data/spec/{rlint → ruby-lint}/analyze/coding_style.rb +30 -30
  43. data/spec/ruby-lint/analyze/complex/un.rb +29 -0
  44. data/spec/{rlint → ruby-lint}/analyze/definitions/classes.rb +25 -25
  45. data/spec/{rlint → ruby-lint}/analyze/definitions/methods.rb +22 -22
  46. data/spec/{rlint → ruby-lint}/analyze/definitions/modules.rb +42 -42
  47. data/spec/{rlint → ruby-lint}/analyze/definitions/variables.rb +27 -27
  48. data/spec/{rlint → ruby-lint}/analyze/method_validation.rb +31 -31
  49. data/spec/{rlint → ruby-lint}/analyze/shadowing_variables.rb +6 -6
  50. data/spec/{rlint → ruby-lint}/analyze/undefined_variables.rb +37 -37
  51. data/spec/{rlint → ruby-lint}/analyze/unused_variables.rb +21 -21
  52. data/spec/{rlint → ruby-lint}/callback.rb +7 -7
  53. data/spec/{rlint → ruby-lint}/constant_importer.rb +6 -6
  54. data/spec/{rlint → ruby-lint}/definition.rb +25 -25
  55. data/spec/{rlint → ruby-lint}/formatter/text.rb +4 -4
  56. data/spec/{rlint → ruby-lint}/iterator.rb +38 -38
  57. data/spec/{rlint → ruby-lint}/parser/arrays.rb +28 -28
  58. data/spec/{rlint → ruby-lint}/parser/classes.rb +23 -23
  59. data/spec/{rlint → ruby-lint}/parser/errors.rb +4 -4
  60. data/spec/{rlint → ruby-lint}/parser/hashes.rb +24 -24
  61. data/spec/{rlint → ruby-lint}/parser/methods.rb +50 -50
  62. data/spec/{rlint → ruby-lint}/parser/modules.rb +8 -8
  63. data/spec/{rlint → ruby-lint}/parser/objects.rb +8 -8
  64. data/spec/{rlint → ruby-lint}/parser/operators.rb +14 -14
  65. data/spec/{rlint → ruby-lint}/parser/procs.rb +26 -26
  66. data/spec/{rlint → ruby-lint}/parser/ranges.rb +9 -9
  67. data/spec/{rlint → ruby-lint}/parser/regexp.rb +5 -5
  68. data/spec/{rlint → ruby-lint}/parser/scalars.rb +17 -17
  69. data/spec/{rlint → ruby-lint}/parser/statements.rb +94 -94
  70. data/spec/{rlint → ruby-lint}/parser/variables.rb +37 -37
  71. data/spec/{rlint → ruby-lint}/report.rb +4 -4
  72. data/task/manifest.rake +8 -0
  73. data/task/test.rake +1 -1
  74. metadata +69 -66
  75. data/bin/rlint +0 -6
  76. data/lib/rlint.rb +0 -36
  77. data/lib/rlint/version.rb +0 -3
@@ -1,9 +1,9 @@
1
1
  require File.expand_path('../../helper', __FILE__)
2
2
 
3
- describe 'Rlint::Callback' do
4
- it 'Add an error to a report using Rlint::Callback' do
5
- report = Rlint::Report.new
6
- callback = Rlint::Callback.new(report)
3
+ describe 'RubyLint::Callback' do
4
+ it 'Add an error to a report using RubyLint::Callback' do
5
+ report = RubyLint::Report.new
6
+ callback = RubyLint::Callback.new(report)
7
7
 
8
8
  report.levels.each do |level|
9
9
  report.messages[level].nil?.should == true
@@ -17,9 +17,9 @@ describe 'Rlint::Callback' do
17
17
  end
18
18
  end
19
19
 
20
- it 'Ignore errors (when disabled) when adding one using Rlint::Callback' do
21
- report = Rlint::Report.new('(rlint)', [:warning])
22
- callback = Rlint::Callback.new(report)
20
+ it 'Ignore errors (when disabled) when adding one using RubyLint::Callback' do
21
+ report = RubyLint::Report.new('(ruby-lint)', [:warning])
22
+ callback = RubyLint::Callback.new(report)
23
23
 
24
24
  callback.send(:error, 'test error', 1, 1)
25
25
 
@@ -1,25 +1,25 @@
1
1
  require File.expand_path('../../helper', __FILE__)
2
2
 
3
- describe 'Rlint::ConstantImporter' do
3
+ describe 'RubyLint::ConstantImporter' do
4
4
  it 'Import methods from the Kernel constant' do
5
- imported = Rlint::ConstantImporter.import([:Kernel])
5
+ imported = RubyLint::ConstantImporter.import([:Kernel])
6
6
 
7
7
  imported.key?('Kernel').should == true
8
8
 
9
9
  found = imported['Kernel'].lookup(:method, 'puts')
10
10
 
11
- found.class.should == Rlint::Definition
11
+ found.class.should == RubyLint::Definition
12
12
 
13
- found.token.class.should == Rlint::Token::MethodDefinitionToken
13
+ found.token.class.should == RubyLint::Token::MethodDefinitionToken
14
14
  found.token.name.should == 'puts'
15
15
  found.token.visibility.should == :public
16
16
 
17
- found.token.parameters.class.should == Rlint::Token::ParametersToken
17
+ found.token.parameters.class.should == RubyLint::Token::ParametersToken
18
18
 
19
19
  found.token.parameters.value.class.should == Array
20
20
  found.token.parameters.value.length.should == 0
21
21
 
22
- found.token.parameters.rest.class.should == Rlint::Token::VariableToken
22
+ found.token.parameters.rest.class.should == RubyLint::Token::VariableToken
23
23
  found.token.parameters.rest.name.should == ''
24
24
  found.token.parameters.rest.type.should == :local_variable
25
25
  found.token.parameters.rest.event.should == :local_variable
@@ -1,8 +1,8 @@
1
1
  require File.expand_path('../../helper', __FILE__)
2
2
 
3
- describe 'Rlint::Definition' do
3
+ describe 'RubyLint::Definition' do
4
4
  it 'Look up a symbol in a scope' do
5
- scope = Rlint::Definition.new
5
+ scope = RubyLint::Definition.new
6
6
 
7
7
  scope.lookup(:local_variable, 'number').should == nil
8
8
 
@@ -12,8 +12,8 @@ describe 'Rlint::Definition' do
12
12
  end
13
13
 
14
14
  it 'Look up a symbol in a parent scope' do
15
- parent = Rlint::Definition.new
16
- child = Rlint::Definition.new(parent)
15
+ parent = RubyLint::Definition.new
16
+ child = RubyLint::Definition.new(parent)
17
17
 
18
18
  parent.add(:local_variable, 'number', 10)
19
19
  parent.add(:global_variable, '$number', 20)
@@ -26,16 +26,16 @@ describe 'Rlint::Definition' do
26
26
  end
27
27
 
28
28
  it 'Create a scope with default Ruby constants and methods' do
29
- scope = Rlint::Definition.new(nil, :lazy => true, :kernel => true)
29
+ scope = RubyLint::Definition.new(nil, :lazy => true, :kernel => true)
30
30
  found = scope.lookup(:constant, 'Kernel')
31
31
 
32
- found.class.should == Rlint::Definition
32
+ found.class.should == RubyLint::Definition
33
33
 
34
34
  method = found.lookup(:method, 'warn')
35
35
 
36
- method.class.should == Rlint::Definition
36
+ method.class.should == RubyLint::Definition
37
37
 
38
- method.token.class.should == Rlint::Token::MethodDefinitionToken
38
+ method.token.class.should == RubyLint::Token::MethodDefinitionToken
39
39
  method.token.name.should == 'warn'
40
40
 
41
41
  method.token.parameters.value.class.should == Array
@@ -43,52 +43,52 @@ describe 'Rlint::Definition' do
43
43
 
44
44
  param = method.token.parameters.value[0]
45
45
 
46
- param.class.should == Rlint::Token::VariableToken
46
+ param.class.should == RubyLint::Token::VariableToken
47
47
  param.name.should == ''
48
48
  param.type.should == :local_variable
49
49
  end
50
50
 
51
51
  it 'Lazy import the Time class' do
52
- scope = Rlint::Definition.new
52
+ scope = RubyLint::Definition.new
53
53
 
54
54
  scope.lookup(:constant, 'Time').nil?.should == true
55
55
 
56
- scope = Rlint::Definition.new(nil, :lazy => true)
56
+ scope = RubyLint::Definition.new(nil, :lazy => true)
57
57
 
58
- scope.lookup(:constant, 'Time').class.should == Rlint::Definition
58
+ scope.lookup(:constant, 'Time').class.should == RubyLint::Definition
59
59
  end
60
60
 
61
61
  it 'Lazy import the Encoding class and a child constant' do
62
- scope = Rlint::Definition.new(nil, :lazy => true)
62
+ scope = RubyLint::Definition.new(nil, :lazy => true)
63
63
  enc = scope.lookup(:constant, 'Encoding')
64
64
 
65
- enc.class.should == Rlint::Definition
65
+ enc.class.should == RubyLint::Definition
66
66
 
67
- enc.lookup(:constant, 'BINARY').class.should == Rlint::Definition
67
+ enc.lookup(:constant, 'BINARY').class.should == RubyLint::Definition
68
68
  end
69
69
 
70
- it 'Lazy import Rlint::Definition' do
71
- scope = Rlint::Definition.new(nil, :lazy => true)
70
+ it 'Lazy import RubyLint::Definition' do
71
+ scope = RubyLint::Definition.new(nil, :lazy => true)
72
72
 
73
- rlint = scope.lookup(:constant, 'Rlint')
73
+ ruby_lint = scope.lookup(:constant, 'RubyLint')
74
74
 
75
- rlint.class.should == Rlint::Definition
75
+ ruby_lint.class.should == RubyLint::Definition
76
76
 
77
- rlint_scope = rlint.lookup(:constant, 'Definition')
77
+ ruby_lint_scope = ruby_lint.lookup(:constant, 'Definition')
78
78
 
79
- rlint_scope.class.should == Rlint::Definition
79
+ ruby_lint_scope.class.should == RubyLint::Definition
80
80
 
81
- rlint_scope.lookup(:constant, 'LOOKUP_PARENT').class.should == Rlint::Definition
81
+ ruby_lint_scope.lookup(:constant, 'LOOKUP_PARENT').class.should == RubyLint::Definition
82
82
  end
83
83
 
84
84
  it 'Create a scope with multiple parent scopes' do
85
- scope_1 = Rlint::Definition.new
86
- scope_2 = Rlint::Definition.new
85
+ scope_1 = RubyLint::Definition.new
86
+ scope_2 = RubyLint::Definition.new
87
87
 
88
88
  scope_1.add(:method, 'method_1', true)
89
89
  scope_2.add(:method, 'method_2', true)
90
90
 
91
- scope_3 = Rlint::Definition.new([scope_1, scope_2])
91
+ scope_3 = RubyLint::Definition.new([scope_1, scope_2])
92
92
 
93
93
  scope_3.lookup(:method, 'method_1').should == true
94
94
  scope_3.lookup(:method, 'method_2').should == true
@@ -1,10 +1,10 @@
1
1
  require File.expand_path('../../../helper', __FILE__)
2
2
 
3
- describe 'Rlint::Formatter::Text' do
3
+ describe 'RubyLint::Formatter::Text' do
4
4
  it 'Format a report in plain text' do
5
- report_a = Rlint::Report.new('a.rb')
6
- report_b = Rlint::Report.new('b.rb')
7
- formatter = Rlint::Formatter::Text.new
5
+ report_a = RubyLint::Report.new('a.rb')
6
+ report_b = RubyLint::Report.new('b.rb')
7
+ formatter = RubyLint::Formatter::Text.new
8
8
 
9
9
  report_a.add(:info, 'test info', 2, 1)
10
10
 
@@ -1,16 +1,16 @@
1
1
  require File.expand_path('../../helper', __FILE__)
2
2
 
3
- describe 'Rlint::Iterator' do
3
+ describe 'RubyLint::Iterator' do
4
4
  it 'Iterate over a simple AST' do
5
5
  code = <<-CODE
6
6
  number = 10
7
7
  number
8
8
  CODE
9
9
 
10
- tokens = Rlint::Parser.new(code).parse
11
- iterator = Rlint::Iterator.new
10
+ tokens = RubyLint::Parser.new(code).parse
11
+ iterator = RubyLint::Iterator.new
12
12
 
13
- callback = Class.new(Rlint::Callback) do
13
+ callback = Class.new(RubyLint::Callback) do
14
14
  attr_reader :assigned
15
15
  attr_reader :referenced
16
16
 
@@ -40,9 +40,9 @@ class Foo
40
40
  end
41
41
  CODE
42
42
 
43
- tokens = Rlint::Parser.new(code).parse
44
- iterator = Rlint::Iterator.new
45
- callback = Class.new(Rlint::Callback) do
43
+ tokens = RubyLint::Parser.new(code).parse
44
+ iterator = RubyLint::Iterator.new
45
+ callback = Class.new(RubyLint::Callback) do
46
46
  attr_reader :class_name
47
47
  attr_reader :method_name
48
48
  attr_reader :assigned
@@ -76,9 +76,9 @@ def some_method
76
76
  end
77
77
  CODE
78
78
 
79
- tokens = Rlint::Parser.new(code).parse
80
- iterator = Rlint::Iterator.new
81
- callback = Class.new(Rlint::Callback) do
79
+ tokens = RubyLint::Parser.new(code).parse
80
+ iterator = RubyLint::Iterator.new
81
+ callback = Class.new(RubyLint::Callback) do
82
82
  attr_reader :before
83
83
  attr_reader :after
84
84
 
@@ -107,9 +107,9 @@ rescue RuntimeError => e
107
107
  end
108
108
  CODE
109
109
 
110
- tokens = Rlint::Parser.new(code).parse
111
- iterator = Rlint::Iterator.new
112
- callback = Class.new(Rlint::Callback) do
110
+ tokens = RubyLint::Parser.new(code).parse
111
+ iterator = RubyLint::Iterator.new
112
+ callback = Class.new(RubyLint::Callback) do
113
113
  attr_reader :method_names
114
114
  attr_reader :exception
115
115
  attr_reader :exception_var
@@ -158,9 +158,9 @@ else
158
158
  end
159
159
  CODE
160
160
 
161
- tokens = Rlint::Parser.new(code).parse
162
- iterator = Rlint::Iterator.new
163
- callback = Class.new(Rlint::Callback) do
161
+ tokens = RubyLint::Parser.new(code).parse
162
+ iterator = RubyLint::Iterator.new
163
+ callback = Class.new(RubyLint::Callback) do
164
164
  attr_reader :variables
165
165
  attr_reader :methods
166
166
 
@@ -203,9 +203,9 @@ else
203
203
  end
204
204
  CODE
205
205
 
206
- tokens = Rlint::Parser.new(code).parse
207
- iterator = Rlint::Iterator.new
208
- callback = Class.new(Rlint::Callback) do
206
+ tokens = RubyLint::Parser.new(code).parse
207
+ iterator = RubyLint::Iterator.new
208
+ callback = Class.new(RubyLint::Callback) do
209
209
  attr_reader :methods
210
210
  attr_reader :numbers
211
211
 
@@ -241,9 +241,9 @@ for key, value in {:name => 'Ruby'}
241
241
  end
242
242
  CODE
243
243
 
244
- tokens = Rlint::Parser.new(code).parse
245
- iterator = Rlint::Iterator.new
246
- callback = Class.new(Rlint::Callback) do
244
+ tokens = RubyLint::Parser.new(code).parse
245
+ iterator = RubyLint::Iterator.new
246
+ callback = Class.new(RubyLint::Callback) do
247
247
  attr_reader :symbol
248
248
  attr_reader :string
249
249
  attr_reader :names
@@ -288,9 +288,9 @@ while foo == 10
288
288
  end
289
289
  CODE
290
290
 
291
- tokens = Rlint::Parser.new(code).parse
292
- iterator = Rlint::Iterator.new
293
- callback = Class.new(Rlint::Callback) do
291
+ tokens = RubyLint::Parser.new(code).parse
292
+ iterator = RubyLint::Iterator.new
293
+ callback = Class.new(RubyLint::Callback) do
294
294
  attr_reader :numbers
295
295
  attr_reader :methods
296
296
 
@@ -330,9 +330,9 @@ def foobar(required, optional = 10, *rest, more, &block)
330
330
  end
331
331
  CODE
332
332
 
333
- tokens = Rlint::Parser.new(code).parse
334
- iterator = Rlint::Iterator.new
335
- callback = Class.new(Rlint::Callback) do
333
+ tokens = RubyLint::Parser.new(code).parse
334
+ iterator = RubyLint::Iterator.new
335
+ callback = Class.new(RubyLint::Callback) do
336
336
  attr_reader :variables
337
337
  attr_reader :numbers
338
338
 
@@ -362,9 +362,9 @@ end
362
362
  end
363
363
 
364
364
  it 'Iterate over a method call' do
365
- tokens = Rlint::Parser.new('puts "Foo", "Bar"').parse
366
- iterator = Rlint::Iterator.new
367
- callback = Class.new(Rlint::Callback) do
365
+ tokens = RubyLint::Parser.new('puts "Foo", "Bar"').parse
366
+ iterator = RubyLint::Iterator.new
367
+ callback = Class.new(RubyLint::Callback) do
368
368
  attr_reader :params
369
369
 
370
370
  def initialize(*args)
@@ -393,9 +393,9 @@ class Person
393
393
  end
394
394
  CODE
395
395
 
396
- tokens = Rlint::Parser.new(code).parse
397
- iterator = Rlint::Iterator.new
398
- callback = Class.new(Rlint::Callback) do
396
+ tokens = RubyLint::Parser.new(code).parse
397
+ iterator = RubyLint::Iterator.new
398
+ callback = Class.new(RubyLint::Callback) do
399
399
  attr_reader :start
400
400
  attr_reader :finish
401
401
 
@@ -429,16 +429,16 @@ def example_method
429
429
  end
430
430
  CODE
431
431
 
432
- tokens = Rlint::Parser.new(code).parse
433
- iterator = Rlint::Iterator.new
432
+ tokens = RubyLint::Parser.new(code).parse
433
+ iterator = RubyLint::Iterator.new
434
434
 
435
- setter = Class.new(Rlint::Callback) do
435
+ setter = Class.new(RubyLint::Callback) do
436
436
  def on_method_definition(token)
437
437
  @storage[:method_name] = token.name
438
438
  end
439
439
  end
440
440
 
441
- getter = Class.new(Rlint::Callback) do
441
+ getter = Class.new(RubyLint::Callback) do
442
442
  attr_reader :storage
443
443
  end
444
444
 
@@ -1,10 +1,10 @@
1
1
  require File.expand_path('../../../helper', __FILE__)
2
2
 
3
- describe 'Rlint::Parser' do
3
+ describe 'RubyLint::Parser' do
4
4
  it 'Parse an Array' do
5
- token = Rlint::Parser.new('[10, 20]').parse[0]
5
+ token = RubyLint::Parser.new('[10, 20]').parse[0]
6
6
 
7
- token.class.should == Rlint::Token::Token
7
+ token.class.should == RubyLint::Token::Token
8
8
  token.type.should == :array
9
9
 
10
10
  token.value.class.should == Array
@@ -14,19 +14,19 @@ describe 'Rlint::Parser' do
14
14
  token.column.should == 8
15
15
  token.code.should == '[10, 20]'
16
16
 
17
- token.value[0].class.should == Rlint::Token::Token
17
+ token.value[0].class.should == RubyLint::Token::Token
18
18
  token.value[0].type.should == :integer
19
19
  token.value[0].value.should == '10'
20
20
 
21
- token.value[1].class.should == Rlint::Token::Token
21
+ token.value[1].class.should == RubyLint::Token::Token
22
22
  token.value[1].type.should == :integer
23
23
  token.value[1].value.should == '20'
24
24
  end
25
25
 
26
26
  it 'Parse an Array using %w{}' do
27
- token = Rlint::Parser.new('%w{10 20}').parse[0]
27
+ token = RubyLint::Parser.new('%w{10 20}').parse[0]
28
28
 
29
- token.class.should == Rlint::Token::Token
29
+ token.class.should == RubyLint::Token::Token
30
30
  token.type.should == :array
31
31
 
32
32
  token.value.class.should == Array
@@ -36,19 +36,19 @@ describe 'Rlint::Parser' do
36
36
  token.column.should == 9
37
37
  token.code.should == '%w{10 20}'
38
38
 
39
- token.value[0].class.should == Rlint::Token::Token
39
+ token.value[0].class.should == RubyLint::Token::Token
40
40
  token.value[0].type.should == :string
41
41
  token.value[0].value.should == '10'
42
42
 
43
- token.value[1].class.should == Rlint::Token::Token
43
+ token.value[1].class.should == RubyLint::Token::Token
44
44
  token.value[1].type.should == :string
45
45
  token.value[1].value.should == '20'
46
46
  end
47
47
 
48
48
  it 'Parse an Array using %W{}' do
49
- token = Rlint::Parser.new('%W{10 20}').parse[0]
49
+ token = RubyLint::Parser.new('%W{10 20}').parse[0]
50
50
 
51
- token.class.should == Rlint::Token::Token
51
+ token.class.should == RubyLint::Token::Token
52
52
  token.type.should == :array
53
53
 
54
54
  token.value.class.should == Array
@@ -58,19 +58,19 @@ describe 'Rlint::Parser' do
58
58
  token.column.should == 9
59
59
  token.code.should == '%W{10 20}'
60
60
 
61
- token.value[0].class.should == Rlint::Token::Token
61
+ token.value[0].class.should == RubyLint::Token::Token
62
62
  token.value[0].type.should == :string
63
63
  token.value[0].value.should == '10'
64
64
 
65
- token.value[1].class.should == Rlint::Token::Token
65
+ token.value[1].class.should == RubyLint::Token::Token
66
66
  token.value[1].type.should == :string
67
67
  token.value[1].value.should == '20'
68
68
  end
69
69
 
70
70
  it 'Parse an Array index reference' do
71
- token = Rlint::Parser.new("[10][0]").parse[0]
71
+ token = RubyLint::Parser.new("[10][0]").parse[0]
72
72
 
73
- token.class.should == Rlint::Token::Token
73
+ token.class.should == RubyLint::Token::Token
74
74
  token.line.should == 1
75
75
  token.column.should == 4
76
76
  token.code.should == '[10][0]'
@@ -78,15 +78,15 @@ describe 'Rlint::Parser' do
78
78
  token.key.class.should == Array
79
79
  token.key.length.should == 1
80
80
 
81
- token.key[0].class.should == Rlint::Token::Token
81
+ token.key[0].class.should == RubyLint::Token::Token
82
82
  token.key[0].type.should == :integer
83
83
  token.key[0].value.should == '0'
84
84
  end
85
85
 
86
86
  it 'Parse an Array index reference using a variable' do
87
- token = Rlint::Parser.new("numbers = [10]\nnumbers[0]").parse[1]
87
+ token = RubyLint::Parser.new("numbers = [10]\nnumbers[0]").parse[1]
88
88
 
89
- token.class.should == Rlint::Token::VariableToken
89
+ token.class.should == RubyLint::Token::VariableToken
90
90
  token.line.should == 2
91
91
  token.column.should == 0
92
92
  token.name.should == 'numbers'
@@ -95,15 +95,15 @@ describe 'Rlint::Parser' do
95
95
  token.key.class.should == Array
96
96
  token.key.length.should == 1
97
97
 
98
- token.key[0].class.should == Rlint::Token::Token
98
+ token.key[0].class.should == RubyLint::Token::Token
99
99
  token.key[0].type.should == :integer
100
100
  token.key[0].value.should == '0'
101
101
  end
102
102
 
103
103
  it 'Parse multiple Array index references' do
104
- token = Rlint::Parser.new("numbers = [10]\nnumbers[0,1]").parse[1]
104
+ token = RubyLint::Parser.new("numbers = [10]\nnumbers[0,1]").parse[1]
105
105
 
106
- token.class.should == Rlint::Token::VariableToken
106
+ token.class.should == RubyLint::Token::VariableToken
107
107
  token.line.should == 2
108
108
  token.column.should == 0
109
109
  token.name.should == 'numbers'
@@ -112,35 +112,35 @@ describe 'Rlint::Parser' do
112
112
  token.key.class.should == Array
113
113
  token.key.length.should == 2
114
114
 
115
- token.key[0].class.should == Rlint::Token::Token
115
+ token.key[0].class.should == RubyLint::Token::Token
116
116
  token.key[0].type.should == :integer
117
117
  token.key[0].value.should == '0'
118
118
 
119
- token.key[1].class.should == Rlint::Token::Token
119
+ token.key[1].class.should == RubyLint::Token::Token
120
120
  token.key[1].type.should == :integer
121
121
  token.key[1].value.should == '1'
122
122
  end
123
123
 
124
124
  it 'Parse the assignment of a value to an array index' do
125
- token = Rlint::Parser.new("numbers = []\nnumbers[0] = 10").parse[1]
125
+ token = RubyLint::Parser.new("numbers = []\nnumbers[0] = 10").parse[1]
126
126
 
127
- token.class.should == Rlint::Token::AssignmentToken
127
+ token.class.should == RubyLint::Token::AssignmentToken
128
128
 
129
129
  token.line.should == 2
130
130
  token.column.should == 12
131
131
  token.code.should == 'numbers[0] = 10'
132
132
 
133
- token.value.class.should == Rlint::Token::Token
133
+ token.value.class.should == RubyLint::Token::Token
134
134
  token.value.type.should == :integer
135
135
  token.value.value.should == '10'
136
136
 
137
- token.receiver.class.should == Rlint::Token::VariableToken
137
+ token.receiver.class.should == RubyLint::Token::VariableToken
138
138
  token.receiver.name.should == 'numbers'
139
139
 
140
140
  token.receiver.key.class.should == Array
141
141
  token.receiver.key.length.should == 1
142
142
 
143
- token.receiver.key[0].class.should == Rlint::Token::Token
143
+ token.receiver.key[0].class.should == RubyLint::Token::Token
144
144
  token.receiver.key[0].type.should == :integer
145
145
  token.receiver.key[0].value.should == '0'
146
146
  end