grigori-gru/jira-to-matrix

View on GitHub

Showing 110 of 172 total issues

File matrix-api.ts has 787 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable no-undefined */
/* eslint no-empty-function: ["error", { "allow": ["arrowFunctions"] }] */
import matrixSdk from 'matrix-js-sdk';
import { errorTracing } from '../lib/utils';
import * as R from 'ramda';
Severity: Major
Found in src/messengers/matrix-api.ts - About 1 day to fix

    MatrixApi has 63 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class MatrixApi extends BaseChatApi implements MessengerApi {
        userId: string;
        baseUrl: string;
        // matrix client
        client: any;
    Severity: Major
    Found in src/messengers/matrix-api.ts - About 1 day to fix

      File types.ts has 538 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Project, Selectors } from '../../types';
      import { KeyType } from './selectors';
      
      export interface GitlabUserData extends GitlabUserDataShort {
          access_level: number;
      Severity: Major
      Found in src/task-trackers/gitlab/types.ts - About 1 day to fix

        File index.ts has 472 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { BaseChatApi } from '../messengers/base-api';
        import { GitlabPushCommit, GitlabPipeline, GitlabLabelHook } from '../task-trackers/gitlab/types';
        
        export interface DefaultLabel {
            name: string;
        Severity: Minor
        Found in src/types/index.ts - About 7 hrs to fix

          File index.ts has 471 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { setupCache } from 'axios-cache-adapter';
          import { Projects } from '@gitbeaker/node';
          import * as R from 'ramda';
          import axios, { AxiosRequestConfig, AxiosInstance } from 'axios';
          import querystring from 'querystring';
          Severity: Minor
          Found in src/task-trackers/gitlab/index.ts - About 7 hrs to fix

            File selectors.ts has 470 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { differenceBy, union, groupBy, mapValues } from 'lodash';
            import {
                GitlabIssueHook,
                GitlabCommentHook,
                HookTypes,
            Severity: Minor
            Found in src/task-trackers/gitlab/selectors.ts - About 7 hrs to fix

              Jira has 50 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class Jira implements TaskTracker {
                  url: string;
                  user: string;
                  password: string;
                  inviteIgnoreUsers: string[];
              Severity: Minor
              Found in src/task-trackers/jira/index.ts - About 7 hrs to fix

                File index.ts has 428 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import axios, { AxiosRequestConfig } from 'axios';
                import querystring from 'querystring';
                import * as R from 'ramda';
                import { getLogger } from '../../modules/log';
                import * as messages from '../../lib/messages';
                Severity: Minor
                Found in src/task-trackers/jira/index.ts - About 6 hrs to fix

                  SlackApi has 45 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class SlackApi extends BaseChatApi {
                      // export class SlackApi extends BaseChatApi {
                      commandServer;
                      count = 0;
                      client: any;
                  Severity: Minor
                  Found in src/messengers/slack-api.ts - About 6 hrs to fix

                    Gitlab has 44 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class Gitlab implements TaskTracker {
                        private slashCommandsList = [
                            '/approve',
                            '/assign',
                            '/assign',
                    Severity: Minor
                    Found in src/task-trackers/gitlab/index.ts - About 6 hrs to fix

                      File types.ts has 388 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { Selectors, Issue, Project } from '../../types';
                      
                      interface UserData {
                          self: string;
                          avatarUrls: {
                      Severity: Minor
                      Found in src/task-trackers/jira/types.ts - About 5 hrs to fix

                        ChatFasade has 33 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        export class ChatFasade {
                            chatPool: MessengerApi[];
                            worker: MessengerApi;
                        
                            constructor(chatPool: Array<MessengerApi>) {
                        Severity: Minor
                        Found in src/messengers/chat-fasade.ts - About 4 hrs to fix

                          Function run has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              async run({ bodyText = '', sender, roomData }: CommandOptions) {
                                  const { alias, id } = roomData;
                                  if (!alias) {
                                      return translate('noAlias');
                                  }
                          Severity: Major
                          Found in src/bot/commands/command-list/archive.ts - About 3 hrs to fix

                            File slack-api.ts has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /* eslint-disable no-undefined */
                            import http from 'http';
                            import Ramda from 'ramda';
                            import { WebClient } from '@slack/web-api';
                            import { fromString } from 'html-to-text';
                            Severity: Minor
                            Found in src/messengers/slack-api.ts - About 3 hrs to fix

                              Function getServer has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const getServer: getServerType = (handleFunc, hookParser): express.Application => {
                                  app.use(
                                      bodyParser.json({
                                          strict: false,
                                          limit: '20mb',
                              Severity: Major
                              Found in src/server.ts - About 3 hrs to fix

                                Function run has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    async run({
                                        newStatusId,
                                        author,
                                        changes,
                                        oldKey,
                                Severity: Major
                                Found in src/bot/actions/post-issue-updates.ts - About 2 hrs to fix

                                  Function run has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      async run({
                                          newStatusId,
                                          author,
                                          changes,
                                          oldKey,
                                  Severity: Minor
                                  Found in src/bot/actions/post-issue-updates.ts - About 2 hrs 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 handleRedisData has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      async handleRedisData(dataFromRedis) {
                                          try {
                                              if (!dataFromRedis) {
                                                  logger.warn('No data from redis');
                                  
                                  
                                  Severity: Minor
                                  Found in src/queue/index.ts - About 2 hrs 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 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      async run({ bodyText, roomName, sender }: CommandOptions) {
                                          const jiraBotUser = this.config.taskTracker.user;
                                          const projectKey = utils.getProjectKeyFromIssueKey(roomName);
                                          const { lead, issueTypes, admins } = await this.taskTracker.getProjectWithAdmins(projectKey);
                                  
                                  
                                  Severity: Major
                                  Found in src/bot/commands/command-list/autoinvite.ts - About 2 hrs to fix

                                    Function run has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        async run({ bodyText, sender, roomData }: CommandOptions) {
                                            if (!roomData.alias) {
                                                throw new Error('Not issue room');
                                            }
                                    
                                    
                                    Severity: Major
                                    Found in src/bot/commands/command-list/kick.ts - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language