grigori-gru/jira-to-matrix

View on GitHub

Showing 110 of 172 total issues

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

    async run({ bodyText = '', roomName }: CommandOptions) {
        if (!roomName) {
            throw new Error('Not issue room');
        }

Severity: Minor
Found in src/bot/commands/command-list/create.ts - About 1 hr 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 kick has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const kick = async (chatApi: MessengerApi, { id, members }, userToKick?: string) => {
    if (!hasPowerToKick(chatApi.getMyId(), members, EXPECTED_POWER)) {
        logger.debug(`No power for kick in room with id ${id}`);

        return NO_POWER;
Severity: Minor
Found in src/bot/commands/command-list/common-actions.ts - About 1 hr 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 11 (exceeds 5 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: Minor
Found in src/bot/commands/command-list/ignore.ts - About 1 hr 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 composeConfig has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const composeConfig = (baseConfig: any): Config => {
    if (!validate(baseConfig)) {
        process.exit(1);
    }

Severity: Minor
Found in src/config/index.ts - About 1 hr to fix

    Function run has 30 lines of code (exceeds 25 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 1 hr to fix

      Function getIssueChanges has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              getIssueChanges: (body): any[] => {
                  if (isCorrectWebhook(body, 'close')) {
                      return [{ field: 'status', newValue: RoomViewStateEnum.close }];
                  }
                  if (isCorrectWebhook(body, 'reopen')) {
      Severity: Minor
      Found in src/task-trackers/gitlab/selectors.ts - About 1 hr to fix

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

            async run({ bodyText, roomData }: CommandOptions) {
                if (this.chatApi.getCommandRoomName() === roomData.alias) {
                    if (!this.chatApi.isMaster()) {
                        logger.warn('Skip operation for not master bot');
        
        
        Severity: Minor
        Found in src/bot/commands/command-list/help.ts - About 1 hr to fix

          Function handleKnownRoom has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async handleKnownRoom({ keepTimestamp, roomId, alias, status }) {
                  const data = await this.chatApi.getRoomAndClient(roomId);
                  if (!data) {
                      logger.debug(`No bot can get room meta by alias ${alias} they are not joined. Try remove it.`);
          
          
          Severity: Minor
          Found in src/bot/actions/archive-project.ts - About 1 hr to fix

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

                async run({ projectKey, keepTimestamp, status }: ArchiveProjectData): Promise<any> {
                    try {
                        logger.info('Start archiving project');
            
                        const lastIssueKey = await this.taskTracker.getLastIssueKey(projectKey);
            Severity: Minor
            Found in src/bot/actions/archive-project.ts - About 1 hr to fix

              Function saveIncoming has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  async saveIncoming({ redisKey, ...restData }) {
                      try {
                          let redisValue = restData;
                          if (redisKey === REDIS_ROOM_KEY) {
                              const { createRoomData } = restData;
              Severity: Minor
              Found in src/queue/index.ts - About 1 hr to fix

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

                    async run({ bodyText, sender, roomData }: CommandOptions) {
                        if (!roomData.alias) {
                            throw new Error('Not issue room');
                        }
                
                
                Severity: Minor
                Found in src/bot/commands/command-list/kick.ts - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    async run({ bodyText, roomData }: CommandOptions) {
                        if (!this.chatApi.isMaster()) {
                            logger.warn('Skip operation for not master bot');
                
                            return;
                Severity: Minor
                Found in src/bot/commands/command-list/archive-project.ts - About 1 hr 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 upload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async upload(roomId: string, url: string): Promise<string | undefined> {
                        try {
                            const mimeTypes = [
                                'image/apng',
                                'image/bmp',
                Severity: Minor
                Found in src/messengers/matrix-api.ts - About 1 hr to fix

                  Function handleRedisRooms has 26 lines of code (exceeds 25 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 1 hr to fix

                    Function getHookHandler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        getHookHandler(type: IssueType) {
                            const handlers = {
                                issue: async body => {
                                    const key = this.selectors.getIssueKey(body)!;
                                    const status = await this.getIssueSafety(key);
                    Severity: Minor
                    Found in src/task-trackers/jira/index.ts - About 1 hr to fix

                      Function timelineHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async timelineHandler(event: any, room: any, toStartOfTimeline: boolean) {
                              try {
                                  if (event.getType() !== 'm.room.message' || toStartOfTimeline) {
                                      return;
                                  }
                      Severity: Minor
                      Found in src/messengers/matrix-api.ts - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async run({ bodyText = '', sender, roomData }: CommandOptions) {
                              const { alias, id } = roomData;
                              if (!alias) {
                                  return translate('noAlias');
                              }
                      Severity: Minor
                      Found in src/bot/commands/command-list/archive.ts - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async run({ projectKey, keepTimestamp, status }: ArchiveProjectData): Promise<any> {
                              try {
                                  logger.info('Start archiving project');
                      
                                  const lastIssueKey = await this.taskTracker.getLastIssueKey(projectKey);
                      Severity: Minor
                      Found in src/bot/actions/archive-project.ts - About 55 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 saveIncoming has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async saveIncoming({ redisKey, ...restData }) {
                              try {
                                  let redisValue = restData;
                                  if (redisKey === REDIS_ROOM_KEY) {
                                      const { createRoomData } = restData;
                      Severity: Minor
                      Found in src/queue/index.ts - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async run({ issueKey, milestoneId, status, user, summary }: PostMilestoneUpdatesData): Promise<string | undefined> {
                              try {
                                  const issue = await this.taskTracker.getIssue(issueKey);
                                  const milestoneKey = this.taskTracker.selectors.getMilestoneKey(issue, milestoneId)!;
                                  const milestoneRoomId = await this.chatApi.getRoomId(milestoneKey);
                      Severity: Minor
                      Found in src/bot/actions/post-milestone-updates.ts - About 55 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