Class Plugin
has 98 methods (exceeds 20 allowed). Consider refactoring. Open
class Noosfero::Plugin
attr_accessor :context
def initialize(context = nil)
self.context = context
File plugin.rb
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "plugin/macro"
require_relative "plugin/hot_spot"
require_relative "plugin/manager"
require_relative "plugin/parent_methods"
require_relative "plugin/settings"
Method extra_blocks
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def extra_blocks(params = {})
return [] if self.class.extra_blocks.nil?
blocks = self.class.extra_blocks.map do |block, options|
type = options[:type]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method autocomplete
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def autocomplete(asset, scope, query, paginate_options = { page: 1 }, options = { field: "name" })
Method find_by_contents
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_by_contents(asset, scope, query, paginate_options = {}, options = {})
Method method_missing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(method, *args, &block)
# This is a generic hotspot for all controllers on Noosfero.
# If any plugin wants to define filters to run on any controller, the name of
# the hotspot must be in the following form: <underscored_controller_name>_filters.
# Example: for ProfileController the hotspot is profile_controller_filters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method available_plugins
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def available_plugins
unless @available_plugins
path = File.join(Rails.root, "{baseplugins,config/plugins}", "*")
@available_plugins = Dir.glob(path).select { |i| File.directory?(i) }
if (Rails.env.test? || Rails.env.cucumber?) && !@available_plugins.include?(File.join(Rails.root, "config", "plugins", "foo"))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"