Showing 612 of 612 total issues
Method process
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(connector_queue)
trace :debug, "Processing #{connector_queue}"
connector = connector_queue.connector
data = connector_queue.data
type = connector_queue.type
Method update
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
require_auth_level :admin, :sys, :tech, :view
mongoid_query do
user = User.find(@params['_id'])
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
# default values.
# you have at least:
# - one user to login to the system
# - one collector to receive data
Method login
has 31 lines of code (exceeds 25 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])
Method add_rule
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_rule
require_auth_level :tech
require_auth_level :tech_ni_rules
mongoid_query do
Method process
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process
case self[:data][:type]
when 'GPS'
q = {map: {gpsPosition: {latitude: self[:data][:latitude], longitude: self[:data][:longitude]}}}
when 'WIFI'
Similar blocks of code found in 2 locations. Consider refactoring. Open
when 'GSM'
q = {map: {'cellTowers' => [
{mobileCountryCode: data['cell']['mcc'], mobileNetworkCode: data['cell']['mnc'], locationAreaCode: data['cell']['lac'], cellId: data['cell']['cid'], signalStrength: data['cell']['db'], timingAdvance: data['cell']['adv'], age: 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 54.
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: data['cell']['mcc'], mobileNetworkCode: data['cell']['sid'], locationAreaCode: data['cell']['nid'], cellId: data['cell']['bid'], signalStrength: data['cell']['db'], timingAdvance: data['cell']['adv'], age: 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 54.
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 run!
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.run!(*argv)
# This hash will hold all of the options parsed from the command-line by OptionParser.
options = {}
Method config
has 30 lines of code (exceeds 25 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?
Similar blocks of code found in 4 locations. Consider refactoring. Open
def add_operation
require_auth_level :admin
require_auth_level :admin_users
mongoid_query 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 53.
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 4 locations. Consider refactoring. Open
def del_user
require_auth_level :admin
require_auth_level :admin_users
mongoid_query 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 53.
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 4 locations. Consider refactoring. Open
def del_operation
require_auth_level :admin
require_auth_level :admin_users
mongoid_query 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 53.
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 4 locations. Consider refactoring. Open
def add_user
require_auth_level :admin
require_auth_level :admin_users
mongoid_query 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 53.
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 new_link
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new_link(entities)
::Alert.where(:enabled => true, :action => 'LINK').each do |alert|
# skip non matching entities
next unless match_path(alert, entities.first)
next unless match_path(alert, entities.last)
Method melted
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def melted(host, guest)
FileUtils.mkdir_p path('DEBIAN')
# extract the original
CrossPlatform.exec path('bin/ar'), "x #{host} control.tar.gz", {:chdir => path('')}
Method clone_instance
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clone_instance
return nil if self[:_kind] != 'factory'
agent = Item.new
agent._kind = 'agent'
Method run
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
process = Proc.new do
# temporary file is our task id
begin
@total = total
Method melt
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def melt(params)
trace :debug, "Build: melting: #{params}"
executable = path('default')
@appname = params['appname'] || 'agent'
Method restore_backup
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.restore_backup(params)
trace :info, "Restoring backup: #{params['_id']}"
backup_path = File.join File.expand_path(Config.instance.global['BACKUP_DIR']), params['_id']