Showing 18,390 of 18,390 total issues
Method db_get_node_info
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def db_get_node_info
model, rec_id, _ = TreeBuilder.extract_node_model_and_id(x_node)
@sb[:nodes] = x_node.split('-')
if @sb[:nodes].length == 1
@default_ws = MiqWidgetSet.where_unique_on("default").where(:read_only => true).first
- 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 status
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def status
routes_count = if @ems.present?
@ems.respond_to?(:container_routes) ? @ems.container_routes.count : 0 # ems might not have routes
else
ContainerRoute.count
- 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 ToolbarList
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ToolbarList = (props) => {
const count = useContext(CountContext);
const { items, title, id } = props;
// Set this true for overflowmenu keydown event
const [overflowTab, setOverflowTab] = useState(false);
- Create a ticketCreate a ticket
Method replace_right_cell
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def replace_right_cell(options = {})
@explorer = true
replace_trees = options[:replace_trees]
# FIXME: is the following line needed?
- Create a ticketCreate a ticket
Method build_reconfigure_hash
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_reconfigure_hash(reconfigure_ids)
@req = nil
@reconfig_values = {}
if @request_id == 'new'
@reconfig_values = get_reconfig_info(reconfigure_ids)
- Create a ticketCreate a ticket
Method st_edit
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def st_edit
assert_privileges(params[:id] ? 'catalogitem_edit' : 'catalogitem_new')
# reset the active tree back to :sandt_tree, it was changed temporairly to display automate entry point tree in a popup div
self.x_active_tree = 'sandt_tree'
- Create a ticketCreate a ticket
Method determine_api_endpoints
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def determine_api_endpoints(obj, display_options = {})
base_name = obj.class.base_model.name
case base_name
when /EmsCluster/
api_collection_name = "clusters"
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
useEffect(() => {
if (recordId) {
miqSparkleOn();
API.get(`/api/iso_images/${recordId}`).then((initialValues) => {
setState({ initialValues, isLoading: false });
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
cpuUsageConfig: {
chartId: 'cpuUsageChart',
title: __('CPU'),
units: __('Cores'),
usageDataName: __('Used'),
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
memoryUsageConfig: {
chartId: 'memUsageChart',
title: __('Memory'),
units: __('GB'),
usageDataName: __('Used'),
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
useEffect(() => {
if (recordId) {
miqSparkleOn();
API.get(`/api/pxe_image_types/${recordId}`).then((initialValues) => {
setState({ initialValues, isLoading: false });
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
$scope.$watch('vm._provisioning_repository', function(value) {
if (value) {
playbookReusableCodeMixin.repositoryChanged(vm, 'provisioning', value.id);
} else {
vm.aeMethodModel.provisioning_repository_id = '';
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
$scope.$watch('vm._provisioning_repository', function(value) {
if (value) {
playbookReusableCodeMixin.repositoryChanged(vm, 'provisioning', value.id);
} else {
vm.catalogItemModel.provisioning_repository_id = '';
- Read upRead up
- Create a ticketCreate a ticket
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 86.
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
Function setDiskFormSubmit
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setDiskFormSubmit = (data, setData, formData, roles, renderData) => {
const dataTableData = data.dataTable.disks || [];
if (data.form.action === 'add') {
// code for add
const id = `disk${dataTableData.length}`;
- Create a ticketCreate a ticket
Function CloudObjectStoreContainerForm
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CloudObjectStoreContainerForm = () => {
const [{
initialValues, fields, isLoading,
}, setState] = useState({});
- Create a ticketCreate a ticket
Method button
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def button
@edit = session[:edit] # Restore @edit for adv search box
params[:display] = @display if %w[all_vms vms hosts].include?(@display) # Were we displaying vms or hosts
if params[:pressed].starts_with?("vm_", # Handle buttons from sub-items screen
- Create a ticketCreate a ticket
Method widget_get_form_vars
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def widget_get_form_vars
@widget = @edit[:widget_id] ? MiqWidget.find(@edit[:widget_id]) : MiqWidget.new
copy_params_if_set(@edit[:new], params, %i[title description])
@edit[:new][:filter] = params[:filter_typ] if params[:filter_typ]
- Create a ticketCreate a ticket
Class SecurityGroupController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class SecurityGroupController < ApplicationController
before_action :check_privileges
before_action :get_session_data
after_action :cleanup_action
after_action :set_session_data
- Create a ticketCreate a ticket
Class ContainerDashboardService
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ContainerDashboardService < DashboardService
include ContainerServiceMixin
include Mixins::CheckedIdMixin
include TextualMixins::TextualRefreshStatus
- Create a ticketCreate a ticket
Similar blocks of code found in 4 locations. Consider refactoring. Open
useEffect(() => {
const url = `/${dashboard}/ems_utilization_data/${providerId}`;
http.get(url)
.then((response) => {
setCardData({
- Read upRead up
- Create a ticketCreate a ticket
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 85.
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