RocketChat/Rocket.Chat

View on GitHub

Showing 8,229 of 8,229 total issues

Function ComposerOmnichannelInquiry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const ComposerOmnichannelInquiry = (): ReactElement => {
    const dispatchToastMessage = useToastMessageDispatch();

    const room = useOmnichannelRoom();
    const getInquire = useEndpoint('GET', `/v1/livechat/inquiries.getOne`);

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

const AppSetting = ({ id, type, i18nLabel, i18nDescription, values, value, packageValue, ...props }: ISetting): ReactElement => {
    const appId = useRouteParameter('id');
    const tApp = useAppTranslation(appId || '');

    const label = (i18nLabel && tApp(i18nLabel)) || id || tApp(id);

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

const LegacyBanner: FC<LegacyBannerProps> = ({ config }) => {
    const { closable = true, title, text, html, icon, modifiers } = config;

    const inline = !modifiers?.includes('large');
    const variant = modifiers?.includes('danger') ? 'danger' : 'info';
Severity: Minor
Found in apps/meteor/client/views/banners/LegacyBanner.tsx - 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 BusinessHoursRouter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const BusinessHoursRouter = () => {
    const router = useRouter();
    const context = useRouteParameter('context');
    const id = useRouteParameter('id');
    const type = useRouteParameter('type') as LivechatBusinessHourTypes;

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

const TriggersRow = ({ _id, name, description, enabled, reload }: TriggersRowProps) => {
    const t = useTranslation();
    const setModal = useSetModal();
    const triggersRoute = useRoute('omnichannel-triggers');
    const deleteTrigger = useEndpoint('DELETE', '/v1/livechat/triggers/:_id', { _id });
Severity: Minor
Found in apps/meteor/client/views/omnichannel/triggers/TriggersRow.tsx - 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 AgentField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AgentField = ({ agent, isSmall = false }: AgentFieldProps) => {
    const t = useTranslation();
    const { username = '' } = agent ?? {};
    const getUserInfo = useEndpoint('GET', '/v1/users.info');
    const { data, isLoading } = useQuery(['/v1/users.info', username], () => getUserInfo({ username }));
Severity: Minor
Found in apps/meteor/client/views/omnichannel/directory/components/AgentField.tsx - 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 TeamsInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const TeamsInfo = ({
    room,
    retentionPolicy,
    onClickHide,
    onClickClose,
Severity: Minor
Found in apps/meteor/client/views/teams/contextualBar/info/TeamsInfo.tsx - 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 ChannelDesertionTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ChannelDesertionTable: FC<ChannelDesertionTableProps> = ({
    rooms,
    eligibleRoomsLength,
    onChangeRoomSelection,
    selectedRooms,

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

const WebhooksPage = ({ settings }: WebhooksPageProps) => {
    const t = useTranslation();
    const dispatchToastMessage = useToastMessageDispatch();
    const defaultValues = getInitialValues(settings);
    const {
Severity: Minor
Found in apps/meteor/client/views/omnichannel/webhooks/WebhooksPage.tsx - 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 MeetRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MeetRoute = () => {
    const router = useRouter();
    const dispatchToastMessage = useToastMessageDispatch();
    const { t } = useTranslation();

Severity: Minor
Found in apps/meteor/client/views/meet/MeetRoute.tsx - 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 ContactTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function ContactTable(): ReactElement {
    const { current, itemsPerPage, setItemsPerPage, setCurrent, ...paginationProps } = usePagination();
    const { sortBy, sortDirection, setSort } = useSort<'username' | 'phone' | 'name' | 'visitorEmails.address' | 'lastchat'>('username');
    const isCallReady = useIsCallReady();

Severity: Minor
Found in apps/meteor/client/views/omnichannel/directory/contacts/ContactTable.tsx - 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 AddAgent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function AddAgent({ agentList, onAdd }: { agentList: IDepartmentAgent[]; onAdd: (agent: IDepartmentAgent) => void }) {
    const t = useTranslation();

    const [userId, setUserId] = useState('');

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

const BaseTeamsChannels = ({
    loading,
    channels = [],
    text,
    type,

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

const CurrentUserDisplay = ({ user }: CurrentUserDisplayProps) => {
    const showRealNames = useSetting<boolean>('UI_Use_Real_Name');
    const getRoles = useRolesDescription();

    const { t } = useTranslation();
Severity: Minor
Found in apps/meteor/client/views/oauth/components/CurrentUserDisplay.tsx - 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 AddUsers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AddUsers = ({ rid, onClickBack, reload }: AddUsersProps): ReactElement => {
    const t = useTranslation();
    const dispatchToastMessage = useToastMessageDispatch();
    const room = useRoom();

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

const AppDetailsPageHeader = ({ app }: { app: App }): ReactElement => {
    const t = useTranslation();
    const {
        iconFileData,
        name,

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

const AppRow = ({ className, ...props }: App & { className?: string }): ReactElement => {
    const { name, id, shortDescription, iconFileData, marketplaceVersion, iconFileContent, installed, bundledIn, version } = props;

    const router = useRouter();
    const context = useRouteParameter('context');
Severity: Minor
Found in apps/meteor/client/views/marketplace/AppsList/AppRow.tsx - 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 parseMessageTextToAstMarkdown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const parseMessageTextToAstMarkdown = <
    TMessage extends IMessage & Partial<ITranslatedMessage> = IMessage & Partial<ITranslatedMessage>,
>(
    message: TMessage,
    parseOptions: Options,
Severity: Minor
Found in apps/meteor/client/lib/parseMessageTextToAstMarkdown.ts - 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 useOutsideClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const useOutsideClick = (
    ref: RefObject<HTMLElement>,
    onDismiss: (() => void) | undefined,
): {
    onMouseDown: (e: MouseEvent) => void;
Severity: Minor
Found in apps/meteor/client/components/modal/ModalBackdrop.tsx - 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 notifyNewMessageAudio has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function notifyNewMessageAudio(rid?: string): void {
    // This logic is duplicated in /client/startup/unread.coffee.
    const hasFocus = document.hasFocus();
    const messageIsInOpenedRoom = RoomManager.opened === rid;
    const muteFocusedConversations = getUserPreference(Meteor.userId(), 'muteFocusedConversations');
Severity: Minor
Found in apps/meteor/client/startup/notifications/konchatNotifications.ts - 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