You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An error occurred while Rails/ActiveRecordOverride cop was inspecting D:/Dvlt/ruby/projects/_active/Db_presenter/app/models/marycmd/test.rb:9:4.
undefined method `const_name' for nil:NilClass
I have duplicated my class to a simplified one that give the same error: fail on valid?
the test.rb file:
# frozen_string_literal: true
# Marycmd module
module Marycmd
# rfq model
class Rfq
include ActiveModel::Model
def save
valid? ? save_to_db : false
end
private
def save_to_db
true # example
end
end
end
the trace:
Scanning D:/Dvlt/ruby/projects/_active/Db_presenter/app/models/marycmd/test.rb
An error occurred while Rails/ActiveRecordOverride cop was inspecting D:/Dvlt/ruby/projects/_active/Db_presenter/app/models/marycmd/test.rb:9:4.
undefined method `const_name' for nil:NilClass
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/rails/active_record_override.rb:42:in `on_def'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:58:in `block (2 levels) in trigger_responding_cops'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:106:in `with_cop_error_handling'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:57:in `block in trigger_responding_cops'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:56:in `each'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:56:in `trigger_responding_cops'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:34:in `block (2 levels) in <class:Commissioner>'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/ast/traversal.rb:50:in `block in on_begin'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/ast/traversal.rb:50:in `each'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/ast/traversal.rb:50:in `on_begin'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:35:in `block (2 levels) in <class:Commissioner>'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/ast/traversal.rb:92:in `on_class'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:35:in `block (2 levels) in <class:Commissioner>'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/ast/traversal.rb:150:in `on_while'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:35:in `block (2 levels) in <class:Commissioner>'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/ast/traversal.rb:13:in `walk'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/commissioner.rb:46:in `investigate'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/team.rb:116:in `investigate'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/team.rb:104:in `offenses'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cop/team.rb:44:in `inspect_file'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:273:in `inspect_file'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:220:in `block in do_inspection_loop'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:252:in `block in iterate_until_no_changes'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:245:in `loop'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:245:in `iterate_until_no_changes'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:216:in `do_inspection_loop'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:119:in `block in file_offenses'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:137:in `file_offense_cache'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:117:in `file_offenses'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:105:in `process_file'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:82:in `block in each_inspected_file'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:81:in `each'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:81:in `reduce'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:81:in `each_inspected_file'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:73:in `inspect_files'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/runner.rb:39:in `run'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cli.rb:174:in `execute_runner'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cli.rb:75:in `execute_runners'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/lib/rubocop/cli.rb:47:in `run'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/exe/rubocop:25:in `block in <top (required)>'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
D:/program/dvlt/ruby/Ruby25-x64/lib/ruby/gems/2.5.0/gems/rubocop-0.67.2/exe/rubocop:24:in `<top (required)>'
D:/program/dvlt/ruby/Ruby25-x64/bin/rubocop:23:in `load'
D:/program/dvlt/ruby/Ruby25-x64/bin/rubocop:23:in `<main>'
Steps to reproduce the problem
Use the latest rubocop version. previous versions did not fail at this code
RuboCop version
0.67.2 (using Parser 2.6.2.1, running on ruby 2.5.3 x64-mingw32)
Rails is 5.2.3
The text was updated successfully, but these errors were encountered:
Expected behavior
Rubocop should not fail
Actual behavior
I have duplicated my class to a simplified one that give the same error: fail on valid?
the test.rb file:
the trace:
Steps to reproduce the problem
Use the latest rubocop version. previous versions did not fail at this code
RuboCop version
Rails is 5.2.3
The text was updated successfully, but these errors were encountered: