RedHatInsights/insights-rbac-ui

View on GitHub

Showing 109 of 381 total issues

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

const EditRoleModal = ({ cancelRoute, submitRoute = cancelRoute, afterSubmit }) => {
  const intl = useIntl();
  const isMounted = useIsMounted();
  const navigate = useAppNavigate();
  const dispatch = useDispatch();
Severity: Minor
Found in src/smart-components/role/edit-role-modal.js - 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 createRows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const createRows = (showResDefinitions, uuid, data, intl, selectedRows = []) =>
  data.reduce((acc, { resourceDefinitions, permission, modified }) => {
    const [appName, type, operation] = permission.split(':');
    return [
      ...acc,
Severity: Minor
Found in src/smart-components/role/role-permissions-table-helpers.js - 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 RbacBreadcrumbs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const RbacBreadcrumbs = (breadcrumbs) => {
  return breadcrumbs ? (
    <Breadcrumb>
      {Object.values(breadcrumbs).map((item, index) =>
        item.title ? (
Severity: Minor
Found in src/presentational-components/shared/breadcrumbs.js - About 25 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 RolesList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const RolesList = ({ selectedRoles, setSelectedRoles, rolesExcluded, groupId: groupUuid }) => {
  const intl = useIntl();
  const chrome = useChrome();
  const dispatch = useDispatch();
  const textFilterRef = useRef(null);
Severity: Minor
Found in src/smart-components/group/add-group/roles-list.js - About 25 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 MUAAccessTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MUAAccessTable = ({ filters, setFilters, apps, hasActiveFilters, showResourceDefinitions }) => {
  const intl = useIntl();
  const [{ rdOpen, rdPermission, resourceDefinitions }, setRdConfig] = useState({ rdOpen: false });
  const { current: columns } = useRef([
    { title: intl.formatMessage(messages.application), key: 'application', transforms: [sortable] },
Severity: Minor
Found in src/smart-components/myUserAccess/MUAAccessTable.js - About 25 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 MyUserAccess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MyUserAccess = () => {
  const intl = useIntl();
  const chrome = useChrome();
  const [user, setUser] = useState({});
  const [{ bundle }, setSearchParams] = useSearchParams();
Severity: Minor
Found in src/smart-components/myUserAccess/MUAHome.js - About 25 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 isExternalIdp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const isExternalIdp = (token = '') => {
  let roles = [''];
  let tokenArray = token.split('.');
  if (tokenArray.length > 1) {
    let token1 = window.atob(tokenArray[1]);
Severity: Minor
Found in src/helpers/shared/helpers.js - About 25 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 validateNextAddRolePermissionStep has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const validateNextAddRolePermissionStep = (currentStep, values) => {
  const permissions = (values && values['add-permissions-table']) || [];
  const hasCostPermissions = permissions.some(({ uuid }) => isCostPermission(uuid));
  const hasInventoryPermissions = permissions.some(({ uuid }) => isInventoryPermission(uuid));

Severity: Minor
Found in src/smart-components/role/permission-wizard-helper.js - About 25 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 AddGroupWizard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AddGroupWizard = ({ postMethod, pagination, filters, orderBy }) => {
  const dispatch = useDispatch();
  const intl = useIntl();
  const container = useRef(document.createElement('div'));
  const { isBeta } = useChrome();
Severity: Minor
Found in src/smart-components/group/add-group/add-group-wizard.js - About 25 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