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
When running rubycritic on such a module, it fails with with the following exception 'Reek::Errors::IncomprehensibleSourceError'.
module ExceptionHandler
# => Class (inheritance dependent on whether db option is available)
self::Exception = Class.new(
(ExceptionHandler.config.try(:db) && defined?(ActiveRecord)) ? ActiveRecord::Base : Object
) do
#Some code
end
end
It seems that the ternary operator in the class name definition is causing this. Because if we change the code to:
module ExceptionHandler
# => Class (inheritance dependent on whether db option is available)
foo =(ExceptionHandler.config.try(:db) && defined?(ActiveRecord)) ? ActiveRecord::Base : Object
self::Exception = Class.new(foo) do
#Some code
end
end
there is no exception.
The exception happens on examiner.rb:107:in `rescue in run': !!! (Reek::Errors::IncomprehensibleSourceError)
Exception message:
undefined method `name' for #<#<Class:0x007f82aa196e58>:0x007f82aa1957d8>
I stumbled upon this exception when trying to run rubycritic on a project with the exception_handler GEM. The code in the above example is generated automatically by their GEM.
The text was updated successfully, but these errors were encountered:
RubyCritic 3.3.0
Ruby 2.3.1
When running rubycritic on such a module, it fails with with the following exception 'Reek::Errors::IncomprehensibleSourceError'.
It seems that the ternary operator in the class name definition is causing this. Because if we change the code to:
there is no exception.
The exception happens on examiner.rb:107:in `rescue in run': !!! (Reek::Errors::IncomprehensibleSourceError)
I stumbled upon this exception when trying to run rubycritic on a project with the exception_handler GEM. The code in the above example is generated automatically by their GEM.
The text was updated successfully, but these errors were encountered: