Showing 21 of 34 total issues
Function monitor
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function monitor(){
// Collect parameters for HTML form fields
var application = $('#monitor').find("select[name='monitor[application]']").val();
var activity = $('#monitor').find("select[name='monitor[activity]']").val();
// Initialize graph
Function QueryViewModel
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
function QueryViewModel() {
//Data
var self = this;
this.filter = ko.observableArray();
this.filter_having_keys = ko.observable({
Function doGroupAnalysis
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function doGroupAnalysis(data) {
var parent_keys = data.template.parent_keys;
var child_keys = data.template.child_keys;
var kParentCollectionName = "Parent Table";
var kChildCollectionName = "Child Table";
Method filter
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.filter(filter_list)
logs = self
logs_columns = Log.column_lists
string_columns = logs_columns["string_columns"]
time_columns = logs_columns["time_columns"]
- 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
Function doSingleTableAnalysis
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function doSingleTableAnalysis(data){
var kParentCollectionName = "Parent Table";
codapPhone.call({
action: 'reset'
Method index
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def index
query = JSON.parse(json_escape(params["json-textarea"]))
logs = Log.access_filter(current_user)
logs = logs.filter(query["filter"]) if (query["filter"].present?)
- 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 compute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.compute(logs, parent, synthetic_data, parents_list, child_keys)
computed_logs = []
if synthetic_data["rule"] != nil && synthetic_data["rule"]["pattern"] != nil
pattern = synthetic_data["rule"]["pattern"]
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 index
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def index
if @query["group"] != nil && %w{username activity application session event}.include?(@query["group"])
initialize_group_transform
if @query["child_query"].present?
if @query["child_query"]["add_child_data"] == true
- 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 filter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.filter(filter_list)
logs = self
logs_columns = Log.column_lists
string_columns = logs_columns["string_columns"]
time_columns = logs_columns["time_columns"]
Method compute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.compute(logs, parent, synthetic_data, parents_list, child_keys)
computed_logs = []
if synthetic_data["rule"] != nil && synthetic_data["rule"]["pattern"] != nil
pattern = synthetic_data["rule"]["pattern"]
end
Function fnServerParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
fnServerParams: function(aoData) {
var activityName, applicationName, endPeriod, startPeriod, timeZone;
applicationName = $("#filter_application").val();
aoData.push({
name: "applicationName",
Consider simplifying this complex logical expression. Open
if key != "sessionID" && key != "uname" && key != "application" && key != "activity" && key != "event" && key != "timestamp" && key != "parameters"
new_log[:extras][key] = value
end
Method value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def value(key)
if self[key].present?
self[key].class != ActiveSupport::TimeWithZone ? self[key] : self[key].to_i
elsif self[:parameters].present? && self[:parameters][key].present?
return self[:parameters][key]
- 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 index
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def index
# If the request body contains a single log (request body is not an array)
if ( !JSON.parse(request.body.read).is_a?(Array) )
log_data = JSON.parse(request.body.read)
status, log = create_new_is_log(log_data)
- 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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
# If the request body contains a single log (request body is not an array)
if ( !JSON.parse(request.body.read).is_a?(Array) )
log_data = JSON.parse(request.body.read)
status, log = create_new_log(log_data)
- 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 column_lists
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.column_lists
string_columns, time_columns, hstore_concat_string = [], [], ""
columns_hash = Hash.new
Log.columns.each do |column|
columns_hash[column.name] = column.type
- 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 filter_having_keys
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.filter_having_keys(filter)
logs = self
logs_columns = Log.column_lists
string_columns = logs_columns["string_columns"]
time_columns = logs_columns["time_columns"]
- 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 compute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.compute(logs, parent, synthetic_data, parents_list, child_keys)
Method fetch_logs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fetch_logs
logs = Log.where(application: @application_list)
logs = logs.order("#{sort_column} #{sort_direction}")
if params[:applicationName].present?
logs = logs.where(application: params[:applicationName])
- 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
Avoid too many return
statements within this method. Open
return flash_type.to_s