Class: PlatformosCheck::ConvertIncludeToRender

Inherits:
LiquidCheck show all
Defined in:
lib/platformos_check/checks/convert_include_to_render.rb

Overview

Recommends replacing ‘include` for `render`

Constant Summary

Constants inherited from Check

PlatformosCheck::Check::CATEGORIES, PlatformosCheck::Check::SEVERITIES, PlatformosCheck::Check::SEVERITY_VALUES

Instance Attribute Summary

Attributes inherited from Check

#ignored_patterns, #offenses, #options, #platformos_app

Instance Method Summary collapse

Methods included from ChecksTracking

#inherited

Methods included from ParsingHelpers

#outside_of_strings

Methods inherited from Check

#==, #add_offense, all, can_disable, #can_disable?, categories, #categories, category, #code_name, doc, #doc, docs_url, #ignore!, #ignored?, #severity, severity, #severity=, #severity_value, severity_value, single_file, #single_file?, #to_s, #whole_platformos_app?

Methods included from JsonHelpers

#format_json_parse_error, #pretty_json

Instance Method Details

#on_include(node) ⇒ Object



10
11
12
13
14
15
# File 'lib/platformos_check/checks/convert_include_to_render.rb', line 10

def on_include(node)
  add_offense("`include` is deprecated - convert it to `render`", node:) do |corrector|
    # We need to fix #445 and pass the variables from the context or don't replace at all.
    # corrector.replace(node, "render \'#{node.value.template_name_expr}\' ")
  end
end