ManageIQ/manageiq-ui-classic

View on GitHub

Showing 2,015 of 18,390 total issues

Function CloudDatabaseForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const CloudDatabaseForm = ({ recordId }) => {
  const [{
    isLoading, initialValues, fields,
  }, setState] = useState({
    isLoading: !!recordId, initialValues: {}, fields: [],
Severity: Minor
Found in app/javascript/components/cloud-database-form/cloud-database-form.jsx - About 35 mins to fix

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 javascript_flash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def javascript_flash(**args)
      add_flash(args[:text], args[:severity]) if args[:text].present?

      flash_div_id = args.key?(:flash_div_id) ? args[:flash_div_id] : 'flash_msg_div'
      ex = ExplorerPresenter.flash.replace(flash_div_id,
Severity: Minor
Found in app/helpers/application_helper/flash.rb - About 35 mins to fix

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 CloudTenantForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const CloudTenantForm = ({ recordId }) => {
  const [{ isLoading, initialValues, emsId }, setState] = useState({ isLoading: !!recordId, initialValues: {} });

  useEffect(() => {
    if (recordId) {
Severity: Minor
Found in app/javascript/components/cloud-tenant-form/index.jsx - About 35 mins to fix

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 WorkflowPayload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const WorkflowPayload = ({ recordId }) => {
  const tabLabels = [
    { name: 'text', text: __('Text') },
    { name: 'graph', text: __('Graph') },
  ];
Severity: Minor
Found in app/javascript/components/workflows/workflow_payload.jsx - About 35 mins to fix

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 CustomURLTabs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const CustomURLTabs = ({
  tabs, path, currentTab, checkForChanges,
}) => {
  const [{ selectedTab, showConfirm, url }, setState] = useState({ selectedTab: 0, showConfirm: false });
  const activeTabClassName = 'bx--tabs--scrollable__nav-item--selected';
Severity: Minor
Found in app/javascript/components/custom-url-tabs/index.jsx - About 35 mins to fix

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 WorkflowCredentialsForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const WorkflowCredentialsForm = ({ recordId }) => {
  const [{ fields, initialValues, isLoading }, setState] = useState({ fields: [], isLoading: !!recordId });
  const promise = useMemo(() => API.options('/api/authentications'), []);
  const submitLabel = !!recordId ? __('Save') : __('Add');

Severity: Minor
Found in app/javascript/components/workflow-credentials-form/index.jsx - About 35 mins to fix

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 MiqStructuredListLink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const MiqStructuredListLink = ({ row, clickEvents, onClick }) => {
  const content = <MiqStructuredListContent row={row} />;

  /** Function to include content for mode that contains miq summary
    * if only link is passed as props we render Link with href tag

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 MiqButton has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function MiqButton(props) {
  let { title } = props;
  if (props.enabled && props.enabledTitle) {
    title = props.enabledTitle;
  }
Severity: Minor
Found in app/javascript/forms/miq-button.jsx - About 35 mins to fix

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 isVisibleButtonOrSelect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const isVisibleButtonOrSelect = (item) => (
  item.type && (
    (isButtonSelect(item) && isButtonSelectVisible(item))
    || (isButton(item) && !item.hidden)
    || (isButtonTwoState(item) && !item.hidden)
Severity: Minor
Found in app/javascript/components/toolbar/Toolbar.jsx - About 35 mins to fix

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 NamespaceSelector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const NamespaceSelector = ({ onSelectMethod, selectedIds }) => {
  const [filterData, setFilterData] = useState({ searchText: '', selectedDomain: '' });

  /** Loads the domains and stores in domainData for 60 seconds. */
  const { data: domainsData, isLoading: domainsLoading } = useQuery(
Severity: Minor
Found in app/javascript/components/AeInlineMethod/NamespaceSelector.jsx - About 35 mins to fix

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 single_relationship_link has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def single_relationship_link(record, table_name, property_name = nil)
      property_name ||= table_name
      ent = record.send(property_name)
      name = ui_lookup(:table => table_name.to_s)

Severity: Minor
Found in app/helpers/application_helper/listnav.rb - About 35 mins to fix

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 MiqStructuredList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const MiqStructuredList = ({
  title, headers, rows, mode, onClick, message, className = '',
}) => {
  const clickEvents = hasClickEvents(mode);

Severity: Minor
Found in app/javascript/components/miq-structured-list/index.jsx - About 35 mins to fix

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 request_details_summary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def request_details_summary(miq_request, user)
    rows = [
      row_data(_('Request ID'), miq_request.id),
      row_data(_('Status'), _(miq_request.status)),
      row_data(_('Request State'), _(miq_request.state.titleize))
Severity: Minor
Found in app/helpers/request_details_helper.rb - About 35 mins to fix

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 MiqStructuredListBody has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const MiqStructuredListBody = ({
  rows, mode, onClick, clickEvents,
}) => {
  const list = (clickEvents ? rows.map((item) => item.cells) : rows);

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 onSubmitData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const onSubmitData = (values, miqRequestInitialOptions) => {
  // Request Date (created_recently)
  if (values.selectedPeriod) { // user selected
    daysAgo = values.selectedPeriod;
  } else if (miqRequestInitialOptions.timePeriods[1] && miqRequestInitialOptions.timePeriods[1].value) {
Severity: Minor
Found in app/javascript/components/service-request-default/index.jsx - About 35 mins to fix

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 subscribeToSubject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const subscribeToSubject = (dispatch) => (
  listenToRx(
    (event) => {
      if (event.eventType === 'updateToolbarCount') {
        dispatch({ type: 'SET', count: event.countSelected });
Severity: Minor
Found in app/javascript/components/miq-toolbar.jsx - About 35 mins to fix

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 layout_uses_tabs? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def layout_uses_tabs?
    return false if %w[login authenticate auth_error].include?(controller.action_name)

    layout = case @layout
             when 'container_dashboard', 'dashboard', 'ems_infra_dashboard', 'exception', 'physical_infra_overview'
Severity: Minor
Found in app/helpers/application_helper/page_layouts.rb - About 35 mins to fix

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 relationship_table_screen? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def relationship_table_screen?
    return false if @display.nil?
    display_class = @display.camelize.singularize
    return false unless custom_button_appliable_class?(display_class)
    # Don't render custom buttons on nested generic object lists since it could contain generic objects with different definitions and custom buttons

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 method_missing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def method_missing(mthd_sym, *args, &bolck)
      match = /textual_(.*)/.match(mthd_sym)
      if match && match.size > 1
        prop = match[1]
        value = @record[prop] if @record.attribute_present?(prop)
Severity: Minor
Found in app/helpers/container_image_helper/textual_summary.rb - About 35 mins to fix

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_parent_service has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def textual_parent_service
    parent = @record.parent_service
    if parent
      {
        :label => _("Parent Service"),
Severity: Minor
Found in app/helpers/service_helper/textual_summary.rb - About 35 mins to fix

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

Severity
Category
Status
Source
Language