Showing 76 of 163 total issues
Function EditableInput
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EditableInput = props => {
const [editing, setEditing] = useState(false);
const [submitting, setSubmitting] = useState(false);
const [inputValue, setInputValue] = useState(props.value);
const [error, setError] = useState('');
Function OvalContentsNew
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OvalContentsNew = props => {
const [file, setFile] = useState(null);
const [fileTouched, setFileTouched] = useState(false);
const [fileFromUrl, setFileFromUrl] = useState(true);
Function HostgroupSelect
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const HostgroupSelect = ({
selected,
setSelected,
hgsError,
showError,
- 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 withLoading
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
const withLoading = Component => {
const Subcomponent = ({
fetchFn,
resultPath,
renameData,
File engine.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ForemanOpenscap
def self.with_katello?
Foreman::Plugin.installed?("katello")
end
Method create_arf
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.create_arf(asset, proxy, params)
arf_report = nil
policy = Policy.find_by :id => params[:policy_id]
return unless policy
- 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
Class ArfReport
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ArfReport < ::Report
include Taxonomix
include OpenscapProxyExtensions
# attr_accessible :host_id, :reported_at, :status, :metrics
Method prepended
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.prepended(base)
base.has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset", :dependent => :destroy
base.has_many :asset_policies, :through => :asset, :class_name => "::ForemanOpenscap::AssetPolicy"
base.has_many :policies, :through => :asset_policies, :class_name => "::ForemanOpenscap::Policy"
base.has_many :arf_reports, :class_name => '::ForemanOpenscap::ArfReport', :foreign_key => :host_id
Function DetailsTab
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DetailsTab = props => {
const { policy, showToast } = props;
const [callMutation] = useMutation(updateOvalPolicyMutation);
Function onSubmit
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const onSubmit = (
history,
showToast,
callMutation,
assignedHgs,
- 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 OvalContentsTable
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OvalContentsTable = props => {
const columns = [
{ title: __('Name') },
{ title: __('URL') },
{ title: __('Original File Name') },
Function onSubmit
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
) => (values, actions) => {
const onCompleted = response => {
const failedChecks = response.data.createOvalPolicy.checkCollection.filter(
check => check.result === 'fail'
);
Method process_policy
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_policy(policy)
reports_of_policy = ForemanOpenscap::ArfReport.unscoped
.of_policy(policy)
.order("#{ForemanOpenscap::ArfReport.table_name}.created_at DESC")
latest = reports_of_policy.first
- 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 upload_from_files
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def upload_from_files(files_array, from_scap_guide = false)
unless files_array.is_a? Array
@result.errors.push(_("Expected an array of files to upload, got: %s.") % files_array)
return @result
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 create_arf
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_arf(asset, proxy, params)
arf_report = nil
policy = Policy.find_by :id => params[:policy_id]
return unless policy
Function OvalPoliciesShow
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OvalPoliciesShow = props => {
const { policy, match, history } = props;
const activeTab = match.params.tab ? match.params.tab : 'details';
const handleTabSelect = (event, value) => {
Method find_multiple
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def find_multiple
if params.key?(:host_names) || params.key?(:host_ids) || multiple_with_filter?
@hosts = Host.search_for(params[:search]) if multiple_with_filter?
@hosts ||= Host.merge(Host.where(id: params[:host_ids]).or(Host.where(name: params[:host_names])))
if @hosts.empty?
- 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 OvalPoliciesTable
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OvalPoliciesTable = props => {
const columns = [{ title: __('Name') }, { title: __('OVAL Content') }];
const rows = props.policies.map(policy => ({
cells: [
Function OvalContentsIndex
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OvalContentsIndex = props => {
const useFetchFn = componentProps =>
useQuery(ovalContentsQuery, {
variables: useParamsToVars(componentProps.history),
});
Function deleteMockFactory
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const deleteMockFactory = (first, second, errors = null) => {
let called = false;
const deleteMocks = [
{