Showing 109 of 381 total issues
Function AddRoleWizard
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const AddRoleWizard = ({ pagination, filters, orderBy }) => {
const intl = useIntl();
const dispatch = useDispatch();
const navigate = useAppNavigate();
const chrome = useChrome();
- 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 CommonBundleView
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const CommonBundleView = ({ apps }) => {
const isOrgAdmin = useContext(OrgAdminContext);
const [name, setName] = useState('');
const [permission, setPermission] = useState('');
const [application, setApplication] = 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 rows
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const rows = useMemo(() => {
return users.map((user: UserProps) => ({
id: user.username,
is_active: user.is_active,
row: [
Function Users
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Users = () => {
const intl = useIntl();
const activeUserPermissions = useContext(PermissionsContext);
const { appNavClick } = useChrome();
const isITLess = useFlag('platform.rbac.itless');
Function addUsers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addUsers = (usersData) => {
const cache = createIntlCache();
const intl = createIntl({ locale, messages: providerMessages }, cache);
return {
type: ActionTypes.ADD_USERS,
Function createRows
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const createRows = (userLinks: boolean, data: UserProps[] = [], intl: IntlShape, checkedRows = [], isSelectable = false): RowProps[] =>
data?.reduce<RowProps[]>((acc, { username, is_active: isActive, email, first_name: firstName, last_name: lastName, is_org_admin: isOrgAdmin }) => {
const newEntry: RowProps = {
uuid: username,
cells: [
- 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 handleSubmit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleSubmit = (data) => {
dispatchLocally({ type: 'update', payload: { changedResources: data['dual-list-select'] } });
const dualListData = data['dual-list-select'].map((item) => (item === 'null' ? null : item));
const newAccess = {
permission: permissionId,
Function SetRoles
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SetRoles = (props) => {
const intl = useIntl();
const [selectedRoles, setSelectedRoles] = useState([]);
const { input } = useFieldApi(props);
const formOptions = useFormApi();
Function onChange
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
onChange: (_e, filterBy) => {
const newFilter =
typeof filterBy !== 'string' && !Array.isArray(filterBy) ? Object.keys(pickBy(filterBy[''], (value) => value)) : filterBy;
setFilterValue({
Function onDelete
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
onDelete: (_e, [deleted], isAll) => {
const setKeyValue = (value, type, key) => {
if (isAll) {
return type === 'group' || type === 'checkbox' ? [] : '';
}
Consider simplifying this complex logical expression. Open
if (
!baseRole ||
roleType !== 'copy' ||
formOptions.getState().values['base-permissions-loaded'] ||
selectedPermissions.length > 0 ||
Function listPermissionOptions
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
export async function listPermissionOptions(field, limit, offset, application, resourceType, verb, allowedOnly, options) {
Function ReviewStep
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ReviewStep = () => {
const intl = useIntl();
const enableWorkspacesNameChange = useFlag('platform.rbac.groups-to-workspaces-rename');
const formOptions = useFormApi();
const {
- 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 getServiceAccounts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export async function getServiceAccounts({ limit = defaultCompactSettings.limit, offset = 0, token, sso, groupId }: any) {
const page = Math.trunc(offset / limit) + 1;
const perPage = limit;
const response = await serviceAccountsApi.getServiceAccounts(page, perPage, token, sso);
- 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 createRows
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const createRows = (data, selectedRows, intl, expanded, adminGroup) =>
data.reduce(
(
acc,
{ uuid, access = [], display_name, name, description, system, accessCount, groups_in_count: groupsCount, groups_in: groups, modified },
- 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 reducer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const reducer = (state, action) => {
const prevState = state[action.key];
switch (action.type) {
case 'toggle':
return {
- 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 AddGroupRoles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const AddGroupRoles = ({
afterSubmit,
fetchUuid,
selectedRoles,
setSelectedRoles,
- 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 fetchUsers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function fetchUsers({ limit, offset = 0, orderBy, filters = {}, usesMetaInURL, matchCriteria = 'partial' }) {
const { username, email, status = [] } = filters;
const sortOrder = orderBy === '-username' ? 'desc' : 'asc';
const mappedStatus =
typeof status === 'string'
- 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 schemaBuilder
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const schemaBuilder = (container, featureFlag) => {
const cache = createIntlCache();
const intl = createIntl({ locale, messages: providerMessages }, cache);
return {
- 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 schemaBuilder
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const schemaBuilder = (container, featureFlag) => {
const cache = createIntlCache();
const intl = createIntl({ locale, messages: providerMessages }, cache);
return {
- 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"