RocketChat/Rocket.Chat

View on GitHub

Showing 3,268 of 8,229 total issues

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

export const SidebarFooterWatermark = (): ReactElement | null => {
    const t = useTranslation();

    const response = useLicense();

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

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

    const utc = timezone === 'utc';

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

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

const TagEdit = ({ tagData, currentDepartments }: TagEditProps) => {
    const t = useTranslation();
    const router = useRouter();
    const queryClient = useQueryClient();
    const handleDeleteTag = useRemoveTag();
Severity: Minor
Found in apps/meteor/ee/client/omnichannel/tags/TagEdit.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

Severity
Category
Status
Source
Language