app/controllers/records_controller.rb
Assignment Branch Condition size for create is too high. [26.27/20] Open
Open
def create
file = params[:file]
verify_file_type file
key = session_key @repository
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Use a guard clause instead of wrapping the code inside a conditional expression. Open
Open
if !Rails.env.test? && !file.tempfile.is_a?(StringIO)
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok