RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/lib/federation/Federation.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

File Federation.spec.ts has 467 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { IRoom, ISubscription, IUser, ValueOf } from '@rocket.chat/core-typings';

import { RoomRoles } from '../../../app/models/client';
import { RoomMemberActions, RoomSettingsEnum } from '../../../definition/IRoomTypeConfig';
import * as Federation from './Federation';
Severity: Minor
Found in apps/meteor/client/lib/federation/Federation.spec.ts - About 7 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('Seeing owners', () => {
                const theirRole = ['owner'];
    
                it('should return false if the user want to add/remove owners as a moderator', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue({ roles: theirRole });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 days to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 51..93

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 434.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('Seeing another owners', () => {
                const theirRole = ['owner'];
    
                it('should return true if the user want to remove himself as an owner', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue({ roles: theirRole });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 days to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 165..207

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 434.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('Seeing owners', () => {
                const theirRole = ['owner'];
    
                it('should return false if the user want to add/remove owners as a normal user', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue({ roles: theirRole });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 day to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 328..357

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 316.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('Seeing moderators', () => {
                const theirRole = ['owner'];
    
                it('should return false if the user want to add/remove owner as a normal user', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue({ roles: theirRole });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 day to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 297..326

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 316.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('Seeing normal users', () => {
                it('should return false if the user want to add/remove normal users as an owner', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue(undefined);
                    expect(
                        Federation.actionAllowed({ federated: true }, RoomMemberActions.SET_AS_OWNER, me, {
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 day to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 129..159

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 304.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            describe('Seeing normal users', () => {
                it('should return true if the user want to add/remove normal users as an owner', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue(undefined);
                    expect(
                        Federation.actionAllowed({ federated: true }, RoomMemberActions.SET_AS_OWNER, me, {
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 day to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 263..293

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 304.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                it('should return false if the user want to add/remove owner as a normal user', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue(undefined);
                    expect(
                        Federation.actionAllowed({ federated: true }, RoomMemberActions.SET_AS_OWNER, me, {
                            u: { _id: them },
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 2 other locations - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 369..376
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 378..385

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                it('should return false if the user want to add/remove moderator as a normal user', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue(undefined);
                    expect(
                        Federation.actionAllowed({ federated: true }, RoomMemberActions.SET_AS_OWNER, me, {
                            u: { _id: them },
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 2 other locations - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 360..367
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 378..385

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                it('should return false if the user want to remove normal users from the room', () => {
                    (RoomRoles.findOne as jest.Mock).mockReturnValue(undefined);
                    expect(
                        Federation.actionAllowed({ federated: true }, RoomMemberActions.REMOVE_USER, me, {
                            u: { _id: them },
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 2 other locations - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 360..367
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 369..376

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return true if the current room is federated one, a public one but the user is an owner', () => {
            expect(
                Federation.canCreateInviteLinks(
                    { _id: 'differentId' } as IUser,
                    { federated: true, t: 'c', u: { _id: 'id' } } as IRoom,
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 501..509

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return true if the current room is federated one, a public one but the user is an moderator', () => {
            expect(
                Federation.canCreateInviteLinks(
                    { _id: 'differentId' } as IUser,
                    { federated: true, t: 'c', u: { _id: 'id' } } as IRoom,
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 491..499

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 92.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return true if the current user is a room owner', () => {
            expect(
                Federation.isEditableByTheUser(
                    { _id: 'differentId' } as IUser,
                    { federated: true, u: { _id: 'id' } } as IRoom,
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 435..443

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 87.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return true if the current user is a room moderator', () => {
            expect(
                Federation.isEditableByTheUser(
                    { _id: 'differentId' } as IUser,
                    { federated: true, u: { _id: 'id' } } as IRoom,
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 425..433

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 87.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the current room is federated one, a public one but the user is NOT an owner nor moderator', () => {
            expect(
                Federation.canCreateInviteLinks(
                    { _id: 'differentId' } as IUser,
                    { federated: true, t: 'c', u: { _id: 'id' } } as IRoom,
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 471..479

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 85.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the current room is federated one, a public one but the user is NOT an owner nor moderator', () => {
            expect(
                Federation.canCreateInviteLinks(
                    { _id: 'differentId' } as IUser,
                    { federated: true, t: 'c', u: { _id: 'id' } } as IRoom,
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 481..489

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 85.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the current user is NOT the room owner nor moderator', () => {
            expect(
                Federation.isEditableByTheUser({ _id: 'differentId' } as IUser, { federated: true, u: { _id: 'id' } } as IRoom, {} as ISubscription),
            ).toBe(false);
        });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 465..469

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the current room is federated one but NOT a public one', () => {
            expect(
                Federation.canCreateInviteLinks({ _id: 'differentId' } as IUser, { federated: true, u: { _id: 'id' } } as IRoom, {} as ISubscription),
            ).toBe(false);
        });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 419..423

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the current room is NOT a federated one', () => {
            expect(Federation.isEditableByTheUser({ _id: 'differentId' } as IUser, { u: { _id: 'id' } } as IRoom, {} as ISubscription)).toBe(false);
        });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 459..463

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 75.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the current room is NOT a federated one', () => {
            expect(Federation.canCreateInviteLinks({ _id: 'differentId' } as IUser, { u: { _id: 'id' } } as IRoom, {} as ISubscription)).toBe(
                false,
            );
        });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 2 hrs to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 415..417

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 75.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the user is null', () => {
            expect(Federation.canCreateInviteLinks(undefined, { u: { _id: 'id' } } as IRoom, {} as ISubscription)).toBe(false);
        });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 hr to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 403..405

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 63.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the user is null', () => {
            expect(Federation.isEditableByTheUser(undefined, { u: { _id: 'id' } } as IRoom, {} as ISubscription)).toBe(false);
        });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 hr to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 447..449

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 63.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        Object.values(RoomSettingsEnum)
            .filter((setting) => !allowedSettingsChanges.includes(setting))
            .forEach((setting) => {
                it('should return false if the setting change is NOT allowed within the federation context for regular channels', () => {
                    expect(Federation.isRoomSettingAllowed({ t: 'c', federated: true }, setting)).toBe(false);
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 hr to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 531..535

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        allowedSettingsChanges.forEach((setting) => {
            it('should return true if the setting change is allowed within the federation context for regular channels', () => {
                expect(Federation.isRoomSettingAllowed({ t: 'c', federated: true }, setting)).toBe(true);
            });
        });
    Severity: Major
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 1 hr to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 523..529

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the room is null', () => {
            expect(Federation.isEditableByTheUser({} as IUser, undefined, {} as ISubscription)).toBe(false);
        });
    Severity: Minor
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 50 mins to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 451..453

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the room is null', () => {
            expect(Federation.canCreateInviteLinks({} as IUser, undefined, {} as ISubscription)).toBe(false);
        });
    Severity: Minor
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 50 mins to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 407..409

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the subscription is null', () => {
            expect(Federation.isEditableByTheUser({} as IUser, {} as IRoom, undefined)).toBe(false);
        });
    Severity: Minor
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 50 mins to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 455..457

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('should return false if the subscription is null', () => {
            expect(Federation.canCreateInviteLinks({} as IUser, {} as IRoom, undefined)).toBe(false);
        });
    Severity: Minor
    Found in apps/meteor/client/lib/federation/Federation.spec.ts and 1 other location - About 50 mins to fix
    apps/meteor/client/lib/federation/Federation.spec.ts on lines 411..413

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status