class RubyLint::Analysis::Pedantics
This class adds (pedantic) warnings for various features that aren't really that useful or needed. This serves mostly as a simple example on how to write an analysis class.
Currently warnings are added for the following:
-
BEGIN/END blocks
-
Statements that use `then` or `do` when it's not needed
For example:
BEGIN { puts 'foo' }
This would result in the warning “BEGIN/END is useless” being added.
Private Instance Methods
check_begin_token(node)
click to toggle source
Checks if a node's begin token matches “then” or “do” and if so adds a warning for it.
@param [RubyLint::AST::Node] node
# File lib/ruby-lint/analysis/pedantics.rb, line 44 def check_begin_token(node) if node.location.begin.is?('then') or node.location.begin.is?('do') info('the use of then/do is not needed here', node) end end