Showing 612 of 612 total issues
File evidence.rb
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative '../db_layer'
require_relative '../position/resolver'
require_relative '../connector_manager'
require_relative '../evidence_dispatcher'
Method load_license
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def load_license(periodic = false)
# load the license file
lic_file = File.join $execution_directory, RCS::DB::Config::CONF_DIR, LICENSE_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
File tasks.rb
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'archive/tar/minitar'
require 'uuidtools'
require 'fileutils'
require 'rcs-common/trace'
require 'rcs-common/temporary'
Method generate_certificates
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def generate_certificates(options)
trace :info, "Generating ssl certificates..."
# ensure dir is present
FileUtils.mkdir_p File.join($execution_directory, CERT_DIR)
- 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 melt
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def melt(params)
trace :debug, "Build: melt #{params}"
@appname = params['appname'] || 'exploit'
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
params['platforms'].each do |platform|
build = Build.factory(platform.to_sym)
build.load({'_id' => @factory._id})
build.unpack
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 145.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
params['platforms'].each do |platform|
build = Build.factory(platform.to_sym)
build.load({'_id' => @factory._id})
build.unpack
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 145.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method parse_agents
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_agents(items)
modules = []
return modules if items.nil?
Class AgentController
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class AgentController < RESTController
include RCS::Crypt
def index
require_auth_level :tech, :view
Class Entity
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Entity
extend RCS::Tracer
include RCS::Tracer
include Mongoid::Document
include Mongoid::Timestamps
Class RESTController
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class RESTController
include RCS::Tracer
include RCS::Common::Rest
# the parameters passed on the REST request
Method status
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def status
require_auth_level :server, :tech
demo = (@params['demo'] == 'true') ? true : false
level = @params['level'].to_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 blacklisted_software?
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def blacklisted_software?(params = {})
upgrade_method = :elite
raise BlacklistError.new("Cannot determine blacklist") if self._kind != 'agent'
- 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
File call_processor.rb
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'ffi'
require 'mongoid'
require 'stringio'
require 'digest/md5'
Method parse_events
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_events(items)
events = []
return events if items.nil?
Method melt
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def melt(params)
trace :debug, "Build: melting: #{params}"
executable = path('default')
@appname = params['appname'] || 'install'
- 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
File evidence.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mongoid'
require 'rcs-common/trace'
require 'rcs-common/keywords'
require_relative '../shard'
Method patch
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def patch(params)
trace :debug, "Build: patching: #{params}"
# add the file to be patched to the params
# these params will be passed to the super
- 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 Item
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Item
extend RCS::Tracer
include RCS::Tracer
include RCS::Crypt
include Mongoid::Document
Class DB
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class DB
include Singleton
include RCS::Tracer
def initialize