Class: RuboCop::Cop::Kata::ClassInModule

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/kata/class_in_module.rb

Overview

SPDX-FileCopyrightText: Copyright (c) 2019-2026 Yegor Bugayenko SPDX-License-Identifier: MIT Derived from rubocop-elegant (https://github.com/yegor256/rubocop-elegant), see LICENSE.txt

Constant Summary collapse

MSG =
"Class %s must be defined inside a module, not globally"

Instance Method Summary collapse

Instance Method Details

#on_class(node) ⇒ Object



11
12
13
14
15
# File 'lib/rubocop/cop/kata/class_in_module.rb', line 11

def on_class(node)
  return if namespaced?(node)
  return if scoped?(node)
  add_offense(node, message: format(MSG, name: label(node)))
end