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
data/.yardopts CHANGED
@@ -1,4 +1,4 @@
1
- ./lib/rlint/**/*.rb ./lib/rlint.rb
1
+ ./lib/ruby-lint/**/*.rb ./lib/ruby-lint.rb
2
2
  -m markdown
3
3
  -M redcarpet
4
4
  -o ./doc/build
data/MANIFEST CHANGED
@@ -6,74 +6,77 @@ LICENSE
6
6
  MANIFEST
7
7
  README.md
8
8
  Rakefile
9
- bin/rlint
9
+ bin/ruby-lint
10
10
  doc/.gitkeep
11
11
  doc/build/.gitkeep
12
12
  doc/css/.gitkeep
13
13
  doc/css/common.css
14
- lib/rlint.rb
15
- lib/rlint/analyze/coding_style.rb
16
- lib/rlint/analyze/definitions.rb
17
- lib/rlint/analyze/method_validation.rb
18
- lib/rlint/analyze/shadowing_variables.rb
19
- lib/rlint/analyze/undefined_variables.rb
20
- lib/rlint/analyze/unused_variables.rb
21
- lib/rlint/callback.rb
22
- lib/rlint/cli.rb
23
- lib/rlint/constant_importer.rb
24
- lib/rlint/definition.rb
25
- lib/rlint/formatter/text.rb
26
- lib/rlint/helper/definition_resolver.rb
27
- lib/rlint/helper/scoping.rb
28
- lib/rlint/iterator.rb
29
- lib/rlint/options.rb
30
- lib/rlint/parser.rb
31
- lib/rlint/parser_error.rb
32
- lib/rlint/report.rb
33
- lib/rlint/token/assignment_token.rb
34
- lib/rlint/token/begin_rescue_token.rb
35
- lib/rlint/token/block_token.rb
36
- lib/rlint/token/case_token.rb
37
- lib/rlint/token/class_token.rb
38
- lib/rlint/token/method_definition_token.rb
39
- lib/rlint/token/method_token.rb
40
- lib/rlint/token/parameters_token.rb
41
- lib/rlint/token/regexp_token.rb
42
- lib/rlint/token/statement_token.rb
43
- lib/rlint/token/token.rb
44
- lib/rlint/token/variable_token.rb
45
- lib/rlint/version.rb
14
+ lib/ruby-lint.rb
15
+ lib/ruby-lint/analyze/coding_style.rb
16
+ lib/ruby-lint/analyze/definitions.rb
17
+ lib/ruby-lint/analyze/method_validation.rb
18
+ lib/ruby-lint/analyze/shadowing_variables.rb
19
+ lib/ruby-lint/analyze/undefined_variables.rb
20
+ lib/ruby-lint/analyze/unused_variables.rb
21
+ lib/ruby-lint/callback.rb
22
+ lib/ruby-lint/cli.rb
23
+ lib/ruby-lint/constant_importer.rb
24
+ lib/ruby-lint/definition.rb
25
+ lib/ruby-lint/formatter/text.rb
26
+ lib/ruby-lint/helper/definition_resolver.rb
27
+ lib/ruby-lint/helper/scoping.rb
28
+ lib/ruby-lint/iterator.rb
29
+ lib/ruby-lint/options.rb
30
+ lib/ruby-lint/parser.rb
31
+ lib/ruby-lint/parser_error.rb
32
+ lib/ruby-lint/report.rb
33
+ lib/ruby-lint/token/assignment_token.rb
34
+ lib/ruby-lint/token/begin_rescue_token.rb
35
+ lib/ruby-lint/token/block_token.rb
36
+ lib/ruby-lint/token/case_token.rb
37
+ lib/ruby-lint/token/class_token.rb
38
+ lib/ruby-lint/token/method_definition_token.rb
39
+ lib/ruby-lint/token/method_token.rb
40
+ lib/ruby-lint/token/parameters_token.rb
41
+ lib/ruby-lint/token/regexp_token.rb
42
+ lib/ruby-lint/token/statement_token.rb
43
+ lib/ruby-lint/token/token.rb
44
+ lib/ruby-lint/token/variable_token.rb
45
+ lib/ruby-lint/version.rb
46
46
  ruby-lint.gemspec
47
47
  spec/benchmarks/memory.rb
48
48
  spec/benchmarks/parse_parser.rb
49
+ spec/fixtures/stdlib/un.rb
49
50
  spec/helper.rb
50
- spec/rlint/analyze/coding_style.rb
51
- spec/rlint/analyze/definitions/classes.rb
52
- spec/rlint/analyze/definitions/methods.rb
53
- spec/rlint/analyze/definitions/modules.rb
54
- spec/rlint/analyze/definitions/variables.rb
55
- spec/rlint/analyze/method_validation.rb
56
- spec/rlint/analyze/shadowing_variables.rb
57
- spec/rlint/analyze/undefined_variables.rb
58
- spec/rlint/analyze/unused_variables.rb
59
- spec/rlint/callback.rb
60
- spec/rlint/constant_importer.rb
61
- spec/rlint/definition.rb
62
- spec/rlint/formatter/text.rb
63
- spec/rlint/iterator.rb
64
- spec/rlint/parser/arrays.rb
65
- spec/rlint/parser/classes.rb
66
- spec/rlint/parser/errors.rb
67
- spec/rlint/parser/hashes.rb
68
- spec/rlint/parser/methods.rb
69
- spec/rlint/parser/modules.rb
70
- spec/rlint/parser/objects.rb
71
- spec/rlint/parser/operators.rb
72
- spec/rlint/parser/procs.rb
73
- spec/rlint/parser/ranges.rb
74
- spec/rlint/parser/regexp.rb
75
- spec/rlint/parser/scalars.rb
76
- spec/rlint/parser/statements.rb
77
- spec/rlint/parser/variables.rb
78
- spec/rlint/report.rb
51
+ spec/ruby-lint/analyze/coding_style.rb
52
+ spec/ruby-lint/analyze/complex/un.rb
53
+ spec/ruby-lint/analyze/definitions/classes.rb
54
+ spec/ruby-lint/analyze/definitions/methods.rb
55
+ spec/ruby-lint/analyze/definitions/modules.rb
56
+ spec/ruby-lint/analyze/definitions/variables.rb
57
+ spec/ruby-lint/analyze/method_validation.rb
58
+ spec/ruby-lint/analyze/shadowing_variables.rb
59
+ spec/ruby-lint/analyze/undefined_variables.rb
60
+ spec/ruby-lint/analyze/unused_variables.rb
61
+ spec/ruby-lint/callback.rb
62
+ spec/ruby-lint/constant_importer.rb
63
+ spec/ruby-lint/definition.rb
64
+ spec/ruby-lint/formatter/text.rb
65
+ spec/ruby-lint/iterator.rb
66
+ spec/ruby-lint/parser/arrays.rb
67
+ spec/ruby-lint/parser/classes.rb
68
+ spec/ruby-lint/parser/errors.rb
69
+ spec/ruby-lint/parser/hashes.rb
70
+ spec/ruby-lint/parser/methods.rb
71
+ spec/ruby-lint/parser/modules.rb
72
+ spec/ruby-lint/parser/objects.rb
73
+ spec/ruby-lint/parser/operators.rb
74
+ spec/ruby-lint/parser/procs.rb
75
+ spec/ruby-lint/parser/ranges.rb
76
+ spec/ruby-lint/parser/regexp.rb
77
+ spec/ruby-lint/parser/scalars.rb
78
+ spec/ruby-lint/parser/statements.rb
79
+ spec/ruby-lint/parser/variables.rb
80
+ spec/ruby-lint/report.rb
81
+ task/manifest.rake
79
82
  task/test.rake
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # README
2
2
 
3
- **Rlint is currently alpha quality, expect things to break and change without
3
+ **RubyLint is currently alpha quality, expect things to break and change without
4
4
  notice. Patches and bug reports are more than welcome.**
5
5
 
6
- Rlint (short name for Ruby Lint) is a linter and static code analysis tool for
7
- Ruby inspired by similar tools such as JSHint. It makes it possible for
8
- developers to detect errors such as undefined (or unused) variables and the
9
- use of non existing methods.
6
+ Ruby Lint is a linter and static code analysis tool for Ruby inspired by
7
+ similar tools such as JSHint. It makes it possible for developers to detect
8
+ errors such as undefined (or unused) variables and the use of non existing
9
+ methods.
10
10
 
11
11
  ## Requirements
12
12
 
@@ -15,32 +15,133 @@ use of non existing methods.
15
15
 
16
16
  ## Installation
17
17
 
18
- Rlint can be installed by running the following command:
18
+ RubyLint can be installed by running the following command:
19
19
 
20
- $ gem install ruby-lint
20
+ $ gem install ruby-lint --pre
21
+
22
+ Once a stable version has been released the `--pre` switch is no longer
23
+ required.
21
24
 
22
25
  Please note that there already is an existing gem called "rlint". This Gem is
23
26
  **not** the same, it just happens to be a similar project (one that seems
24
27
  abandoned) that uses the same name.
25
28
 
29
+ ## Usage
30
+
31
+ RubyLint can be used in two different ways: using the CLI interface and by using
32
+ the Ruby code directly.
33
+
34
+ The CLI can be used using the command `rlint`, see the output of `rlint --help`
35
+ for more information on how to configure it and how to analyze Ruby files.
36
+
37
+ The Ruby code itself takes a bit more effort but gives you more flexibility. In
38
+ the future you'll also be able to customize RubyLint using a Ruby configuration
39
+ files. In order to analyze Ruby code you'll need a few things:
40
+
41
+ * An instance of `RubyLint::Iterator`
42
+ * An instance of `RubyLint::Report`
43
+ * A formatter for the report
44
+ * A block of Ruby code
45
+ * A number of analyzer classes such as `RubyLint::Analyze::UndefinedVariables`
46
+
47
+ A short example is the following:
48
+
49
+ require 'ruby-lint'
50
+
51
+ code = 'obviously your Ruby code goes in here'
52
+ tokens = RubyLint::Parser.new(code).parse
53
+ report = RubyLint::Report.new
54
+ formatter = RubyLint::Formatter.new
55
+ iterator = RubyLint::Iterator.new(report)
56
+
57
+ iterator.bind(RubyLint::Analyze::Definitions)
58
+ iterator.bind(RubyLint::Analyze::MethodValidation)
59
+
60
+ iterator.run(tokens)
61
+
62
+ puts formatter.format(report)
63
+
64
+ ## Design
65
+
66
+ RubyLint's design is broken up into 5 different parts:
67
+
68
+ * A parser that turns a block of Ruby code into an AST.
69
+ * A class that iterates over this AST and executes callback methods (aptly
70
+ named `RubyLint::Iterator`).
71
+ * A set of callback classes that are used by an iterator. These callback
72
+ classes perform the actual data analysis.
73
+ * A report for storing error messages, warnings and informal messages.
74
+ * A formatter that turns a report into something useful such as plain text or
75
+ JSON.
76
+
77
+ The process of analyzing code basically looks like the following:
78
+
79
+ +------+
80
+ | Code |
81
+ +------+
82
+ |
83
+ v
84
+ +---------------+
85
+ | RubyLint::Parser |
86
+ +---------------+
87
+ |
88
+ v
89
+ +-----------------+
90
+ | RubyLint::Iterator |
91
+ +-----------------+
92
+ |
93
+ v
94
+ +---------------------------+
95
+ | RubyLint::Callback instances |
96
+ +---------------------------+
97
+ |
98
+ v
99
+ +---------------+
100
+ | RubyLint::Report |
101
+ +---------------+
102
+ |
103
+ v
104
+ +----------------------------+
105
+ | RubyLint::Formatter instances |
106
+ +----------------------------+
107
+ |
108
+ v
109
+ +------------------+
110
+ | Something useful |
111
+ +------------------+
112
+
113
+ The advantage of this setup is that different tasks are decoupled (where
114
+ possible) and that it's fairly trivial to write custom formatters that spit out
115
+ JSON, HTML, XML or something else. It also makes things easier to maintain as
116
+ there's no single giant lump of code that does everything.
117
+
26
118
  ## Compatibility Issues
27
119
 
28
- Currently Rlint can only be executed using MRI 1.9.3, it does not run on MRI
120
+ Currently RubyLint can only be executed using MRI 1.9.3, it does not run on MRI
29
121
  1.8.x due to the lack of Ripper. It also does not yet run without errors on
30
122
  MRI 2.0 as the addition of named variables changes the Ripper output, something
31
- Rlint doesn't properly handle at the moment.
123
+ RubyLint doesn't properly handle at the moment.
32
124
 
33
- For the time being Rlint will stick to using Ripper which means it's also
125
+ For the time being RubyLint will stick to using Ripper which means it's also
34
126
  limited to MRI 1.9.x/2.0.x. I've been looking around for alternatives so that
35
- Rlint can be run on Jruby/Rubinius in the future but so far I haven't really
36
- found a worthy alternative. For now I'd rather focus on making Rlint work on
127
+ RubyLint can be run on Jruby/Rubinius in the future but so far I haven't really
128
+ found a worthy alternative. For now I'd rather focus on making RubyLint work on
37
129
  one implementation instead of a number of different ones.
38
130
 
39
- Also keep in mind that while in theory Rlint should run on MRI 1.8.x I couldn't
131
+ Also keep in mind that while in theory RubyLint should run on MRI 1.8.x I couldn't
40
132
  get the "ripper" gem to install properly, thus I'm unable to confirm this. Feel
41
133
  free to try it out but I won't bother with MRI 1.8.x myself if it requires more
42
134
  than a few minutes worth of work.
43
135
 
136
+ ## TODO
137
+
138
+ * Allow options to be set and libraries to be loaded using a configuration
139
+ file (`./.rlint.rb` and `~/.rlint.rb`).
140
+ * Handle named parameters in Ruby 2.0 (and other potential differences).
141
+ * Validate the parameters passed to method calls where possible.
142
+ * Better/more up to date documentation.
143
+ * Testing, testing and more testing.
144
+
44
145
  ## License
45
146
 
46
147
  All source code in this repository is licensed under the MIT license unless
data/bin/ruby-lint ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path('../../lib/ruby-lint', __FILE__)
4
+ require 'ruby-lint/cli'
5
+
6
+ RubyLint::CLI.new.run
data/lib/ruby-lint.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'ripper'
2
+
3
+ unless $:.include?(File.expand_path('../', __FILE__))
4
+ $:.unshift(File.expand_path('../', __FILE__))
5
+ end
6
+
7
+ require 'ruby-lint/version'
8
+ require 'ruby-lint/parser'
9
+ require 'ruby-lint/token/token'
10
+ require 'ruby-lint/token/variable_token'
11
+ require 'ruby-lint/token/statement_token'
12
+ require 'ruby-lint/token/begin_rescue_token'
13
+ require 'ruby-lint/token/method_definition_token'
14
+ require 'ruby-lint/token/parameters_token'
15
+ require 'ruby-lint/token/method_token'
16
+ require 'ruby-lint/token/block_token'
17
+ require 'ruby-lint/token/assignment_token'
18
+ require 'ruby-lint/token/case_token'
19
+ require 'ruby-lint/token/regexp_token'
20
+ require 'ruby-lint/token/class_token'
21
+ require 'ruby-lint/parser_error'
22
+ require 'ruby-lint/iterator'
23
+ require 'ruby-lint/callback'
24
+ require 'ruby-lint/report'
25
+ require 'ruby-lint/definition'
26
+ require 'ruby-lint/constant_importer'
27
+ require 'ruby-lint/formatter/text'
28
+ require 'ruby-lint/helper/scoping'
29
+ require 'ruby-lint/helper/definition_resolver'
30
+ require 'ruby-lint/analyze/coding_style'
31
+ require 'ruby-lint/analyze/definitions'
32
+ require 'ruby-lint/analyze/unused_variables'
33
+ require 'ruby-lint/analyze/undefined_variables'
34
+ require 'ruby-lint/analyze/shadowing_variables'
35
+ require 'ruby-lint/analyze/method_validation'
36
+ require 'ruby-lint/options'
@@ -1,7 +1,7 @@
1
- module Rlint
1
+ module RubyLint
2
2
  module Analyze
3
3
  ##
4
- # {Rlint::Analyze::CodingStyle} checks if a block of code matches a given
4
+ # {RubyLint::Analyze::CodingStyle} checks if a block of code matches a given
5
5
  # set of coding standards. While none of the problems found by this class
6
6
  # are considered harmful they are usually frowned upon as they do not
7
7
  # follow the unofficial but generally accepted Ruby coding standards.
@@ -21,7 +21,7 @@ module Rlint
21
21
  # This class checks for the following:
22
22
  #
23
23
  # * The length of method and variable names, should be less than the value
24
- # set in {Rlint::Analyze::CodingStyle::MAXIMUM\_NAME\_LENGTH}.
24
+ # set in {RubyLint::Analyze::CodingStyle::MAXIMUM\_NAME\_LENGTH}.
25
25
  # * The use of class variables (it's relatively rare that you actually need
26
26
  # those).
27
27
  # * The use of parenthesis around various statements: these are not needed
@@ -32,7 +32,7 @@ module Rlint
32
32
  # * If a particular method name should be replaced by a different one (e.g.
33
33
  # "map" instead of "collect").
34
34
  #
35
- class CodingStyle < Rlint::Callback
35
+ class CodingStyle < RubyLint::Callback
36
36
  ##
37
37
  # A short description of this class.
38
38
  #
@@ -62,7 +62,7 @@ module Rlint
62
62
  }
63
63
 
64
64
  ##
65
- # @see Rlint::Callback#initialize
65
+ # @see RubyLint::Callback#initialize
66
66
  #
67
67
  def initialize(*args)
68
68
  super
@@ -79,9 +79,9 @@ module Rlint
79
79
  # * Whether or not instance variables are `snake_cased` instead of
80
80
  # camelCased.
81
81
  # * Whether or not the length of an instance variable is smaller than the
82
- # value defined in {Rlint::Analyze::CodingStyle::MAXIMUM\_NAME\_LENGTH}.
82
+ # value defined in {RubyLint::Analyze::CodingStyle::MAXIMUM\_NAME\_LENGTH}.
83
83
  #
84
- # @param [Rlint::Token::VariableToken] token The token containing details
84
+ # @param [RubyLint::Token::VariableToken] token The token containing details
85
85
  # about the variable.
86
86
  #
87
87
  def on_instance_variable(token)
@@ -92,10 +92,10 @@ module Rlint
92
92
  # Called when a class variable is found.
93
93
  #
94
94
  # This method will check for the same things as
95
- # {Rlint::Analyze::CodingStyle#on_instance_variable} along with adding an
95
+ # {RubyLint::Analyze::CodingStyle#on_instance_variable} along with adding an
96
96
  # info message about class variables being discouraged.
97
97
  #
98
- # @see Rlint::Analyze::CodingStyle#on_instance_variable
98
+ # @see RubyLint::Analyze::CodingStyle#on_instance_variable
99
99
  #
100
100
  def on_class_variable(token)
101
101
  validate_name(token)
@@ -110,7 +110,7 @@ module Rlint
110
110
  ##
111
111
  # Called when a constant is found.
112
112
  #
113
- # @see Rlint::Analyze::CodingStyle#on_instance_variable
113
+ # @see RubyLint::Analyze::CodingStyle#on_instance_variable
114
114
  #
115
115
  def on_constant(token)
116
116
  validate_name_length(token)
@@ -119,7 +119,7 @@ module Rlint
119
119
  ##
120
120
  # Called when a global variable is found.
121
121
  #
122
- # @see Rlint::Analyze::CodingStyle#on_instance_variable
122
+ # @see RubyLint::Analyze::CodingStyle#on_instance_variable
123
123
  #
124
124
  def on_global_variable(token)
125
125
  validate_name(token)
@@ -128,7 +128,7 @@ module Rlint
128
128
  ##
129
129
  # Called when an instance variable is found.
130
130
  #
131
- # @see Rlint::Analyze::CodingStyle#on_instance_variable
131
+ # @see RubyLint::Analyze::CodingStyle#on_instance_variable
132
132
  #
133
133
  def on_local_variable(token)
134
134
  validate_name(token)
@@ -141,8 +141,8 @@ module Rlint
141
141
  # instance variables) as well as adding a warning when an instance
142
142
  # variable is assigned.
143
143
  #
144
- # @see Rlint::Analyze::CodingStyle#on_instance_variable
145
- # @see Rlint::Analyze::CodingStyle#on_class_variable
144
+ # @see RubyLint::Analyze::CodingStyle#on_instance_variable
145
+ # @see RubyLint::Analyze::CodingStyle#on_class_variable
146
146
  #
147
147
  def on_assignment(token)
148
148
  validate_name(token)
@@ -159,7 +159,7 @@ module Rlint
159
159
  ##
160
160
  # Called when a return statement is found.
161
161
  #
162
- # @param [Rlint::Token::StatementToken] token The token of the return
162
+ # @param [RubyLint::Token::StatementToken] token The token of the return
163
163
  # statement.
164
164
  #
165
165
  def on_return(token)
@@ -184,7 +184,7 @@ module Rlint
184
184
  # to instance variables as well as checking if the method definition
185
185
  # modifies a core Ruby constant.
186
186
  #
187
- # @see Rlint::Analyze::CodingStyle#on_instance_variable
187
+ # @see RubyLint::Analyze::CodingStyle#on_instance_variable
188
188
  #
189
189
  def on_method_definition(token)
190
190
  validate_name(token)
@@ -200,7 +200,7 @@ module Rlint
200
200
  # Called when a class is created. This callback adds a warning if a core
201
201
  # Ruby constant is modified.
202
202
  #
203
- # @param [Rlint::Token::ClassToken] token Token class containing details
203
+ # @param [RubyLint::Token::ClassToken] token Token class containing details
204
204
  # about the newly created class.
205
205
  #
206
206
  def on_class(token)
@@ -211,7 +211,7 @@ module Rlint
211
211
  # Called after a method token has been processed. This callback checks if
212
212
  # a method is a predicate method and if so if the name is set correctly.
213
213
  #
214
- # @param [Rlint::Token::MethodDefinitionToken] token The token containing
214
+ # @param [RubyLint::Token::MethodDefinitionToken] token The token containing
215
215
  # details about the method definition.
216
216
  # @todo This method currently only performs a very limited check for
217
217
  # predicate methods. Once a proper scoping system has been implemented
@@ -236,7 +236,7 @@ module Rlint
236
236
  # This method checks if the used method should be named differently
237
237
  # instead (e.g. "map" instead of "collect").
238
238
  #
239
- # @param [Rlint::Token::MethodToken] token Token containing details about
239
+ # @param [RubyLint::Token::MethodToken] token Token containing details about
240
240
  # the method.
241
241
  #
242
242
  def on_method(token)
@@ -260,7 +260,7 @@ module Rlint
260
260
  # This method checks to see if there are any parenthesis around the
261
261
  # statement and adds an info message if this is the case.
262
262
  #
263
- # @param [Rlint::Token::StatementToken] token The token containing
263
+ # @param [RubyLint::Token::StatementToken] token The token containing
264
264
  # details about the if statement.
265
265
  #
266
266
  def on_if(token)
@@ -270,7 +270,7 @@ module Rlint
270
270
  ##
271
271
  # Called when an elsif statement is found.
272
272
  #
273
- # @see Rlint::Analyze::CodingStyle#on_if
273
+ # @see RubyLint::Analyze::CodingStyle#on_if
274
274
  #
275
275
  def on_elsif(token)
276
276
  validate_parenthesis(token)
@@ -279,7 +279,7 @@ module Rlint
279
279
  ##
280
280
  # Called when a while statement is found.
281
281
  #
282
- # @see Rlint::Analyze::CodingStyle#on_if
282
+ # @see RubyLint::Analyze::CodingStyle#on_if
283
283
  #
284
284
  def on_while(token)
285
285
  validate_parenthesis(token)
@@ -288,7 +288,7 @@ module Rlint
288
288
  ##
289
289
  # Called when a case statement is found.
290
290
  #
291
- # @see Rlint::Analyze::CodingStyle#on_if
291
+ # @see RubyLint::Analyze::CodingStyle#on_if
292
292
  #
293
293
  def on_case(token)
294
294
  validate_parenthesis(token)
@@ -297,7 +297,7 @@ module Rlint
297
297
  ##
298
298
  # Called when a when statement is found.
299
299
  #
300
- # @see Rlint::Analyze::CodingStyle#on_if
300
+ # @see RubyLint::Analyze::CodingStyle#on_if
301
301
  #
302
302
  def on_when(token)
303
303
  validate_parenthesis(token)
@@ -306,7 +306,7 @@ module Rlint
306
306
  ##
307
307
  # Called when an until statement is found.
308
308
  #
309
- # @see Rlint::Analyze::CodingStyle#on_if
309
+ # @see RubyLint::Analyze::CodingStyle#on_if
310
310
  #
311
311
  def on_until(token)
312
312
  validate_parenthesis(token)
@@ -315,7 +315,7 @@ module Rlint
315
315
  ##
316
316
  # Called when an unless statement is found.
317
317
  #
318
- # @see Rlint::Analyze::CodingStyle#on_if
318
+ # @see RubyLint::Analyze::CodingStyle#on_if
319
319
  #
320
320
  def on_unless(token)
321
321
  validate_parenthesis(token)
@@ -327,7 +327,7 @@ module Rlint
327
327
  # Validates the name of the specified token. This method will check for
328
328
  # the use of camelCase as well as checking for the length of the name.
329
329
  #
330
- # @param [Rlint::Token::Token] token The token to validate.
330
+ # @param [RubyLint::Token::Token] token The token to validate.
331
331
  #
332
332
  def validate_name(token)
333
333
  if !token.respond_to?(:name) or !token.name
@@ -348,9 +348,9 @@ module Rlint
348
348
  ##
349
349
  # Checks if the name of the given token is too long or not. The maximum
350
350
  # length of names is set in
351
- # {Rlint::Analyze::CodingStyle::MAXIMUM\_NAME\_LENGTH}.
351
+ # {RubyLint::Analyze::CodingStyle::MAXIMUM\_NAME\_LENGTH}.
352
352
  #
353
- # @param [Rlint::Token::Token] token The token to validate.
353
+ # @param [RubyLint::Token::Token] token The token to validate.
354
354
  #
355
355
  def validate_name_length(token)
356
356
  if !token.respond_to?(:name) or !token.name
@@ -370,7 +370,7 @@ module Rlint
370
370
  ##
371
371
  # Checks if there are any parenthesis wrapped around a statement.
372
372
  #
373
- # @param [Rlint::Token::Token] token The token to validate.
373
+ # @param [RubyLint::Token::Token] token The token to validate.
374
374
  #
375
375
  def validate_parenthesis(token)
376
376
  if token.code =~ /#{token.type}\s*\(/
@@ -385,7 +385,7 @@ module Rlint
385
385
  ##
386
386
  # Adds a warning for modifying a core Ruby constant.
387
387
  #
388
- # @param [Rlint::Token::Token] token The token class to validate.
388
+ # @param [RubyLint::Token::Token] token The token class to validate.
389
389
  #
390
390
  def validate_ruby_constant_modification(token)
391
391
  if token.name.is_a?(Array)
@@ -404,4 +404,4 @@ module Rlint
404
404
  end
405
405
  end # CodingStyle
406
406
  end # Analyze
407
- end # Rlint
407
+ end # RubyLint