Showing 4 of 4 total issues
Method build!
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def build!(&block)
dir = Pathname( ENV["EXPORT_BUILD_DIR"] || app.public_folder )
handle_error_dir_not_found!(dir) unless dir.exist? && dir.directory?
if @use_routes
- 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 build!
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build!(&block)
dir = Pathname( ENV["EXPORT_BUILD_DIR"] || app.public_folder )
handle_error_dir_not_found!(dir) unless dir.exist? && dir.directory?
if @use_routes
Method route_paths
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def route_paths
route_paths = []
app.each_route do |route|
next if route.verb != 'GET'
next unless route_path_usable?(route.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 build_path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build_path(path: nil, dir: nil, response: nil)
# These argument checks are for Ruby v2.0 as it
# doesn't support required keyword args.
fail ArgumentError, "'path' is a required argument to build_path" if path.nil?
fail ArgumentError, "'dir' is a required argument to build_path" if dir.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"