Showing 18,390 of 18,390 total issues
Cyclomatic complexity for format_cols is too high. [22/11] Open
def self.format_cols(view, row, controller, options)
cols = []
state = {"state" => :state_format}
hardware = {"hardware.bitness" => :hardware_bitness_format}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one. Blocks that are calls to builtin iteration methods (e.g. `ary.map{...}) also add one, others are ignored.
def each_child_node(*types) # count begins: 1
unless block_given? # unless: +1
return to_enum(__method__, *types)
children.each do |child| # each{}: +1
next unless child.is_a?(Node) # unless: +1
yield child if types.empty? || # if: +1, ||: +1
types.include?(child.type)
end
self
end # total: 6
Function onSubmit
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onSubmit = (values) => {
// Compares initialValues and values and returns the value only if it's different
const isDifferent = (name) => (get(initialValues, name) !== get(values, name) ? get(values, name) : undefined);
miqSparkleOn();
- Create a ticketCreate a ticket
Method schedule_edit
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def schedule_edit
assert_privileges("schedule_edit")
case params[:button]
when "cancel"
@schedule = MiqSchedule.find_by(:id => params[:id])
- Create a ticketCreate a ticket
Function aeMethodFormController
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function aeMethodFormController($http, $scope, aeMethodFormId, currentRegion, miqService, playbookReusableCodeMixin, location, API) {
var vm = this;
var init = function() {
vm.aeMethodModel = {
name: '',
- Read upRead up
- Create a ticketCreate a ticket
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 ProviderForm
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const ProviderForm = ({
providerId, kind, title, redirect,
}) => {
const edit = !!providerId;
const [{ fields, initialValues }, setState] = useState({});
- Read upRead up
- Create a ticketCreate a ticket
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 SettingsCompanyTags
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const SettingsCompanyTags = ({ pageTitle, categoryId }) => {
const pageTypes = {
list: 'LIST',
form: 'FORM',
};
- Read upRead up
- Create a ticketCreate a ticket
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 AeInlineMethod
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const AeInlineMethod = ({ type, selected }) => {
const queryClient = new QueryClient();
const [data, setData] = useState({
isModalOpen: false,
- Read upRead up
- Create a ticketCreate a ticket
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 center_toolbar_filename_services
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def center_toolbar_filename_services
if x_active_tree == :sandt_tree
if TreeBuilder.get_model_for_prefix(@nodetype) == "ServiceTemplate"
"servicetemplate_center_tb"
elsif @sb[:buttons_node]
- Read upRead up
- Create a ticketCreate a ticket
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 textual_collection_link
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def textual_collection_link(collection, as: nil, controller_collection: nil, explorer: false, feature: nil, label: nil, link: nil)
if collection.kind_of?(Array)
unless as && link
raise ArgumentError, ":as and :link are both required when linking to an array",
caller.reject { |x| x =~ /^#{__FILE__}:/ }
- Read upRead up
- Create a ticketCreate a ticket
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 miq_summary_action_type
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def miq_summary_action_type(record, alert_guids, cats)
record_options = record.options
data = {:mode => "miq_action_type", :rows => [], :title => ""}
rows = []
case record.action_type
- Read upRead up
- Create a ticketCreate a ticket
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 update_from_params
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def update_from_params(params)
self.levels = params[:tl_levels]&.map(&:to_sym) || group_levels
self.categories = {}
params.fetch(:tl_categories, []).each do |category_display_name|
next if category_display_name == "Other"
- Read upRead up
- Create a ticketCreate a ticket
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 exp_token_pressed
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def exp_token_pressed
@edit = session[:edit]
token = params[:token].to_i
if token == @edit[@expkey][:exp_token] || # User selected same token as already selected
(@edit[@expkey][:exp_token] && @edit[:edit_exp].key?("???")) # or new token in process
- Read upRead up
- Create a ticketCreate a ticket
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 custom_buttons
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def custom_buttons(ids = nil, display_options = {})
button = CustomButton.find(params[:button_id])
cls = custom_button_class_model(button.applies_to_class)
@explorer = true if BASE_MODEL_EXPLORER_CLASSES.include?(cls)
ids ||= params[:id] unless relationship_table_screen? && @record.nil?
- Read upRead up
- Create a ticketCreate a ticket
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 21 (exceeds 5 allowed). Consider refactoring. Open
def index
case params[:model]
when 'ExtManagementSystem'
record = ExtManagementSystem.find_by(:id => params[:id])
if record
- Read upRead up
- Create a ticketCreate a ticket
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 process_datetime_expression_field
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def process_datetime_expression_field(value_key, exp_key, exp_value_key)
if [:date, :datetime].include?(self[value_key][:type]) # Seting value for date/time fields
self[value_key][:date_format] ||= 'r'
if self[exp_key] == EXP_FROM
self[exp_value_key] = self[value_key][:date_format] == 's' ? Array.new(2) : [EXP_TODAY, EXP_TODAY]
- Read upRead up
- Create a ticketCreate a ticket
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 set_field_vars
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def set_field_vars(parent = nil)
fields = parent_fields(parent)
highest_priority = fields.count
@edit[:new][:fields].each_with_index do |fld, i|
if fld["id"].nil?
- Read upRead up
- Create a ticketCreate a ticket
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 button
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def button
@edit = session[:edit] # Restore @edit for adv search box
params[:display] = @display if display_methods.include?(@display) # Were we displaying nested list
# Handle Toolbar Policy Tag Button
- Read upRead up
- Create a ticketCreate a ticket
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 ap_build_edit_screen
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def ap_build_edit_screen
@embedded = true # don't show flash msg or check boxes in analysis profiles partial
@scan = @edit[:scan_id] ? ScanItemSet.find(@edit[:scan_id]) : ScanItemSet.new
@sb[:req] = "new" if %w[new copy create].include?(request.parameters["action"]) || %w[copy Host Vm].include?(params[:typ])
@sb[:req] = "edit" if %w[edit update].include?(request.parameters["action"]) || params[:typ] == "edit"
- Read upRead up
- Create a ticketCreate a ticket
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 register_nodes
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def register_nodes
assert_privileges("host_register_nodes")
redirect_to(ems_infra_path(params[:id], :display => "hosts")) if params[:cancel]
# Hiding the toolbars
- Read upRead up
- Create a ticketCreate a ticket
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 update
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def update(params)
if params[:chosen_pivot1] && params[:chosen_pivot1] != by1
self.by1 = params[:chosen_pivot1]
if params[:chosen_pivot1] == NOTHING_STRING
self.by2 = NOTHING_STRING
- Read upRead up
- Create a ticketCreate a ticket
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"