grigori-gru/jira-to-matrix

View on GitHub

Showing 110 of 172 total issues

Avoid too many return statements within this function.
Open

                    return translate('setBotToAdmin', { projectKey, viewUrl });
Severity: Major
Found in src/bot/commands/command-list/speci.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return translate('successProjectAddToArchiveWithStatus', { projectKey, activeTime: month, status });
    Severity: Major
    Found in src/bot/commands/command-list/archive-project.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return [successExportMsg, msg].join('<br>');
      Severity: Major
      Found in src/bot/commands/command-list/archive.ts - About 30 mins to fix

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

        export const getGroupedUsers = (
            members: { userId: string; powerLevel: number }[],
            botId: string,
        ): { simpleUsers: string[]; admins: string[]; bot: string[] } => {
            const getGroup = (user: { userId: string; powerLevel: number }) => {
        Severity: Minor
        Found in src/bot/commands/command-list/common-actions.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            async run({ key, typeName, projectKey }: InviteNewMembersData): Promise<string[] | false> {
                const {
                    messenger: { bots },
                } = this.config;
                try {
        Severity: Minor
        Found in src/bot/actions/invite-new-members.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 handleRedisRooms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            async handleRedisRooms(roomsData) {
                const roomHandle = async (data: CreateRoomData) => {
                    try {
                        await this.actions.run(ActionNames.CreateRoom, data);
        
        
        Severity: Minor
        Found in src/queue/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 getIssueForSearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            async getIssueForSearch(keyOrKeys: string | string[]): Promise<Issue> {
                if (Array.isArray(keyOrKeys)) {
                    const res = await Promise.all(
                        keyOrKeys.map(async key => {
                            try {
        Severity: Minor
        Found in src/hook-parser/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 parseTextBody has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            parseTextBody(body: string): SuccessParse | FailParse {
                try {
                    const trimedBody = body.trim();
        
                    const commandNameFromUser = R.pipe(
        Severity: Minor
        Found in src/messengers/matrix-api.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 getMilestoneId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                getMilestoneId: body => {
                    const isMilestoneDeleted = data => {
                        const changes = handlers.issue.getIssueChanges(data);
                        if (changes) {
                            const newMilestone = changes.find(el => el.field === 'milestone_id');
        Severity: Minor
        Found in src/task-trackers/gitlab/selectors.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            async run(
                commandName: string | CommandNames,
                { chatApi, roomData, roomId, roomName, sender, bodyText, url, senderDisplayName }: RunCommandsOptions,
            ) {
                try {
        Severity: Minor
        Found in src/bot/commands/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

        Severity
        Category
        Status
        Source
        Language