% ruby example.rb example.rb:3: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. example.rb:3: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead. example.rb:3: warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.
Offenses: example.rb:3:15: W: Lint/ErbNewArguments: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. ERB.new('hi', nil, '-', '@output_buffer') ^^^ example.rb:3:20: W: Lint/ErbNewArguments: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: '-') instead. ERB.new('hi', nil, '-', '@output_buffer') ^^^ example.rb:3:25: W: Lint/ErbNewArguments: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: '@output_buffer') instead. ERB.new('hi', nil, '-', '@output_buffer') ^^^^^^^^^^^^^^^^
spec/rubocop/cop/rails/ top_level_include_spec.rb File modified: - `require_relative 'rubocop/cop/rails/ top_level_include'` added into lib/rubocop.rb Do 3 steps: 1. Add an entry to the "New features" section in CHANGELOG.md, e.g. "Add new `TopLevel/Include` cop. ([@your_id][])" 2. Add an entry into config/enabled.yml or config/disabled.yml 3. Implement your new cop in the generated file!
the docs module RuboCop module Cop module Rails # TODO: Write cop description and example of bad / good code. # # @example # # bad # bad_method() # # # good # bad_method(args) 8SJUFDPQEFTDSJQUJPOBOE FYBNQMFPGCBEHPPE
`#bad_method`' do expect_offense(<<-RUBY.strip_indent) bad_method ^^^^^^^^^^ Use `#good_method` instead of `#bad_method`. RUBY end it 'does not register an offense when using `#good_method`' do expect_no_offenses(<<-RUBY.strip_indent) good_method RUBY end end 8SJUFBCBEDBTFPOUIFAFYQFDU@P⒎FOTFA NFUIPE
`#bad_method`' do expect_offense(<<-RUBY.strip_indent) bad_method ^^^^^^^^^^ Use `#good_method` instead of `#bad_method`. RUBY end it 'does not register an offense when using `#good_method`' do expect_no_offenses(<<-RUBY.strip_indent) good_method RUBY end end 8SJUFBCBEDBTFPOUIFAFYQFDU@P⒎FOTFA NFUIPE 8SJUFBHPPEDBTFPOUIFAFYQFDU@OP@P⒎FOTFTA NFUIPE
using `#bad_method`' do expect_offense(<<-RUBY.strip_indent) bad_method ^^^^^^^^^^ Use `#good_method` instead of `#bad_method`. RUBY end it 'does not register an offense when using `#good_method`' do expect_no_offenses(<<-RUBY.strip_indent) good_method RUBY end end 8SJUFBCBEDBTFPOUIFAFYQFDU@P⒎FOTFA NFUIPE 8SJUFBHPPEDBTFPOUIFAFYQFDU@OP@P⒎FOTFTA NFUIPE
outside class' do expect_offense(<<-RUBY.strip_indent) include ^^^^^^^ `include` is used at the top level. Use inside `class` or `module`. class C end RUBY end 8SJUFBCBEDBTFPOUIFAFYQFDU@P⒎FOTFA NFUIPE
outside class' do expect_offense(<<-RUBY.strip_indent) include ^^^^^^^^^ `include` is used at the top level. Use inside `class` or `module`. class C end RUBY end it 'does not register an offense when using inside class' do expect_no_offenses(<<-RUBY.strip_indent) class C include M end RUBY 8SJUFBHPPEDBTFPOUIFAFYQFDU@OP@P⒎FOTFTA NFUIPE
at the top level.' Enabled: true # In this PR, the following setting has been removed Rails/TopLevelInclude: Include: - app/**/*.rb "EEBOFOUSZJOUPDPOpHFOBCMFEZNM PSDPOpHEJTBCMFEZNM "EEBOFOUSZJOUPDPOpHEFGBVMUZNM *GEFGBVMUTFUUJOHJTSFRVJSFE