Class Flog
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Flog < MethodBasedSexpProcessor
VERSION = "4.8.0" # :nodoc:
##
# Cut off point where the report should stop unless --all given.
File flog.rb
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "sexp_processor"
require "ruby_parser"
require "timeout"
##
Method flog_ruby
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def flog_ruby ruby, file="-", timeout = 10
flog_ruby! ruby, file, timeout
rescue Timeout::Error
warn "TIMEOUT parsing #{file}. Skipping."
rescue RubyParser::SyntaxError, Racc::ParseError => e
- 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 flog
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def flog(*files)
files.each do |file|
next unless file == "-" or File.readable? file
ruby = file == "-" ? $stdin.read : File.binread(file)
- 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_iter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_iter(exp)
context = (self.context - [:class, :module, :scope])
context = context.uniq.sort_by { |s| s.to_s }
exp.delete 0 # { || ... } has 0 in arg slot
- 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"