Showing 90 of 230 total issues
Class RemoteExecutionProvider
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class RemoteExecutionProvider
EFFECTIVE_USER_METHODS = %w[sudo dzdo su].freeze
class << self
File fixtures.js
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable max-lines */
import configureMockStore from 'redux-mock-store';
import hostsQuery from '../steps/HostsAndInputs/hosts.gql';
import hostgroupsQuery from '../steps/HostsAndInputs/hostgroups.gql';
File engine.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ForemanRemoteExecution
DYNFLOW_QUEUE = :remote_execution
class Engine < ::Rails::Engine
engine_name 'foreman_remote_execution'
Class JobInvocation
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class JobInvocation < ApplicationRecord
CACHE_PREFIX = "job_invocation".freeze
audited :except => [:task_id, :targeting_id, :task_group_id, :triggering_id]
Class RunHostsJob
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class RunHostsJob < Actions::ActionWithSubPlans
include Actions::RecurringAction
include Actions::ObservableAction
include Actions::RemoteExecution::EventHelpers
Function getJobInvocations
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const getJobInvocations = url => async (dispatch, getState) => {
function onGetJobInvocationsSuccess({ data }) {
// If the job has finished, stop polling
if (data.finished) {
dispatch({
- 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
File ScheduleRecurring.js
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useState, useCallback } from 'react';
import PropTypes from 'prop-types';
import {
Form,
FormGroup,
Class RunHostJob
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class RunHostJob < Actions::EntryAction
include ::Actions::Helpers::WithContinuousOutput
include ::Actions::Helpers::WithDelegatedAction
include ::Actions::ObservableAction
include ::Actions::RemoteExecution::TemplateInvocationProgressLogging
Function WrappedTargetingHosts
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
const WrappedTargetingHosts = () => {
const dispatch = useDispatch();
const { perPage, perPageOptions } = useForemanSettings();
const autoRefresh = useSelector(selectAutoRefresh);
File index.js
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useState } from 'react';
import { isEmpty, debounce } from 'lodash';
import {
Alert,
Button,
File Fields.js
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import PropTypes from 'prop-types';
import { FormGroup, TextInput, Radio } from '@patternfly/react-core';
import { translate as __ } from 'foremanReact/common/I18n';
import { helpLabel, ResetDefault } from '../form/FormHelpers';
Function submit
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export const submit = ({
jobTemplateID,
templateValues,
advancedValues,
scheduleValue,
- 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 testSetup
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const testSetup = (selectors, api) => {
jest.spyOn(api, 'get');
jest.spyOn(selectors, 'selectJobTemplate');
jest.spyOn(selectors, 'selectJobTemplates');
jest.spyOn(selectors, 'selectJobCategories');
Function getJobInvocations
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getJobInvocations = url => async (dispatch, getState) => {
function onGetJobInvocationsSuccess({ data }) {
// If the job has finished, stop polling
if (data.finished) {
dispatch({
Function mockApi
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export const mockApi = api => {
api.get.mockImplementation(({ handleSuccess, ...action }) => {
if (action.key === 'JOB_CATEGORIES') {
handleSuccess &&
handleSuccess({
- 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 job_invocation_task_buttons
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def job_invocation_task_buttons(task)
job_invocation = task.task_groups.find { |group| group.class == JobInvocationTaskGroup }.job_invocation
task_authorizer = Authorizer.new(User.current, :collection => [task])
buttons = []
if (template = job_report_template) && authorized_for(controller: :report_templates, action: :generate)
Function mockApi
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const mockApi = api => {
api.get.mockImplementation(({ handleSuccess, ...action }) => {
if (action.key === 'JOB_CATEGORIES') {
handleSuccess &&
handleSuccess({
Function getRepeatComponent
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getRepeatComponent = () => {
switch (repeatType) {
case repeatTypes.cronline:
return (
<RepeatCron
Function SearchSelect
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const SearchSelect = ({
name,
selected,
setSelected,
placeholderText,
- 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 prepended
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.prepended(base)
base.instance_eval do
has_many :targeting_hosts, :dependent => :destroy, :foreign_key => 'host_id'
has_many :template_invocations, :dependent => :destroy, :foreign_key => 'host_id'
has_one :execution_status_object, :class_name => 'HostStatus::ExecutionStatus', :foreign_key => 'host_id', :dependent => :destroy