Showing 11 of 13 total issues
Method detect
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def detect(_path = nil)
Licensee.confidence_threshold = options[:confidence]
if options[:json]
say project.to_h.to_json
- 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 License
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class License
@all = {}
@keys_licenses = {}
class << self
File content_helper.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'set'
require 'digest'
module Licensee
module ContentHelper
Method detect
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def detect(_path = nil)
Licensee.confidence_threshold = options[:confidence]
if options[:json]
say project.to_h.to_json
Method to_h
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_h
hash = {}
self.class::HASH_METHODS.each do |method|
key = method.to_s.delete('?').to_sym
value = public_send(method)
- 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 title_regex
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def title_regex
return @title_regex if defined? @title_regex
string = name.downcase.sub('*', 'u')
simple_title_regex = Regexp.new string, 'i'
Method strip
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def strip(regex_or_sym)
return unless _content
if regex_or_sym.is_a?(Symbol)
meth = "strip_#{regex_or_sym}"
- 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 license_property
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def license_property
match = @file.content.match LICENSE_REGEX
return match[1].downcase if match && match[1]
# check for a licenses array property
- 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 readme_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def readme_file
return unless detect_readme?
return @readme if defined? @readme
@readme = begin
- 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 title_regex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def title_regex
return @title_regex if defined? @title_regex
string = name.downcase.sub('*', 'u')
simple_title_regex = Regexp.new string, 'i'
- 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 package_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def package_file
return unless detect_packages?
return @package_file if defined? @package_file
@package_file = begin
- 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"