Method download_license
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def Utils.download_license(name, version, gems_url)
version = version.to_s if version.is_a? Gem::Version
key = "#{name}-#{version}-#{gems_url.gsub("/", "_").gsub(":", "_")}"
return @@licenses[key] if @@licenses[key]
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 download_emails
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def Utils.download_emails(email_username, email_password, mailing_lists)
begin
self.get_emails_from_fs if @@emails.nil?
rescue Exception => e
self.log_error "", "There was a problem getting emails from filesystem #{e.message}"
- 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 download_emails
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Utils.download_emails(email_username, email_password, mailing_lists)
begin
self.get_emails_from_fs if @@emails.nil?
rescue Exception => e
self.log_error "", "There was a problem getting emails from filesystem #{e.message}"
Method get_emails_from_fs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def Utils.get_emails_from_fs
@@emails = {}
Dir.glob("#{EMAIL_TMP_PATH}/**/*").each do |filename|
next unless File.file?(filename)
open(filename, "r") do |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 send_email
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def Utils.send_email(email_receiver, email_username, email_password, name, mssg)
Method download_gem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def Utils.download_gem(name, version, gems_url)
gem_uri = URI.parse("#{gems_url}/#{name}-#{version}.gem")
tmp_path = "tmp/utils/gems/#{gems_url.gsub("/", "_").gsub(":", "_")}/"
gem_name = "#{name}-#{version}.gem"
full_path = "#{tmp_path}/#{gem_name}"
- 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"