Class: RuboCop::Cop::Style::NoHelpers

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/style/no_helpers.rb

Overview

This cop does not allow helpers to be placed in an application. View objects, specifically ViewComponent, create better Object Oriented design. Global helper methods tightly couple templates.

Constant Summary collapse

MSG =
"Helpers create global view methods. Instead, use view objects to " \
"encapsulate your display logic."

Instance Method Summary collapse

Instance Method Details

#on_new_investigationObject



14
15
16
17
18
19
# File 'lib/rubocop/cop/style/no_helpers.rb', line 14

def on_new_investigation
  return if processed_source.blank?
  return unless helper_path?

  add_offense(processed_source.ast, message: MSG)
end