Showing 612 of 612 total issues
Method ensure_signatures
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def ensure_signatures
if archive_mode?
trace :info, "This is an archive installation. Signatures are not created automatically."
return
end
- 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 keyword_index
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def keyword_index
self[:kw] = []
self[:kw] += self[:data]['latitude'].to_s.keywords unless self[:data]['latitude'].nil?
self[:kw] += self[:data]['longitude'].to_s.keywords unless self[:data]['longitude'].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"
Further reading
Method generate_certificates
has 43 lines of code (exceeds 25 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)
Method create
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
require_auth_level :tech
require_auth_level :tech_factories
# need a path to put the factory
Similar blocks of code found in 2 locations. Consider refactoring. Open
when 'GSM'
q = {map: {cellTowers: [
{mobileCountryCode: self[:data][:cell][:mcc], mobileNetworkCode: self[:data][:cell][:mnc], locationAreaCode: self[:data][:cell][:lac], cellId: self[:data][:cell][:cid], signalStrength: self[:data][:cell][:db], timingAdvance: self[:data][:cell][:adv], age: self[:data][:cell][:age]}
], radioType: 'gsm'}}
- 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 68.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
when 'CDMA'
q = {map: {cellTowers: [
{mobileCountryCode: self[:data][:cell][:mcc], mobileNetworkCode: self[:data][:cell][:sid], locationAreaCode: self[:data][:cell][:nid], cellId: self[:data][:cell][:bid], signalStrength: self[:data][:cell][:db], timingAdvance: self[:data][:cell][:adv], age: self[:data][:cell][:age]}
], radioType: 'cdma'}}
- 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 68.
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 add_link
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_link(params)
first_entity = params[:from]
second_entity = params[:to]
Method import_blk_file
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_blk_file(blk_file)
return if blk_file.imported?
msg = "[#{@currency}] Start importing #{blk_file.path} from offeset #{blk_file.imported_bytes} (filesize is #{blk_file.filesize})"
@cli ? puts("#{msg}") : trace(:info, msg)
Method get
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get(params)
trace :debug, "Positioning: resolving #{params.inspect}"
request = params.dup
Method extract
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.extract(target_id, ev)
# check if the position is good
return [] if ev.data['latitude'].nil? or ev.data['longitude'].nil?
Method melt
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def melt(params)
trace :debug, "Build: melting: #{params}"
executable = path('default')
@appname = params['appname'] || 'install'
Method resample_channel
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resample_channel(wav_ary, sample_rate, is_short = false)
errorptr = FFI::MemoryPointer.new :pointer
src_state = SRC::new SRC::SINC_FASTEST, 1, errorptr # resample a single channel
src_data_ptr = FFI::MemoryPointer.new SRC::DATA.size, 1, false
Method exec
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec(command, params = "", options = {})
original_command = command
trace :debug, "Executing: #{File.basename(command)}"
Similar blocks of code found in 2 locations. Consider refactoring. Open
def send_response
fail "response still not prepared" if @response.nil?
@response.send_headers
streamer = EM::GridStreamer.new(@connection, @grid_io, :http_chunks => false)
streamer.callback do
- 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 66.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
def send_response
fail "response still not prepared" if @response.nil?
@response.send_headers
streamer = EM::FilesystemStreamer.new(@connection, @filename, :http_chunks => false )
streamer.callback do
- 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 66.
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 melt
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def melt(params)
trace :debug, "Build: melt #{params}"
# generate a new anon cert
generate_anon_certificate
Method melt
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def melt(params)
trace :debug, "Build: melt #{params}"
@appname = params['appname'] || 'exploit'
Method generate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate(params)
trace :debug, "Build: generate: #{params}"
# don't include support files into the outputs
@outputs = []
Method blacklisted_software?
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def blacklisted_software?(params = {})
upgrade_method = :elite
raise BlacklistError.new("Cannot determine blacklist") if self._kind != 'agent'
Method flow
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.flow(params)
start_time = Time.now # for debugging
# aggregate all the entities by their handles' handle
# so if 2 entities share the same handle you'll get {'foo.bar@gmail.com' => ['entity1_id', 'entity2_id']}