Showing 70 of 77 total issues
Method pba
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def pba( text_in, element = "" )
return '' unless text_in
style = []
- 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
File ruby.rb
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
module CodeRay
module Scanners
# This scanner is really complex, since Ruby _is_ a complex language!
#
Method summarize
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def summarize(sdone = [], ldone = [], width = 1, max = width - 1, indent = "")
sopts, lopts, s = [], [], nil
@short.each {|s| sdone.fetch(s) {sopts << s}; sdone[s] = true} if @short
@long.each {|s| ldone.fetch(s) {lopts << s}; ldone[s] = true} if @long
return if sopts.empty? and lopts.empty? # completely hidden
- 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
Class C
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class C
protected unless $TESTING
MAGIC_ARITY_THRESHOLD = 15
Method glyphs_textile
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def glyphs_textile( text, level = 0 )
if text !~ HASTAG_MATCH
pgl text
footnote_ref text
else
- 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 parse_in_order
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_in_order(argv = default_argv, setter = nil, &nonopt) # :nodoc:
opt, arg, sw, val, rest = nil
nonopt ||= proc {|arg| throw :terminate, arg}
argv.unshift(arg) if arg = catch(:terminate) {
while arg = argv.shift
Method generate
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate(src, options={})
options = {:expand_types=>options} unless Hash === options
expand_types = options[:expand_types]
singleton = options[:singleton]
Method inline_textile_image
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def inline_textile_image( text )
text.gsub!( IMAGE_RE ) do |m|
stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
atts = pba( atts )
atts = " src=\"#{ url }\"#{ atts }"
- 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 getopts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def getopts(*args)
argv = Array === args.first ? args.shift : default_argv
single_options, *long_options = *args
result = {}
- 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 block_textile_lists
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def block_textile_lists( text )
text.gsub!( LISTS_RE ) do |match|
lines = match.split( /\n/ )
last_line = -1
depth = []
Method to_html
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_html( *rules )
rules = DEFAULT_RULES if rules.empty?
# make our working copy
text = self.dup
Method complete
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def complete(key, icase = false, pat = nil)
pat ||= Regexp.new('\A' + Regexp.quote(key).gsub(/\w+\b/, '\&\w*'),
icase)
canon, sw, k, v, cn = nil
candidates = []
Method blocks
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def blocks( text, deep_code = false )
text.replace( text.split( BLOCKS_GROUP_RE ).collect do |blk|
plain = blk !~ /\A[#*> ]/
# skip blocks that are complex HTML
Method parse_arg
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_arg(arg)
pattern or return nil, arg
unless m = pattern.match(arg)
yield(InvalidArgument, arg)
return arg, 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 rip_offtags
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rip_offtags( text )
if text =~ /<.*>/
## strip and encode <pre> content
codepre, used_offtags = 0, {}
text.gsub!( OFFTAG_MATCH ) do |line|
Method parse_signature
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_signature(src, raw=false)
sig = self.strip_comments(src)
# strip preprocessor directives
sig.gsub!(/^\s*\#.*(\\\n.*)*/, '')
Method source_files_from_path
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def source_files_from_path(given_path)
relevant_paths = []
given_path.find do |path|
if path.directory?
Find.prune if ignore_path?(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 pba
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pba( text_in, element = "" )
return '' unless text_in
style = []
Method block_textile_table
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def block_textile_table( text )
text.gsub!( TABLE_RE ) do |matches|
tatts, fullrow = $~[1..2]
tatts = pba( tatts, 'table' )
Method parse_signature
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_signature(src, raw=false)
sig = self.strip_comments(src)
# strip preprocessor directives
sig.gsub!(/^\s*\#.*(\\\n.*)*/, '')
- 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"