ruby-lint 0.0.1a → 0.0.1a1

Sign up to get free protection for your applications and to get access to all the features.
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,6 +1,6 @@
1
- module Rlint
1
+ module RubyLint
2
2
  ##
3
- # {Rlint::Definition} is a class used for storing scoping/definition related
3
+ # {RubyLint::Definition} is a class used for storing scoping/definition related
4
4
  # information such as the methods that are available for various constants,
5
5
  # variables that have been defined, etc.
6
6
  #
@@ -10,7 +10,7 @@ module Rlint
10
10
  #
11
11
  # Basic example of using this class:
12
12
  #
13
- # scope = Rlint::Definition.new
13
+ # scope = RubyLint::Definition.new
14
14
  #
15
15
  # scope.lookup(:local_variable, 'name') # => nil
16
16
  #
@@ -72,7 +72,7 @@ module Rlint
72
72
 
73
73
  ##
74
74
  # An array containing all the constant names that belong to the constant
75
- # set in {Rlint::Definition#constant}. Each name is saved as a String.
75
+ # set in {RubyLint::Definition#constant}. Each name is saved as a String.
76
76
  #
77
77
  # @return [Array]
78
78
  #
@@ -81,8 +81,8 @@ module Rlint
81
81
  ##
82
82
  # Creates a new instance of the scope class and sets the default symbols.
83
83
  #
84
- # @param [Array|Rlint::Definition] parent The parent scope(s). Set this to
85
- # an Array of {Rlint::Definition} instances to use multiple parent scopes.
84
+ # @param [Array|RubyLint::Definition] parent The parent scope(s). Set this to
85
+ # an Array of {RubyLint::Definition} instances to use multiple parent scopes.
86
86
  # @param [Hash] options A hash containing custom options.
87
87
  #
88
88
  # @option options [TrueClass|FalseClass] :lazy When set to `true` missing
@@ -93,7 +93,7 @@ module Rlint
93
93
  # constants, set to `Object` by default.
94
94
  # @option options [TrueClass|FalseClass] :reset When set to `true` the
95
95
  # `value` attribute of the token will be set to `nil`
96
- # @option options [Rlint::Token::Token] :token The token to set for the
96
+ # @option options [RubyLint::Token::Token] :token The token to set for the
97
97
  # scope.
98
98
  #
99
99
  def initialize(parent = [], options = {})
@@ -184,7 +184,7 @@ module Rlint
184
184
  ##
185
185
  # Returns the token associated with the scope.
186
186
  #
187
- # @return [Rlint::Token::Token|NilClass]
187
+ # @return [RubyLint::Token::Token|NilClass]
188
188
  #
189
189
  def token
190
190
  return @options[:token]
@@ -193,7 +193,7 @@ module Rlint
193
193
  ##
194
194
  # Sets the token of the scope.
195
195
  #
196
- # @param [Rlint::Token::Token] token The token to use.
196
+ # @param [RubyLint::Token::Token] token The token to use.
197
197
  #
198
198
  def token=(token)
199
199
  @options[:token] = token.dup
@@ -227,4 +227,4 @@ module Rlint
227
227
  return LOOKUP_PARENT.include?(type) && !@parent.empty?
228
228
  end
229
229
  end # Definition
230
- end # Rlint
230
+ end # RubyLint
@@ -1,7 +1,7 @@
1
- module Rlint
1
+ module RubyLint
2
2
  module Formatter
3
3
  ##
4
- # {Rlint::Formatter::Text} is a formatter class that formats a report in a
4
+ # {RubyLint::Formatter::Text} is a formatter class that formats a report in a
5
5
  # format similar to the one used by Ruby when validating a Ruby file using
6
6
  # the `ruby` executable. An example of this format is the following:
7
7
  #
@@ -10,8 +10,8 @@ module Rlint
10
10
  #
11
11
  # Basic usage of this formatter is as following:
12
12
  #
13
- # report = Rlint::Report.new
14
- # formatter = Rlint::Formatter::Text.new
13
+ # report = RubyLint::Report.new
14
+ # formatter = RubyLint::Formatter::Text.new
15
15
  #
16
16
  # # Add some data to the report.
17
17
  # # ...
@@ -29,7 +29,7 @@ module Rlint
29
29
  ##
30
30
  # Formats the specified report.
31
31
  #
32
- # @param [Rlint::Report] report The report to format.
32
+ # @param [RubyLint::Report] report The report to format.
33
33
  # @return [String]
34
34
  #
35
35
  def format(report)
@@ -51,4 +51,4 @@ module Rlint
51
51
  end
52
52
  end # Text
53
53
  end # Formatter
54
- end # Rlint
54
+ end # RubyLint
@@ -1,10 +1,10 @@
1
- module Rlint
1
+ module RubyLint
2
2
  module Helper
3
3
  ##
4
- # {Rlint::Helper::DefinitionResolver} is a helper module that can be used
5
- # to work with scoping information similar to {Rlint::Helper::Scoping}.
4
+ # {RubyLint::Helper::DefinitionResolver} is a helper module that can be used
5
+ # to work with scoping information similar to {RubyLint::Helper::Scoping}.
6
6
  #
7
- # This module depends on {Rlint::Helper::Scoping} and will include it
7
+ # This module depends on {RubyLint::Helper::Scoping} and will include it
8
8
  # automatically.
9
9
  #
10
10
  # ## Methods
@@ -44,7 +44,7 @@ module Rlint
44
44
  ##
45
45
  # Sets the scope for the current method definition.
46
46
  #
47
- # @param [Rlint::Token::MethodDefinitionToken] token
47
+ # @param [RubyLint::Token::MethodDefinitionToken] token
48
48
  #
49
49
  def on_method_definition(token)
50
50
  @scopes << scope.lookup(
@@ -60,7 +60,7 @@ module Rlint
60
60
  ##
61
61
  # Resets the scope back to the one used before the method definition.
62
62
  #
63
- # @see Rlint::Helper::DefinitionResolver#on_method_definition
63
+ # @see RubyLint::Helper::DefinitionResolver#on_method_definition
64
64
  #
65
65
  def after_method_definition(token)
66
66
  @scopes.pop
@@ -72,7 +72,7 @@ module Rlint
72
72
  ##
73
73
  # Sets the scope for the current class.
74
74
  #
75
- # @param [Rlint::Token::ClassToken] token
75
+ # @param [RubyLint::Token::ClassToken] token
76
76
  #
77
77
  def on_class(token)
78
78
  name = token.name.join('::')
@@ -87,7 +87,7 @@ module Rlint
87
87
  ##
88
88
  # Resets the scope back to the one used before the class definition.
89
89
  #
90
- # @see Rlint::Helper::DefinitionResolver#on_class
90
+ # @see RubyLint::Helper::DefinitionResolver#on_class
91
91
  #
92
92
  def after_class(token)
93
93
  @scopes.pop
@@ -100,7 +100,7 @@ module Rlint
100
100
  ##
101
101
  # Sets the scope for the current module.
102
102
  #
103
- # @param [Rlint::Token::Token] token
103
+ # @param [RubyLint::Token::Token] token
104
104
  #
105
105
  def on_module(token)
106
106
  name = token.name.join('::')
@@ -115,7 +115,7 @@ module Rlint
115
115
  ##
116
116
  # Resets the scope back to the one used before the module definition.
117
117
  #
118
- # @see Rlint::Helper::DefinitionResolver#on_module
118
+ # @see RubyLint::Helper::DefinitionResolver#on_module
119
119
  #
120
120
  def after_module(token)
121
121
  @scopes.pop
@@ -140,4 +140,4 @@ module Rlint
140
140
  end
141
141
  end # DefinitionResolver
142
142
  end # Helper
143
- end # Rlint
143
+ end # RubyLint
@@ -1,11 +1,11 @@
1
- module Rlint
1
+ module RubyLint
2
2
  module Helper
3
3
  ##
4
- # {Rlint::Helper::Scoping} is a helper module that can be used to more
4
+ # {RubyLint::Helper::Scoping} is a helper module that can be used to more
5
5
  # easily access scoping related information in subclasses of
6
- # {Rlint::Callback}.
6
+ # {RubyLint::Callback}.
7
7
  #
8
- # Note that unlike {Rlint::Helper::DefinitionResolver} this method does not
8
+ # Note that unlike {RubyLint::Helper::DefinitionResolver} this method does not
9
9
  # automatically update the `@scopes` array mentioned below, it merely
10
10
  # creates the required variables and provides a few helper methods.
11
11
  #
@@ -24,18 +24,18 @@ module Rlint
24
24
  # that includes this module:
25
25
  #
26
26
  # * `@scopes`: an array that should be updated with instance of
27
- # {Rlint::Definition} based on the current scope.
27
+ # {RubyLint::Definition} based on the current scope.
28
28
  # * `@namespace`: array containing the constant names for the current
29
29
  # namespace.
30
30
  #
31
31
  # The following keys are set in the `@storage` instance variable:
32
32
  #
33
- # * `:scope`: an instance of {Rlint::Definition} that will contain the
33
+ # * `:scope`: an instance of {RubyLint::Definition} that will contain the
34
34
  # definition list of the current block of code that's being analyzed.
35
35
  #
36
36
  module Scoping
37
37
  ##
38
- # @see Rlint::Callback#initialize
38
+ # @see RubyLint::Callback#initialize
39
39
  #
40
40
  def initialize(*args)
41
41
  super
@@ -56,7 +56,7 @@ module Rlint
56
56
  # constant path.
57
57
  #
58
58
  # @param [Array] path The constant path.
59
- # @return [Rlint::Definition]
59
+ # @return [RubyLint::Definition]
60
60
  #
61
61
  def resolve_definition(path)
62
62
  current = scope
@@ -72,7 +72,7 @@ module Rlint
72
72
  ##
73
73
  # Checks if the specified token's name is a valid constant path.
74
74
  #
75
- # @param [Rlint::Token::VariableToken] token The token to validate.
75
+ # @param [RubyLint::Token::VariableToken] token The token to validate.
76
76
  # @return [TrueClass|FalseClass]
77
77
  #
78
78
  def valid_constant_path?(token)
@@ -93,12 +93,12 @@ module Rlint
93
93
 
94
94
  ##
95
95
  # Checks if the specified type and token result in a valid
96
- # {Rlint::Definition} instance.
96
+ # {RubyLint::Definition} instance.
97
97
  #
98
98
  # @param [#to_sym] type The type of data to look up.
99
- # @param [Rlint::Token::VariableToken] token The token containing details
99
+ # @param [RubyLint::Token::VariableToken] token The token containing details
100
100
  # about the variable.
101
- # @param [Rlint::Definition] scope The scope to use for looking up the
101
+ # @param [RubyLint::Definition] scope The scope to use for looking up the
102
102
  # data.
103
103
  # @return [TrueClass|FalseClass]
104
104
  #
@@ -128,11 +128,11 @@ module Rlint
128
128
  # Returns the current scope. This method is primarily used to make the
129
129
  # code in this class a bit more pleasant to read.
130
130
  #
131
- # @return [Rlint::Definition]
131
+ # @return [RubyLint::Definition]
132
132
  #
133
133
  def scope
134
134
  return !@scopes.empty? ? @scopes[-1] : @storage[:scope]
135
135
  end
136
136
  end # Scoping
137
137
  end # Helper
138
- end # Rlint
138
+ end # RubyLint
@@ -1,7 +1,7 @@
1
- module Rlint
1
+ module RubyLint
2
2
  ##
3
- # {Rlint::Iterator} is a class that can be used to iterate over the AST
4
- # generated by {Rlint::Parser} and execute callback methods for each
3
+ # {RubyLint::Iterator} is a class that can be used to iterate over the AST
4
+ # generated by {RubyLint::Parser} and execute callback methods for each
5
5
  # encountered node. Basic usage is as following:
6
6
  #
7
7
  # code = <<-CODE
@@ -10,9 +10,9 @@ module Rlint
10
10
  # end
11
11
  # CODE
12
12
  #
13
- # parser = Rlint::Parser.new(code)
13
+ # parser = RubyLint::Parser.new(code)
14
14
  # tokens = parser.parse
15
- # iterator = Rlint::Iterator.new
15
+ # iterator = RubyLint::Iterator.new
16
16
  #
17
17
  # iterator.run(tokens)
18
18
  #
@@ -25,7 +25,7 @@ module Rlint
25
25
  # Without any custom callback classes the iterator class is fairly useless as
26
26
  # it does nothing but iterate over all the nodes. These classes are defined
27
27
  # as any ordinary class and are added to an interator instance using
28
- # {Rlint::Iterator#bind}. At the most basic level each callback class should
28
+ # {RubyLint::Iterator#bind}. At the most basic level each callback class should
29
29
  # have the following structure:
30
30
  #
31
31
  # class MyCallback
@@ -38,30 +38,30 @@ module Rlint
38
38
  # end
39
39
  #
40
40
  # The constructor method should take two parameters: the first one is used
41
- # for storing a instance of {Rlint::Report} (this parameter should be set to
41
+ # for storing a instance of {RubyLint::Report} (this parameter should be set to
42
42
  # `nil` by default). The second parameter is a Hash containing custom data
43
- # that is shared between callback classes bound to the same {Rlint::Iterator}
43
+ # that is shared between callback classes bound to the same {RubyLint::Iterator}
44
44
  # instance. This Hash can be used to share, for example, definitions defined
45
45
  # in callback class #1 with callback class #2.
46
46
  #
47
47
  # To make this, as well as adding errors and such to a report easier your own
48
- # classes can extend {Rlint::Callback}:
48
+ # classes can extend {RubyLint::Callback}:
49
49
  #
50
- # class MyCallback < Rlint::Callback
50
+ # class MyCallback < RubyLint::Callback
51
51
  #
52
52
  # end
53
53
  #
54
54
  # To add your class to an iterator instance you'd run the following:
55
55
  #
56
- # iterator = Rlint::Iterator.new
56
+ # iterator = RubyLint::Iterator.new
57
57
  #
58
58
  # iterator.bind(MyCallback)
59
59
  #
60
60
  # ## Callback Methods
61
61
  #
62
- # When iterating over an AST the method {Rlint::Iterator#iterator} calls two
62
+ # When iterating over an AST the method {RubyLint::Iterator#iterator} calls two
63
63
  # callback methods based on the event name stored in the token (in
64
- # {Rlint::Token::Token#event}):
64
+ # {RubyLint::Token::Token#event}):
65
65
  #
66
66
  # * `on_EVENT_NAME`
67
67
  # * `after_EVENT_NAME`
@@ -77,12 +77,12 @@ module Rlint
77
77
  #
78
78
  # Each method should take a single parameter that contains details about the
79
79
  # token that is currently being processed. Each token is an instance of
80
- # {Rlint::Token::Token} or one of its child classes.
80
+ # {RubyLint::Token::Token} or one of its child classes.
81
81
  #
82
82
  # If you wanted to display the values of all strings in your console you'd
83
83
  # write the following class:
84
84
  #
85
- # class StringPrinter < Rlint::Callback
85
+ # class StringPrinter < RubyLint::Callback
86
86
  # def on_string(token)
87
87
  # puts token.value
88
88
  # end
@@ -107,7 +107,7 @@ module Rlint
107
107
  ##
108
108
  # Creates a new instance of the iterator class.
109
109
  #
110
- # @param [Rlint::Report|NilClass] report The report to use, set to `nil` by
110
+ # @param [RubyLint::Report|NilClass] report The report to use, set to `nil` by
111
111
  # default.
112
112
  #
113
113
  def initialize(report = nil)
@@ -118,7 +118,7 @@ module Rlint
118
118
 
119
119
  ##
120
120
  # Processes the entire AST for each callback class in sequence. For each
121
- # callback class the method {Rlint::Iterator#iterate} is called to process
121
+ # callback class the method {RubyLint::Iterator#iterate} is called to process
122
122
  # an *entire* AST before moving on to the next callback class.
123
123
  #
124
124
  # @param [#each] nodes An array of nodes to process.
@@ -137,14 +137,14 @@ module Rlint
137
137
  # Processes an AST and calls callbacks methods for a specific callback
138
138
  # object.
139
139
  #
140
- # @param [Rlint::Callback] callback_obj The callback object on which to
140
+ # @param [RubyLint::Callback] callback_obj The callback object on which to
141
141
  # invoke callback method.
142
142
  # @param [#each] nodes An array (or a different object that responds to
143
143
  # `#each()`) that contains a set of tokens to process.
144
144
  #
145
145
  def iterate(callback_obj, nodes)
146
146
  nodes.each do |node|
147
- next unless node.is_a?(Rlint::Token::Token)
147
+ next unless node.is_a?(RubyLint::Token::Token)
148
148
 
149
149
  event_name = node.event.to_s
150
150
  callback_name = 'on_' + event_name
@@ -165,7 +165,7 @@ module Rlint
165
165
  # instance.
166
166
  #
167
167
  # @example
168
- # iterator = Rlint::Iterator.new
168
+ # iterator = RubyLint::Iterator.new
169
169
  #
170
170
  # iterator.bind(CustomCallbackClass)
171
171
  #
@@ -181,7 +181,7 @@ module Rlint
181
181
  # Loops through all the bound callback classes and executes the specified
182
182
  # callback method if it exists.
183
183
  #
184
- # @param [Rlint::Callback] obj The object on which to invoke the callback
184
+ # @param [RubyLint::Callback] obj The object on which to invoke the callback
185
185
  # method.
186
186
  # @param [String|Symbol] name The name of the callback method to execute.
187
187
  # @param [Array] args Arguments to pass to the callback method.
@@ -190,4 +190,4 @@ module Rlint
190
190
  obj.send(name, *args) if obj.respond_to?(name)
191
191
  end
192
192
  end # Iterator
193
- end # Rlint
193
+ end # RubyLint
@@ -1,7 +1,7 @@
1
- module Rlint
1
+ module RubyLint
2
2
  ##
3
- # {Rlint::Options} is a class that can be used to configure various parts of
4
- # Rlint such as what formatter to use, the reporting levels, etc.
3
+ # {RubyLint::Options} is a class that can be used to configure various parts of
4
+ # RubyLint such as what formatter to use, the reporting levels, etc.
5
5
  #
6
6
  class Options
7
7
  ##
@@ -13,16 +13,16 @@ module Rlint
13
13
  REQUIRED_ANALYZERS = [Analyze::Definitions]
14
14
 
15
15
  ##
16
- # The reporting formatter to use, set to {Rlint::Formatter::Text} by
16
+ # The reporting formatter to use, set to {RubyLint::Formatter::Text} by
17
17
  # default.
18
18
  #
19
- # @return [Rlint::Formatter]
19
+ # @return [RubyLint::Formatter]
20
20
  #
21
21
  attr_accessor :formatter
22
22
 
23
23
  ##
24
- # The enabled reporting levels. See {Rlint::Report#levels} and
25
- # {Rlint::Report#initialize} for more information.
24
+ # The enabled reporting levels. See {RubyLint::Report#levels} and
25
+ # {RubyLint::Report#initialize} for more information.
26
26
  #
27
27
  # @return [Array]
28
28
  #
@@ -30,7 +30,7 @@ module Rlint
30
30
 
31
31
  ##
32
32
  # Array of classes to use for analyzing code. By default all the classes
33
- # defined under {Rlint::Analyze} are used.
33
+ # defined under {RubyLint::Analyze} are used.
34
34
  #
35
35
  # @return [Array]
36
36
  #
@@ -55,4 +55,4 @@ module Rlint
55
55
  @options = Options.new
56
56
 
57
57
  class << self; attr_reader :options; end
58
- end # Rlint
58
+ end # RubyLint
@@ -1,16 +1,16 @@
1
- module Rlint
1
+ module RubyLint
2
2
  ##
3
- # {Rlint::Parser} uses Ripper to parse Ruby source code and turn it into an
3
+ # {RubyLint::Parser} uses Ripper to parse Ruby source code and turn it into an
4
4
  # AST. Instead of returning arrays (the Ripper default) this class uses the
5
- # various token classes such as {Rlint::Token::Token} and
6
- # {Rlint::Token::VariableToken}. It also takes care of a few more things such
5
+ # various token classes such as {RubyLint::Token::Token} and
6
+ # {RubyLint::Token::VariableToken}. It also takes care of a few more things such
7
7
  # as saving the associated line of code and setting method visibility.
8
8
  #
9
9
  # Parsing Ruby code requires two steps:
10
10
  #
11
11
  # 1. Create a new instance of this class and pass a string containing source
12
12
  # code to the constructor method.
13
- # 2. Call the method {Rlint::Parser#parse} and do something with the returned
13
+ # 2. Call the method {RubyLint::Parser#parse} and do something with the returned
14
14
  # AST.
15
15
  #
16
16
  # For example, to parse a simple "Hello World" example you'd use this parser
@@ -18,20 +18,20 @@ module Rlint
18
18
  #
19
19
  # require 'pp'
20
20
  #
21
- # parser = Rlint::Parser.new('puts "Hello, world!"')
21
+ # parser = RubyLint::Parser.new('puts "Hello, world!"')
22
22
  #
23
23
  # pp parser.parse
24
24
  #
25
25
  # This outputs the following AST:
26
26
  #
27
- # [#<Rlint::Token::MethodToken:0x000000012f04d0
27
+ # [#<RubyLint::Token::MethodToken:0x000000012f04d0
28
28
  # @code="puts \"Hello, world!\"",
29
29
  # @column=0,
30
30
  # @event=:method,
31
31
  # @line=1,
32
32
  # @name="puts",
33
33
  # @parameters=
34
- # [#<Rlint::Token::Token:0x000000012e9fb8
34
+ # [#<RubyLint::Token::Token:0x000000012e9fb8
35
35
  # @code="puts \"Hello, world!\"",
36
36
  # @column=6,
37
37
  # @event=:string,
@@ -73,7 +73,7 @@ module Rlint
73
73
 
74
74
  ##
75
75
  # Array of event names that should return an instance of
76
- # {Rlint::Token::MethodToken}.
76
+ # {RubyLint::Token::MethodToken}.
77
77
  #
78
78
  # @return [Array]
79
79
  #
@@ -107,7 +107,7 @@ module Rlint
107
107
  #
108
108
  DEFAULT_VISIBILITY = :public
109
109
 
110
- # Return an Rlint::Token::Token instance for each scanner event instead of
110
+ # Return an RubyLint::Token::Token instance for each scanner event instead of
111
111
  # an array with multiple indexes.
112
112
  SCANNER_EVENTS.each do |event|
113
113
  define_method("on_#{event}") do |token|
@@ -148,12 +148,12 @@ module Rlint
148
148
  end
149
149
  end
150
150
 
151
- MOD_STATEMENT_EVENTS.each do |ripper_event, rlint_event|
151
+ MOD_STATEMENT_EVENTS.each do |ripper_event, ruby_lint_event|
152
152
  define_method("on_#{ripper_event}") do |statement, value|
153
153
  value = [value] unless value.is_a?(Array)
154
154
 
155
155
  return Token::StatementToken.new(
156
- :type => rlint_event,
156
+ :type => ruby_lint_event,
157
157
  :statement => statement,
158
158
  :value => value,
159
159
  :line => lineno,
@@ -169,7 +169,7 @@ module Rlint
169
169
  #
170
170
  # @see Ripper::SexpBuilderPP#initialize
171
171
  #
172
- def initialize(code, file = '(rlint)', line = 1)
172
+ def initialize(code, file = '(ruby-lint)', line = 1)
173
173
  super
174
174
 
175
175
  @file = file
@@ -185,7 +185,7 @@ module Rlint
185
185
  # Called when a parser error was encountered.
186
186
  #
187
187
  # @param [String] message The error message.
188
- # @raise [Rlint::ParserError]
188
+ # @raise [RubyLint::ParserError]
189
189
  #
190
190
  def on_parse_error(message)
191
191
  raise ParserError.new(message, lineno, column, @file)
@@ -195,7 +195,7 @@ module Rlint
195
195
  # Called when a string literal was found.
196
196
  #
197
197
  # @param [Array] token Array containing details about the string.
198
- # @return [Rlint::Token::Token]
198
+ # @return [RubyLint::Token::Token]
199
199
  #
200
200
  def on_string_literal(token)
201
201
  if token and token[1]
@@ -214,8 +214,8 @@ module Rlint
214
214
  ##
215
215
  # Called when a symbol is found.
216
216
  #
217
- # @param [Rlint::Token::Token] token The symbol token.
218
- # @return [Rlint::Token::Token]
217
+ # @param [RubyLint::Token::Token] token The symbol token.
218
+ # @return [RubyLint::Token::Token]
219
219
  #
220
220
  def on_symbol(token)
221
221
  token.type = :symbol
@@ -226,7 +226,7 @@ module Rlint
226
226
  ##
227
227
  # Called when a symbol using quotes was found.
228
228
  #
229
- # @see Rlint::Parser#on_symbol
229
+ # @see RubyLint::Parser#on_symbol
230
230
  #
231
231
  def on_dyna_symbol(token)
232
232
  return on_symbol(token[0])
@@ -236,7 +236,7 @@ module Rlint
236
236
  # Called when an array is found.
237
237
  #
238
238
  # @param [Array] values The values of the array.
239
- # @return [Rlint::Token::Token]
239
+ # @return [RubyLint::Token::Token]
240
240
  #
241
241
  def on_array(values)
242
242
  values ||= []
@@ -253,9 +253,9 @@ module Rlint
253
253
  ##
254
254
  # Called when a reference to a particular array index is found.
255
255
  #
256
- # @param [Rlint::Token::Token] array The array that was referenced.
257
- # @param [Rlint::Token::Token] index The index that was referenced.
258
- # @return [Rlint::Token::Token]
256
+ # @param [RubyLint::Token::Token] array The array that was referenced.
257
+ # @param [RubyLint::Token::Token] index The index that was referenced.
258
+ # @return [RubyLint::Token::Token]
259
259
  #
260
260
  def on_aref(array, index)
261
261
  array.key = index
@@ -266,10 +266,10 @@ module Rlint
266
266
  ##
267
267
  # Called when a value is assigned to an array index.
268
268
  #
269
- # @param [Rlint::Token::Token] array The array that was referenced.
270
- # @param [Rlint::Token::Token] index The index of the array that was
269
+ # @param [RubyLint::Token::Token] array The array that was referenced.
270
+ # @param [RubyLint::Token::Token] index The index of the array that was
271
271
  # referenced.
272
- # @return [Rlint::Token::Token]
272
+ # @return [RubyLint::Token::Token]
273
273
  #
274
274
  def on_aref_field(array, index)
275
275
  array.key = index
@@ -287,7 +287,7 @@ module Rlint
287
287
  # Called when a Hash is found.
288
288
  #
289
289
  # @param [Array] pairs An array of key/value pairs of the hash.
290
- # @return [Rlint::Token::Token]
290
+ # @return [RubyLint::Token::Token]
291
291
  #
292
292
  def on_hash(pairs)
293
293
  # column() is set to the column number of the very end of the hash.
@@ -306,7 +306,7 @@ module Rlint
306
306
  # Called when a bare Hash is found. A bare Hash is a hash that's declared
307
307
  # without the curly braces.
308
308
  #
309
- # @see Rlint::Parser#on_hash
309
+ # @see RubyLint::Parser#on_hash
310
310
  #
311
311
  def on_bare_assoc_hash(pairs)
312
312
  return on_hash(pairs)
@@ -315,9 +315,9 @@ module Rlint
315
315
  ##
316
316
  # Called when a new key/value pair of a Hash is found.
317
317
  #
318
- # @param [Rlint::Token::Token] key The key of the pair.
319
- # @param [Rlint::Token::Token] value The value of the pair.
320
- # @return [Rlint::Token::Token]
318
+ # @param [RubyLint::Token::Token] key The key of the pair.
319
+ # @param [RubyLint::Token::Token] value The value of the pair.
320
+ # @return [RubyLint::Token::Token]
321
321
  #
322
322
  def on_assoc_new(key, value)
323
323
  key.name = key.value
@@ -329,10 +329,10 @@ module Rlint
329
329
  ##
330
330
  # Called when a block is created using curly braces.
331
331
  #
332
- # @param [Rlint::Token::ParametersToken] params The parameters of the
332
+ # @param [RubyLint::Token::ParametersToken] params The parameters of the
333
333
  # block.
334
334
  # @param [Array] body Array containing the tokens of the block.
335
- # @return [Rlint::Token::BlockToken]
335
+ # @return [RubyLint::Token::BlockToken]
336
336
  #
337
337
  def on_brace_block(params, body)
338
338
  return Token::BlockToken.new(
@@ -348,7 +348,7 @@ module Rlint
348
348
  ##
349
349
  # Called when a block is created using the do/end statements.
350
350
  #
351
- # @see Rlint::Parser#on_brace_block
351
+ # @see RubyLint::Parser#on_brace_block
352
352
  #
353
353
  def on_do_block(params, body)
354
354
  return on_brace_block(params, body)
@@ -357,7 +357,7 @@ module Rlint
357
357
  ##
358
358
  # Called when a lambda is found.
359
359
  #
360
- # @see Rlint::Parser#on_brace_block
360
+ # @see RubyLint::Parser#on_brace_block
361
361
  #
362
362
  def on_lambda(params, body)
363
363
  token = on_brace_block(params, body)
@@ -369,9 +369,9 @@ module Rlint
369
369
  ##
370
370
  # Called when a Range is found.
371
371
  #
372
- # @param [Rlint::Token::Token] start The start value of the range.
373
- # @param [Rlint::Token::Token] stop The end value of the range.
374
- # @return [Rlint::Token::Token]
372
+ # @param [RubyLint::Token::Token] start The start value of the range.
373
+ # @param [RubyLint::Token::Token] stop The end value of the range.
374
+ # @return [RubyLint::Token::Token]
375
375
  #
376
376
  def on_dot2(start, stop)
377
377
  return Token::Token.new(
@@ -387,8 +387,8 @@ module Rlint
387
387
  # Called when a regular expression is found.
388
388
  #
389
389
  # @param [Array] regexp The regular expression's value.
390
- # @param [Rlint::Token::Token] modes The modes of the regular expression.
391
- # @return [Rlint::Token::RegexpToken]
390
+ # @param [RubyLint::Token::Token] modes The modes of the regular expression.
391
+ # @return [RubyLint::Token::RegexpToken]
392
392
  #
393
393
  def on_regexp_literal(regexp, modes)
394
394
  regexp = regexp[0]
@@ -411,12 +411,12 @@ module Rlint
411
411
  ##
412
412
  # Called when a value is assigned to a variable.
413
413
  #
414
- # @param [Rlint::Token::Token] variable The variable that is assigned.
415
- # @param [Rlint::Token::Token] value The value to assign.
416
- # @return [Rlint::Token::VariableToken]
414
+ # @param [RubyLint::Token::Token] variable The variable that is assigned.
415
+ # @param [RubyLint::Token::Token] value The value to assign.
416
+ # @return [RubyLint::Token::VariableToken]
417
417
  #
418
418
  def on_assign(variable, value)
419
- if variable.class == Rlint::Token::AssignmentToken
419
+ if variable.class == RubyLint::Token::AssignmentToken
420
420
  variable.value = value
421
421
 
422
422
  return variable
@@ -449,7 +449,7 @@ module Rlint
449
449
  #
450
450
  # @param [Array] variables The variables that are being assigned values.
451
451
  # @param [Array] values The values to assign.
452
- # @return [Rlint::Token::AssignmentToken]
452
+ # @return [RubyLint::Token::AssignmentToken]
453
453
  #
454
454
  def on_massign(variables, values)
455
455
  return Token::AssignmentToken.new(
@@ -466,13 +466,13 @@ module Rlint
466
466
  ##
467
467
  # Called when a value is assigned to an object attribute.
468
468
  #
469
- # @param [Rlint::Token::VariableToken] receiver The receiver of the
469
+ # @param [RubyLint::Token::VariableToken] receiver The receiver of the
470
470
  # assignment.
471
471
  # @param [Symbol] operator The operator that was used to separate the
472
472
  # object and attribute.
473
- # @param [Rlint::Token::Token] attribute The attribute to which the value
473
+ # @param [RubyLint::Token::Token] attribute The attribute to which the value
474
474
  # is assigned.
475
- # @return [Rlint::Token::VariableToken]
475
+ # @return [RubyLint::Token::VariableToken]
476
476
  #
477
477
  def on_field(receiver, operator, attribute)
478
478
  return Token::AssignmentToken.new(
@@ -489,10 +489,10 @@ module Rlint
489
489
  ##
490
490
  # Called when a (binary) operator operation is performed.
491
491
  #
492
- # @param [Rlint::Token::Token] left The left hand side of the operator.
492
+ # @param [RubyLint::Token::Token] left The left hand side of the operator.
493
493
  # @param [Symbol] op The operator that was used.
494
- # @param [Rlint::Token::Token] right The right hand side of the operator.
495
- # @return [Rlint::Token::Token]
494
+ # @param [RubyLint::Token::Token] right The right hand side of the operator.
495
+ # @return [RubyLint::Token::Token]
496
496
  #
497
497
  def on_binary(left, op, right)
498
498
  return Token::Token.new(
@@ -508,8 +508,8 @@ module Rlint
508
508
  # Called when an unary operator/operation is found.
509
509
  #
510
510
  # @param [Symbol] operator The unary operator.
511
- # @param [Rlint::Token::Token] token The token after the unary operator.
512
- # @return [Rlint::Token::Token]
511
+ # @param [RubyLint::Token::Token] token The token after the unary operator.
512
+ # @return [RubyLint::Token::Token]
513
513
  #
514
514
  def on_unary(operator, token)
515
515
  return Token::Token.new(
@@ -525,7 +525,7 @@ module Rlint
525
525
  # Called when a set of parenthesis is found.
526
526
  #
527
527
  # @param [Array] value The data inside the parenthesis.
528
- # @return [Rlint::Token::Token]
528
+ # @return [RubyLint::Token::Token]
529
529
  #
530
530
  def on_paren(value)
531
531
  if value.is_a?(Array)
@@ -539,7 +539,7 @@ module Rlint
539
539
  # Called when a return statement is found.
540
540
  #
541
541
  # @param [Array] values The return values of the statement.
542
- # @return [Rlint::Token::StatementToken]
542
+ # @return [RubyLint::Token::StatementToken]
543
543
  #
544
544
  def on_return(values)
545
545
  source = code(lineno)
@@ -557,9 +557,9 @@ module Rlint
557
557
  ##
558
558
  # Called when a while loop is found.
559
559
  #
560
- # @param [Rlint::Token::Token] statement The statement to evaluate.
561
- # @param [Rlint::Token::Token] value The body of the while loop.
562
- # @return [Rlint::Token::StatementToken]
560
+ # @param [RubyLint::Token::Token] statement The statement to evaluate.
561
+ # @param [RubyLint::Token::Token] value The body of the while loop.
562
+ # @return [RubyLint::Token::StatementToken]
563
563
  #
564
564
  def on_while(statement, value)
565
565
  source = code(statement.line)
@@ -581,9 +581,9 @@ module Rlint
581
581
  # @param [Array] variables Array of variables to create for each iteration.
582
582
  #
583
583
  # pry_binding
584
- # @param [Rlint::Token::Token] enumerable The enumerable to iterate.
584
+ # @param [RubyLint::Token::Token] enumerable The enumerable to iterate.
585
585
  # @param [Array] value The body of the for loop.
586
- # @return [Rlint::Token::StatementToken]
586
+ # @return [RubyLint::Token::StatementToken]
587
587
  #
588
588
  def on_for(variables, enumerable, value)
589
589
  source = code(variables[0].line)
@@ -602,12 +602,12 @@ module Rlint
602
602
  ##
603
603
  # Called when an if statement is found.
604
604
  #
605
- # @param [Rlint::Token::Token] statement The if statement to evaluate.
605
+ # @param [RubyLint::Token::Token] statement The if statement to evaluate.
606
606
  # @param [Array] value Array containing the tokens of the code that will
607
607
  # be executed if the if statement evaluates to true.
608
608
  # @param [Array] rest Array containing the tokens for the elsif and else
609
609
  # statements (if any).
610
- # @return [Rlint::Token::StatementToken]
610
+ # @return [RubyLint::Token::StatementToken]
611
611
  #
612
612
  def on_if(statement, value, rest)
613
613
  source = code(statement.line)
@@ -643,7 +643,7 @@ module Rlint
643
643
  ##
644
644
  # Called whne a tenary operator is found.
645
645
  #
646
- # @see Rlint::Parser#on_if
646
+ # @see RubyLint::Parser#on_if
647
647
  #
648
648
  def on_ifop(statement, value, else_statement)
649
649
  else_statement = Token::StatementToken.new(
@@ -669,7 +669,7 @@ module Rlint
669
669
  # Called when an else statement is found.
670
670
  #
671
671
  # @param [Array] value The value of the statement.
672
- # @return [Rlint::Token::StatementToken]
672
+ # @return [RubyLint::Token::StatementToken]
673
673
  #
674
674
  def on_else(value)
675
675
  return Token::StatementToken.new(
@@ -684,9 +684,9 @@ module Rlint
684
684
  ##
685
685
  # Called when an elsif statement is found.
686
686
  #
687
- # @param [Rlint::Token::Token] statement The statement to evaluate.
687
+ # @param [RubyLint::Token::Token] statement The statement to evaluate.
688
688
  # @param [Array] value The value of the elsif statement.
689
- # @param [Array|Rlint::Token::Token] list A list of else and elsif
689
+ # @param [Array|RubyLint::Token::Token] list A list of else and elsif
690
690
  # statements.
691
691
  # @return [Array]
692
692
  #
@@ -716,11 +716,11 @@ module Rlint
716
716
  #
717
717
  # @param [Array] value Array containing the tokens of the body/statement.
718
718
  # @param [Array] rescues An array of rescue statements.
719
- # @param [Rlint::Token::StatementToken] else_statement The else statement
719
+ # @param [RubyLint::Token::StatementToken] else_statement The else statement
720
720
  # of the block.
721
- # @param [Rlint::Token::StatementToken] ensure_statement The ensure
721
+ # @param [RubyLint::Token::StatementToken] ensure_statement The ensure
722
722
  # statement of the block.
723
- # @return [Rlint::Token::BeginRescueToken]
723
+ # @return [RubyLint::Token::BeginRescueToken]
724
724
  #
725
725
  def on_bodystmt(value, rescues, else_statement, ensure_statement)
726
726
  if rescues.nil? and else_statement.nil? and ensure_statement.nil?
@@ -743,11 +743,11 @@ module Rlint
743
743
  # Called when a rescue statement is found.
744
744
  #
745
745
  # @param [Array] exceptions An array of exceptions to catch.
746
- # @param [Rlint::Token::Token] variable The variable in which to store
746
+ # @param [RubyLint::Token::Token] variable The variable in which to store
747
747
  # the exception details.
748
748
  # @param [Array] value The value of the rescue statement.
749
- # @param [Array|Rlint::Token::Token] list A set of all the rescue tokens.
750
- # @return [Rlint::Token::StatementToken]
749
+ # @param [Array|RubyLint::Token::Token] list A set of all the rescue tokens.
750
+ # @return [RubyLint::Token::StatementToken]
751
751
  #
752
752
  def on_rescue(exceptions, variable, value, list)
753
753
  source = code(lineno)
@@ -773,11 +773,11 @@ module Rlint
773
773
  # Called when a single line rescue statement (in the form of `[VALUE]
774
774
  # rescue [RESCUE VALUE]`) is found.
775
775
  #
776
- # @param [Rlint::Token::Token|Array] value The body of the begin/rescue
776
+ # @param [RubyLint::Token::Token|Array] value The body of the begin/rescue
777
777
  # statement.
778
- # @param [Rlint::Token::Token] statement The statement to evaluate when the
778
+ # @param [RubyLint::Token::Token] statement The statement to evaluate when the
779
779
  # data in `value` raised an exception.
780
- # @return [Rlint::Token::BeginRescueToken]
780
+ # @return [RubyLint::Token::BeginRescueToken]
781
781
  #
782
782
  def on_rescue_mod(value, statement)
783
783
  value = [value] unless value.is_a?(Array)
@@ -797,7 +797,7 @@ module Rlint
797
797
  # Called when an ensure statement is found.
798
798
  #
799
799
  # @param [Array] value The value of the statement.
800
- # @return [Rlint::Token::StatementToken]
800
+ # @return [RubyLint::Token::StatementToken]
801
801
  #
802
802
  def on_ensure(value)
803
803
  return Token::StatementToken.new(
@@ -812,11 +812,11 @@ module Rlint
812
812
  ##
813
813
  # Called for an entire case/when/else block.
814
814
  #
815
- # @param [Rlint::Token::Token] statement The statement of the `case`
815
+ # @param [RubyLint::Token::Token] statement The statement of the `case`
816
816
  # statement itself.
817
817
  # @param [Array] list Array containing the various when statements and
818
818
  # optionally an else statement.
819
- # @return [Rlint::Token::CaseToken]
819
+ # @return [RubyLint::Token::CaseToken]
820
820
  #
821
821
  def on_case(statement, list)
822
822
  when_statements = []
@@ -876,11 +876,11 @@ module Rlint
876
876
  ##
877
877
  # Called when a unless statement is found.
878
878
  #
879
- # @param [Rlint::Token::Token] statement The statement to evaluate.
879
+ # @param [RubyLint::Token::Token] statement The statement to evaluate.
880
880
  # @param [Array] body The body of the unless statement.
881
- # @param [Rlint::Token::StatementToken] else_token An optional else
881
+ # @param [RubyLint::Token::StatementToken] else_token An optional else
882
882
  # statement.
883
- # @return [Rlint::Token::StatementToken]
883
+ # @return [RubyLint::Token::StatementToken]
884
884
  #
885
885
  def on_unless(statement, body, else_token)
886
886
  source = code(statement.line)
@@ -900,7 +900,7 @@ module Rlint
900
900
  ##
901
901
  # Called when an until statement is found.
902
902
  #
903
- # @see Rlint::Parser#on_unless
903
+ # @see RubyLint::Parser#on_unless
904
904
  #
905
905
  def on_until(statement, body)
906
906
  source = code(statement.line)
@@ -919,8 +919,8 @@ module Rlint
919
919
  ##
920
920
  # Called when a variable is referenced.
921
921
  #
922
- # @param [Rlint::Token::Token] variable The variable that was referenced.
923
- # @return [Rlint::Token::VariableToken]
922
+ # @param [RubyLint::Token::Token] variable The variable that was referenced.
923
+ # @return [RubyLint::Token::VariableToken]
924
924
  #
925
925
  def on_var_ref(variable)
926
926
  return Token::VariableToken.new(
@@ -951,7 +951,7 @@ module Rlint
951
951
  ##
952
952
  # Called when a constant path is assigned.
953
953
  #
954
- # @see Rlint::Parser#on_const_path_ref
954
+ # @see RubyLint::Parser#on_const_path_ref
955
955
  #
956
956
  def on_const_path_field(*segments)
957
957
  return on_const_path_ref(*segments)
@@ -960,12 +960,12 @@ module Rlint
960
960
  ##
961
961
  # Called when a new method is defined.
962
962
  #
963
- # @param [Rlint::Token::Token] name Token containing details about the
963
+ # @param [RubyLint::Token::Token] name Token containing details about the
964
964
  # method name.
965
- # @param [Rlint::Token::ParametersToken] params Token containing details
965
+ # @param [RubyLint::Token::ParametersToken] params Token containing details
966
966
  # about the method parameters.
967
967
  # @param [Array] body Array containing the tokens of the method's body.
968
- # @return [Rlint::Token::MethodDefinitionToken]
968
+ # @return [RubyLint::Token::MethodDefinitionToken]
969
969
  #
970
970
  def on_def(name, params, body)
971
971
  return Token::MethodDefinitionToken.new(
@@ -983,14 +983,14 @@ module Rlint
983
983
  # Called when a method is defined on a specific constant/location
984
984
  # (e.g. `self`).
985
985
  #
986
- # @param [Rlint::Token::Token] receiver The object that the method was
986
+ # @param [RubyLint::Token::Token] receiver The object that the method was
987
987
  # defined on.
988
- # @param [Rlint::Token::Token] operator The operator that was used to
988
+ # @param [RubyLint::Token::Token] operator The operator that was used to
989
989
  # separate the receiver and method name.
990
- # @param [Rlint::Token::Token] name The name of the method.
991
- # @param [Rlint::Token::ParametersToken] params The method parameters.
990
+ # @param [RubyLint::Token::Token] name The name of the method.
991
+ # @param [RubyLint::Token::ParametersToken] params The method parameters.
992
992
  # @param [Array] body The body of the method.
993
- # @return [Rlint::Token::MethodDefinitionToken]
993
+ # @return [RubyLint::Token::MethodDefinitionToken]
994
994
  #
995
995
  def on_defs(receiver, operator, name, params, body)
996
996
  token = on_def(name, params, body)
@@ -1011,7 +1011,7 @@ module Rlint
1011
1011
  # * 4: the block parameter (if any)
1012
1012
  #
1013
1013
  # @param [Array] args Array containing all the passed method parameters.
1014
- # @return [Rlint::Token::ParametersToken]
1014
+ # @return [RubyLint::Token::ParametersToken]
1015
1015
  #
1016
1016
  def on_params(*args)
1017
1017
  # Convert all the arguments from regular Token instances to VariableToken
@@ -1060,12 +1060,12 @@ module Rlint
1060
1060
  ##
1061
1061
  # Called when a method call using parenthesis is found.
1062
1062
  #
1063
- # @param [Rlint::Token::Token] name The name of the method that was called.
1063
+ # @param [RubyLint::Token::Token] name The name of the method that was called.
1064
1064
  # @param [Array] params The parameters of the method call.
1065
- # @return [Rlint::Token::MethodToken]
1065
+ # @return [RubyLint::Token::MethodToken]
1066
1066
  #
1067
1067
  def on_method_add_arg(name, params)
1068
- if name.class == Rlint::Token::MethodToken
1068
+ if name.class == RubyLint::Token::MethodToken
1069
1069
  name.parameters = params
1070
1070
 
1071
1071
  return name
@@ -1083,11 +1083,11 @@ module Rlint
1083
1083
  ##
1084
1084
  # Called when a block is passed to a method call.
1085
1085
  #
1086
- # @param [Rlint::Token::MethodToken] method Token class for the method that
1086
+ # @param [RubyLint::Token::MethodToken] method Token class for the method that
1087
1087
  # the block is passed to.
1088
- # @param [Rlint::Token::BlockToken] block The block that was passed to the
1088
+ # @param [RubyLint::Token::BlockToken] block The block that was passed to the
1089
1089
  # method.
1090
- # @return [Rlint::Token::MethodToken]
1090
+ # @return [RubyLint::Token::MethodToken]
1091
1091
  #
1092
1092
  def on_method_add_block(method, block)
1093
1093
  method.block = block
@@ -1098,10 +1098,10 @@ module Rlint
1098
1098
  ##
1099
1099
  # Called when a class declaration is found.
1100
1100
  #
1101
- # @param [Array|Rlint::Token::Token] name The name of the class.
1101
+ # @param [Array|RubyLint::Token::Token] name The name of the class.
1102
1102
  # @param [Array|NilClass] parent The name of the parent class.
1103
1103
  # @param [Array] body The body of the class.
1104
- # @return [Rlint::Token::ClassToken]
1104
+ # @return [RubyLint::Token::ClassToken]
1105
1105
  #
1106
1106
  def on_class(name, parent, body)
1107
1107
  name_segments = name.name.is_a?(Array) ? name.name : [name.name]
@@ -1130,7 +1130,7 @@ module Rlint
1130
1130
  # Called when a set of class methods are added using a `class << self`
1131
1131
  # block.
1132
1132
  #
1133
- # @param [Rlint::Token::VariableToken] receiver The receiver for all the
1133
+ # @param [RubyLint::Token::VariableToken] receiver The receiver for all the
1134
1134
  # methods.
1135
1135
  # @param [Array] value The body of the block.
1136
1136
  # @return [Array]
@@ -1150,10 +1150,10 @@ module Rlint
1150
1150
  ##
1151
1151
  # Called when a module definition is found.
1152
1152
  #
1153
- # @param [Rlint::Token::Token|Array] name The name of the module, either a
1153
+ # @param [RubyLint::Token::Token|Array] name The name of the module, either a
1154
1154
  # single token class or an array of token classes.
1155
1155
  # @param [Array|NilClass] body The body of the module.
1156
- # @return [Rlint::Token::Token]
1156
+ # @return [RubyLint::Token::Token]
1157
1157
  #
1158
1158
  def on_module(name, body)
1159
1159
  name_segments = name.name.is_a?(Array) ? name.name : [name.name]
@@ -1171,7 +1171,7 @@ module Rlint
1171
1171
  ##
1172
1172
  # Called when a method call without parenthesis was found.
1173
1173
  #
1174
- # @see Rlint::Parser#on_method_add_arg
1174
+ # @see RubyLint::Parser#on_method_add_arg
1175
1175
  #
1176
1176
  def on_command(name, params)
1177
1177
  return on_method_add_arg(name, params)
@@ -1180,13 +1180,13 @@ module Rlint
1180
1180
  ##
1181
1181
  # Called when a method was invoked on an object.
1182
1182
  #
1183
- # @param [Rlint::Token::Token] receiver The object that the method was
1183
+ # @param [RubyLint::Token::Token] receiver The object that the method was
1184
1184
  # invoked on.
1185
1185
  # @param [Symbol] operator The operator that was used to separate the
1186
1186
  # receiver and method name.
1187
- # @param [Rlint::Token::Token] name Token containing details about the
1187
+ # @param [RubyLint::Token::Token] name Token containing details about the
1188
1188
  # method name.
1189
- # @return [Rlint::Token::MethodToken]
1189
+ # @return [RubyLint::Token::MethodToken]
1190
1190
  #
1191
1191
  def on_call(receiver, operator, name)
1192
1192
  return Token::MethodToken.new(
@@ -1202,9 +1202,9 @@ module Rlint
1202
1202
  ##
1203
1203
  # Called when a method was invoked on an object without using parenthesis.
1204
1204
  #
1205
- # @see Rlint::Parser#on_call
1205
+ # @see RubyLint::Parser#on_call
1206
1206
  # @param [Array] params The parameters passed to the method.
1207
- # @return [Rlint::Token::MethodToken]
1207
+ # @return [RubyLint::Token::MethodToken]
1208
1208
  #
1209
1209
  def on_command_call(receiver, operator, name, params)
1210
1210
  return Token::MethodToken.new(
@@ -1249,4 +1249,4 @@ module Rlint
1249
1249
  return number
1250
1250
  end
1251
1251
  end # Parser
1252
- end # Rlint
1252
+ end # RubyLint