RocketChat/Rocket.Chat

View on GitHub

Showing 3,291 of 8,320 total issues

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

function buildFormData(data?: Record<string, any> | void, formData = new FormData(), parentKey?: string): FormData {
    if (data instanceof FormData) {
        return data;
    }
    if (!data) {
Severity: Minor
Found in ee/packages/api-client/src/index.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 useDialPad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const useDialPad = ({ initialValue, initialErrorMessage }: DialPadProps): DialPadStateHandlers => {
    const t = useTranslation();
    const outboundClient = useOutboundDialer();
    const { closeDialModal } = useDialModal();

Severity: Minor
Found in apps/meteor/ee/client/voip/modal/DialPad/hooks/useDialPad.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 DeviceManagementAdminTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const DeviceManagementAdminTable = ({ reloadRef }: { reloadRef: MutableRefObject<() => void> }): ReactElement => {
    const t = useTranslation();
    const [text, setText] = useState('');
    const { current, itemsPerPage, setCurrent, setItemsPerPage, ...paginationProps } = usePagination();
    const { sortBy, sortDirection, setSort } = useSort<'client' | 'os' | 'username' | 'loginAt'>('username');

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

    subscribe(name: string, ...params: any[]) {
        const id = this.ddp.subscribe(name, params);

        // eslint-disable-next-line @typescript-eslint/no-this-alias
        const self = this;
Severity: Minor
Found in ee/packages/ddp-client/src/ClientStream.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 CannedResponseEdit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CannedResponseEdit = ({ cannedResponseData }: CannedResponseEditProps) => {
    const t = useTranslation();
    const router = useRouter();
    const dispatchToastMessage = useToastMessageDispatch();
    const queryClient = useQueryClient();
Severity: Minor
Found in apps/meteor/ee/client/omnichannel/cannedResponses/CannedResponseEdit.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 PrioritiesSelect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const PrioritiesSelect = ({ value = '', label, options, onChange }: PrioritiesSelectProps) => {
    const t = useTranslation();
    const hasLicense = useHasLicenseModule('livechat-enterprise');
    const [sorting] = useState<Record<string, LivechatPriorityWeight>>({});

Severity: Minor
Found in apps/meteor/ee/client/omnichannel/additionalForms/PrioritiesSelect.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 CannedResponseForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CannedResponseForm = () => {
    const t = useTranslation();
    const hasManagerPermission = usePermission('view-all-canned-responses');
    const hasMonitorPermission = usePermission('save-department-canned-responses');

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

    async call(client: Client, packet: IPacket): Promise<void> {
        // if client is not connected we don't need to do anything
        if (client.ws.readyState !== WebSocket.OPEN) {
            return;
        }
Severity: Minor
Found in ee/apps/ddp-streamer/src/Server.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 MessagesPerChannelSection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MessagesPerChannelSection = (): ReactElement => {
    const [period, periodSelectorProps] = usePeriodSelectorState('last 7 days', 'last 30 days', 'last 90 days');

    const t = useTranslation();

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

const CreateCannedResponseModal = ({
    cannedResponseData,
    onClose,
    reloadCannedList,
}: {

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

const UnitEdit = ({ unitData, unitMonitors, unitDepartments }: UnitEditProps) => {
    const t = useTranslation();
    const router = useRouter();
    const saveUnit = useMethod('livechat:saveUnit');
    const dispatchToastMessage = useToastMessageDispatch();
Severity: Minor
Found in apps/meteor/ee/client/omnichannel/units/UnitEdit.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

Severity
Category
Status
Source
Language