Showing 19 of 19 total issues
Class Language
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Language
# @return [Array<String>] list of file extensions
attr_reader :extensions
Class LanguageDSL
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class LanguageDSL
# @api developer
# @param key [String] unique case-insensitive identifier
def initialize(key)
Method stamp
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def stamp(template_path, destination=nil, opt={})
# Ignore destination if its a hash, its meant to be opt
opt, destination = destination, nil if destination.is_a? Hash
# Render and filter
- 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 activate_language
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def activate_language(key, opt={}, &block)
opt, key = key, nil if key.is_a? Hash
key = if opt[:ext]
ext = opt[:ext].to_s.downcase
ext = ext.slice(1..-1) if ext.start_with?('.')
- 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 capture_until
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def capture_until(pattern, opt={})
@cap_begin_pos = @f.pos - win_fudge
but_not = opt[:but_not] || []
but_not = [but_not] unless but_not.is_a?(Array)
while line = @f.readline
- 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 cog_source_and_type
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def cog_source_and_type
if ((Cog.project_root && start_with?(Cog.project_root)) ||
(Cog.project_template_path && start_with?(Cog.project_template_path)) ||
(Cog.project_generator_path && start_with?(Cog.project_generator_path)) ||
(Cog.project_plugin_path && start_with?(Cog.project_plugin_path)))
- 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
Consider simplifying this complex logical expression. Open
if ((Cog.project_root && start_with?(Cog.project_root)) ||
(Cog.project_template_path && start_with?(Cog.project_template_path)) ||
(Cog.project_generator_path && start_with?(Cog.project_generator_path)) ||
(Cog.project_plugin_path && start_with?(Cog.project_plugin_path)))
[File.basename(Cog.project_root), :project]
Method get_template
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_template(path, opt={})
path = path.to_s
path += '.erb'
fullpath = if opt[:absolute]
path
- 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 read_until
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def read_until(pattern, n=0)
i = 0
mark!
while (line = @f.readline) && i <= n
if @match = pattern.match(line)
- 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 method_missing
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(meth, *args, &block)
meth = meth.to_s
if meth.end_with? '_feature'
opt = args.last.is_a?(Hash) ? args.pop : {}
if /(?:\b|_)(public|protected|private)(?:\b|_)/ =~ meth
- 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 output
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def output(x)
match_maker do
message do
if x.is_a? Regexp
"to [write|not write] #{x.inspect} to STDOUT"
- 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 finalize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def finalize
pattern = /[*]/
esc = lambda do |x|
x.gsub(pattern) {|match| "\\#{match}"}
end
- 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 stamp_class
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def stamp_class(path, opt={})
Cog.activate_language opt[:language] do
l = Cog.active_language
raise Errors::ActiveLanguageDoesNotSupportSeeds.new :language => l if l.nil? || l.seed_extension.nil?
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(filename)
@filename = filename
@f = File.open filename, 'r'
@f = @f.binmode if @f.respond_to?(:binmode)
@lines = []
- 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 copy_keeps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_keeps(original, scratch)
Cog.activate_language(:filename => original) do
original = scratch unless File.exists? original
keeps = gather_keeps original, scratch
keeps.each_pair do |hook, c|
- 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 process_cogfiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_cogfiles(opt={})
@project_cogfile_path = opt[:project_cogfile_path] || find_default_cogfile
if @project_cogfile_path
@project_cogfile_path = File.expand_path @project_cogfile_path
@project_root = File.dirname @project_cogfile_path
- 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 plugin_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def plugin_path(path, absolute=false)
return if plugin?
path = add_config_path :plugin, path, absolute
if path && File.exists?(path)
raise Errors::PluginPathIsNotADirectory.new path unless File.directory?(path)
- 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 gather_keeps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gather_keeps(original, scratch)
keeps = {}
gather_from_file(original, :type => 'keep').each_pair do |hook, count|
c = keeps[hook] = EmbedContext.new(hook, scratch, count[original])
raise Errors::DuplicateKeep.new :hook => hook if c.count > 1
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(c, opt={}, &block)
type = opt[:type] || 'cog'
Helpers::FileScanner.scan(c.path, statement(type, c.hook), :occurrence => c.actual_index) do |s|
c.lineno = s.marked_line_number
c.args = s.match[2].split if s.match[2]
- 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"