class RuboCop::Cop::Style::ModuleFunction

Checks for use of ‘extend self` or `module_function` in a module.

Supported styles are: ‘module_function` (default), `extend_self` and `forbidden`.

A couple of things to keep in mind:

@safety

Autocorrection is unsafe (and is disabled by default) because `extend self`
and `module_function` do not behave exactly the same.

@example EnforcedStyle: module_function (default)

# bad
module Test
  extend self
  # ...
end

# good
module Test
  module_function
  # ...
end

# good
module Test
  extend self
  # ...
  private
  # ...
end

# good
module Test
  class << self
    # ...
  end
end

@example EnforcedStyle: extend_self

# bad
module Test
  module_function
  # ...
end

# good
module Test
  extend self
  # ...
end

# good
module Test
  class << self
    # ...
  end
end

@example EnforcedStyle: forbidden

# bad
module Test
  module_function
  # ...
end

# bad
module Test
  extend self
  # ...
end

# bad
module Test
  extend self
  # ...
  private
  # ...
end

# good
module Test
  class << self
    # ...
  end
end