Dead code redefining "[]" and using "const_get"
Description
module Banzai
module Filter
def self.[](name)
const_get("#{name.to_s.camelize}Filter")
end
end
end
module Gitlab
module Markdown
class Pipeline
def self.[](name)
name ||= :full
const_get("#{name.to_s.camelize}Pipeline")
end
end
end
end
This code redefines []
operator and uses const_get
to define a "convenience method" (and convenience is here arguable). Redefining []
makes it quite hard to identify places where this method is actually used. However, after analysing the code and test coverage report, I believe that these two are not used at all. In fact, the whole Gitlab::Markdown::Pipeline
class seems to be dead code (it has some other methods, too).
Proposal
Remove these two classes.