lib/skeptic/rules/spaces_around_operators.rb in skeptic-0.0.14 vs lib/skeptic/rules/spaces_around_operators.rb in skeptic-0.0.15
- old
+ new
@@ -7,11 +7,11 @@
OPERATORS_WITHOUT_SPACES_AROUND_THEM = ['**', '::', '...', '..']
IGNORED_TOKEN_TYPES = [:on_sp, :on_ignored_nl, :on_nl, :on_lparen, :on_symbeg, :on_lbracket, :on_lbrace]
LEFT_LIMIT_TOKEN_TYPES = [:on_lparen, :on_lbracket]
RIGHT_LIMIT_TOKEN_TYPES = [:on_rparen, :on_rbracket]
- WHITESPACE_TOKEN_TYPES = [:on_sp, :on_nl, :on_ignored_nl]
+ WHITESPACE_TOKEN_TYPES = [:on_sp]
def initialize(data)
@violations = []
@special_tokens_locations = []
@unary_token_locations = []
@@ -95,10 +95,10 @@
def mark_unary(tokens)
@unary_token_locations = []
last_significant_token = nil
tokens.each do |token|
if token[1] == :on_op
- if last_significant_token == :on_op
+ if [:on_op, :on_semicolon, :on_ignored_nl].include?(last_significant_token)
@unary_token_locations << token[0]
end
last_significant_token = :on_op
elsif !WHITESPACE_TOKEN_TYPES.include?(token[1])
last_significant_token = token[1]