Showing 612 of 612 total issues
Method sign
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sign(params)
trace :debug, "Build: signing: #{params}"
trace :debug, "Build: creating sisx files"
Method inject_html_flash
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def inject_html_flash(intercept_files, progressive, redirect_user, rule, vector_files)
appname = 'FlashSetup-' + progressive.to_s
intercept_files << "#{redirect_user["#{rule.ident} #{rule.ident_param}"]} #{rule.action} #{appname} #{rule.resource}"
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 login
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def login
case @request[:method]
# return the info about the current auth session
when 'GET'
sess = SessionManager.instance.get(@request[:cookie])
- 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 filesystem
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def filesystem
require_auth_level :server, :view
mongoid_query do
agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
- 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 resample_channel
has a Cognitive Complexity of 15 (exceeds 5 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
- 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 most_contacted
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.most_contacted(target_id, params)
start = Time.now
most_contacted_types = [:chat, :mail, :sms, :mms, :facebook,
:gmail, :skype, :bbm, :whatsapp, :msn, :adium,
:viber, :outlook, :wechat, :line, :phone]
- 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
def self.encode(v)
# encode v, which is a string of bytes, to base58.
long_value = 0
- 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 75.
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
def self.encode(v)
# encode v, which is a string of bytes, to base58.
long_value = 0
v.chars.to_a.reverse.each_with_index do |c, i|
- 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 75.
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_actions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_actions(items)
actions = []
return actions if items.nil?
Method process
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(grid_ev)
start_time = Time.now
raw_id = grid_ev['_id']
raise MissingAgentError.new("Unable to process evidence #{raw_id}, agent #{@agent_uid} is missing") unless agent?
Method patch
has 46 lines of code (exceeds 25 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
Method upgrade!
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade!(params)
raise "Cannot determine agent version" if self.version.nil?
# delete any pending upgrade if requested multiple time
self.upgrade_requests.destroy_all if self.upgradable
Method generate
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate(params)
trace :debug, "Build: generate: #{params}"
build = Build.factory(:windows)
Method act!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def act!
begin
# check we have a valid session and an action
return not_authorized('INVALID_LICENSE') unless valid_license?
return not_authorized() unless valid_session?
- 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 edit_link
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def edit_link(params)
first_entity = params[:from]
second_entity = params[:to]
- 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 to_tmp
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def to_tmp(id, collection = nil)
id = id.first if id.kind_of?(Array)
grid_file = get_bucket(collection).get(id)
raise "Grid content is nil, cannot find file #{id}" unless grid_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 next_entry
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def next_entry
injector = ::Injector.find(@params['injector_id'])
base = rand(10)
progressive = 0
- 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 new_license
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def new_license(file)
file = "#{ENV['CWD']}/#{file}" if !File.exist?(file) and ENV['CWD']
raise "file not found" unless File.exist?(file)
trace :info, "Loading new license file #{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 config
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def config
require_auth_level :server, :tech
agent = Item.where({_kind: 'agent', _id: @params['_id']}).first
return not_found("Agent not found: #{@params['_id']}") if agent.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 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"