Sha256: 59d407694afbb21c6deb44277cb49a8742bb29bd199d7b1e1c0f32abdd7412fa
Contents?: true
Size: 506 Bytes
Versions: 13
Compression:
Stored size: 506 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop class UnlessElse < Cop ERROR_MESSAGE = 'Never use unless with else. Rewrite these with the ' + 'positive case first.' def inspect(file, source, tokens, sexp) each(:unless, sexp) do |unless_sexp| if unless_sexp.compact.find { |s| s[0] == :else } add_offence(:convention, all_positions(unless_sexp).first.lineno, ERROR_MESSAGE) end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems