Showing 76 of 163 total issues
Function withDelete
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const withDelete = Component => {
const Subcomponent = ({
confirmDeleteTitle,
submitDelete,
prepareMutation,
Function deleteMockFactory
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const deleteMockFactory = (first, second, errors = null) => {
let called = false;
const deleteMocks = [
{
Function EditableInput
has a Cognitive Complexity of 12 (exceeds 5 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('');
- 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 CvesTable
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CvesTable = props => {
const columns = [
{ title: __('Ref Id') },
{ title: __('Has Errata?') },
{ title: __('Hosts Count') },
Function ConfirmModal
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ConfirmModal = props => {
const [callMutation, { loading }] = props.prepareMutation();
const actions = [
<Button
Function OvalPoliciesIndex
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OvalPoliciesIndex = props => {
const useFetchFn = componentProps =>
useQuery(policiesQuery, {
variables: useParamsToVars(componentProps.history),
});
Method initial_check_attrs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initial_check_attrs
override_msg = _("Could not update Ansible Variables with override: true")
[
{
Function onCompleted
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onCompleted = response => {
const failedChecks = response.data.createOvalPolicy.checkCollection.filter(
check => check.result === 'fail'
);
if (failedChecks.length === 0) {
Method find_resources_before_create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_resources_before_create
policy_id = params[:policy_id].to_i
unless ForemanOpenscap::Policy.where(:id => policy_id).any?
upload_fail(_("Policy with id %s not found.") % policy_id)
- 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 fieldWithHandlers
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fieldWithHandlers = Component => {
const Subcomponent = ({ label, form, field, isRequired, ...rest }) => {
const fieldProps = wrapFieldProps(field);
const valid = shouldValidate(form, field.name);
Method upload_from_files
has 30 lines of code (exceeds 25 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
Method validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate(data_stream_content)
return unless data_stream_content.scap_file_changed?
content_type = data_type(data_stream_content)
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const withLoading = Component => {
const Subcomponent = ({
fetchFn,
resultPath,
renameData,
- 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 prepareOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const prepareOptions = fetchedResults => {
if (loading) {
return [
<SelectOption isDisabled key={0}>
{__('Loading...')}
Method find_resources_before_create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_resources_before_create
policy_id = params[:policy_id].to_i
unless ForemanOpenscap::Policy.where(:id => policy_id).any?
upload_fail(_("Policy with id %s not found.") % policy_id)
Method validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(data_stream_content)
return unless data_stream_content.scap_file_changed?
content_type = data_type(data_stream_content)
Method find_multiple
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_multiple
if params[:arf_report_ids].present?
@arf_reports = ::ForemanOpenscap::ArfReport.where(:id => params[:arf_report_ids])
if @arf_reports.empty?
error _('No compliance reports were found.')
- 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 submit_or_cancel_policy
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def submit_or_cancel_policy(form, overwrite = nil, args = {})
args[:cancel_path] ||= send("#{controller_name}_path")
content_tag(:div, :class => "clearfix") do
content_tag(:div, :class => "form-actions") do
text = overwrite ? overwrite : _("Submit")
- 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 ReviewRemediation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ReviewRemediation = () => {
const {
fixes,
snippet,
method,
- 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 onUpdateSuccess
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const onUpdateSuccess = (
closeEditable,
stopSubmitting,
showToast,
attr,
- 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"