lib/rubocop/cop/when_then.rb
# encoding: utf-8 module Rubocop module Cop class WhenThen < Cop MSG = 'Never use "when x;". Use "when x then" instead.' def on_when(node) if node.loc.begin && node.loc.begin.source == ';' add_offence(:convention, node.loc.line, MSG) end super end end end end
Source Files
- lib/rubocop.rb
- lib/rubocop/cli.rb
- lib/rubocop/config.rb
- lib/rubocop/config_store.rb
- lib/rubocop/cop/access_control.rb
- lib/rubocop/cop/alias.rb
- lib/rubocop/cop/align_parameters.rb
- lib/rubocop/cop/and_or.rb
- lib/rubocop/cop/ascii_comments.rb
- lib/rubocop/cop/ascii_identifiers.rb
- lib/rubocop/cop/avoid_class_vars.rb
- lib/rubocop/cop/avoid_for.rb
- lib/rubocop/cop/avoid_global_vars.rb
- lib/rubocop/cop/avoid_perl_backrefs.rb
- lib/rubocop/cop/avoid_perlisms.rb
- lib/rubocop/cop/block_comments.rb
- lib/rubocop/cop/blocks.rb
- lib/rubocop/cop/case_indentation.rb
- lib/rubocop/cop/class_and_module_camel_case.rb
- lib/rubocop/cop/class_methods.rb
- lib/rubocop/cop/collection_methods.rb
- lib/rubocop/cop/colon_method_call.rb
- lib/rubocop/cop/constant_name.rb
- lib/rubocop/cop/cop.rb
- lib/rubocop/cop/def_parentheses.rb
- lib/rubocop/cop/empty_line_between_defs.rb
- lib/rubocop/cop/empty_lines.rb
- lib/rubocop/cop/empty_literal.rb
- lib/rubocop/cop/encoding.rb
- lib/rubocop/cop/end_of_line.rb
- lib/rubocop/cop/ensure_return.rb
- lib/rubocop/cop/eval.rb
- lib/rubocop/cop/favor_join.rb
- lib/rubocop/cop/favor_modifier.rb
- lib/rubocop/cop/favor_percent_r.rb
- lib/rubocop/cop/favor_sprintf.rb
- lib/rubocop/cop/favor_unless_over_negated_if.rb
- lib/rubocop/cop/handle_exceptions.rb
- lib/rubocop/cop/hash_syntax.rb
- lib/rubocop/cop/if_then_else.rb
- lib/rubocop/cop/lambda.rb
- lib/rubocop/cop/leading_comment_space.rb
- lib/rubocop/cop/line_continuation.rb
- lib/rubocop/cop/line_length.rb
- lib/rubocop/cop/loop.rb
- lib/rubocop/cop/method_and_variable_snake_case.rb
- lib/rubocop/cop/method_length.rb
- lib/rubocop/cop/not.rb
- lib/rubocop/cop/numeric_literals.rb
- lib/rubocop/cop/offence.rb
- lib/rubocop/cop/op_method.rb
- lib/rubocop/cop/parameter_lists.rb
- lib/rubocop/cop/parentheses_around_condition.rb
- lib/rubocop/cop/percent_r.rb
- lib/rubocop/cop/proc.rb
- lib/rubocop/cop/reduce_arguments.rb
- lib/rubocop/cop/rescue_exception.rb
- lib/rubocop/cop/rescue_modifier.rb
- lib/rubocop/cop/semicolon.rb
- lib/rubocop/cop/single_line_methods.rb
- lib/rubocop/cop/space_after_comma_etc.rb
- lib/rubocop/cop/space_after_control_keyword.rb
- lib/rubocop/cop/string_literals.rb
- lib/rubocop/cop/surrounding_space.rb
- lib/rubocop/cop/symbol_array.rb
- lib/rubocop/cop/symbol_name.rb
- lib/rubocop/cop/syntax.rb
- lib/rubocop/cop/tab.rb
- lib/rubocop/cop/ternary_operator.rb
- lib/rubocop/cop/trailing_whitespace.rb
- lib/rubocop/cop/trivial_accessors.rb
- lib/rubocop/cop/unless_else.rb
- lib/rubocop/cop/util.rb
- lib/rubocop/cop/variable_interpolation.rb
- lib/rubocop/cop/when_then.rb
- lib/rubocop/cop/word_array.rb
- lib/rubocop/report/emacs_style.rb
- lib/rubocop/report/plain_text.rb
- lib/rubocop/report/report.rb
- lib/rubocop/version.rb