sanger/sequencescape

View on GitHub
lib/record_loader/plate_type_loader.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

RecordLoader::PlateTypeLoader has missing safe method 'create_or_update!'
Open

    def create_or_update!(name, options)
Severity: Minor
Found in lib/record_loader/plate_type_loader.rb by reek

A candidate method for the Missing Safe Method smell are methods whose names end with an exclamation mark.

An exclamation mark in method names means (the explanation below is taken from here ):

The ! in method names that end with ! means, “This method is dangerous”—or, more precisely, this method is the “dangerous” version of an otherwise equivalent method, with the same name minus the !. “Danger” is relative; the ! doesn’t mean anything at all unless the method name it’s in corresponds to a similar but bang-less method name. So, for example, gsub! is the dangerous version of gsub. exit! is the dangerous version of exit. flatten! is the dangerous version of flatten. And so forth.

Such a method is called Missing Safe Method if and only if her non-bang version does not exist and this method is reported as a smell.

Example

Given

class C
  def foo; end
  def foo!; end
  def bar!; end
end

Reek would report bar! as Missing Safe Method smell but not foo!.

Reek reports this smell only in a class context, not in a module context in order to allow perfectly legit code like this:

class Parent
  def foo; end
end

module Dangerous
  def foo!; end
end

class Son < Parent
  include Dangerous
end

class Daughter < Parent
end

In this example, Reek would not report the Missing Safe Method smell for the method foo of the Dangerous module.

RecordLoader::PlateTypeLoader#create_or_update! doesn't depend on instance state (maybe move it to another class?)
Open

    def create_or_update!(name, options)
Severity: Minor
Found in lib/record_loader/plate_type_loader.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

There are no issues that match your filters.

Category
Status