File package.rb
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Package < ApplicationModel
@@root = Rails.root.to_s # rubocop:disable Style/ClassVars
=begin
Method install
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.install(data)
if data[:file]
json = _read_file(data[:file], true)
package = JSON.parse(json)
elsif data[:string]
Method install
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.install(data)
if data[:file]
json = _read_file(data[:file], true)
package = JSON.parse(json)
elsif data[:string]
- 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 link
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.link(package_base_dir)
# link files
Dir.glob("#{package_base_dir}/**/*") do |entry|
entry = entry.sub('//', '/')
- 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 link
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.link(package_base_dir)
# link files
Dir.glob("#{package_base_dir}/**/*") do |entry|
entry = entry.sub('//', '/')
Method _write_file
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self._write_file(file, permission, data)
location = "#{@@root}/#{file}"
# rename existing file if not already the same file
if File.exist?(location)
- 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 _write_file
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self._write_file(file, permission, data)
location = "#{@@root}/#{file}"
# rename existing file if not already the same file
if File.exist?(location)
Method uninstall
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.uninstall(data)
if data[:string]
package = JSON.parse(data[:string])
else
Method verify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def verify
# get package
json_file = self.class._get_bin(name, version)
package = JSON.parse(json_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 uninstall
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.uninstall(data)
if data[:string]
package = JSON.parse(data[:string])
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 ensure_no_duplicate_files!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.ensure_no_duplicate_files!(name, location)
all_files.each do |check_package, check_files|
next if check_package == name
next if check_files.exclude?(location)
- 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"