grigori-gru/jira-to-matrix

View on GitHub

Showing 110 of 172 total issues

Function run has 55 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/ignore.ts - About 2 hrs to fix

    GitlabParser has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class GitlabParser implements Parser {
        issueMovedType = 'issueMovedType';
    
        constructor(private features: Config['features'], private selectors: GitlabSelectors) {}
    
    
    Severity: Minor
    Found in src/task-trackers/gitlab/parser.gtilab.ts - About 2 hrs to fix

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

          async run({ issue, projectKey, milestoneId }: CreateRoomData): Promise<boolean> {
              try {
                  const keyOrId = issue.key || issue.id;
                  if (issue && keyOrId) {
                      const issueBody = await this.taskTracker.getIssueSafety(keyOrId);
      Severity: Minor
      Found in src/bot/actions/create-room.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 46 lines of code (exceeds 25 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

        Function run has 46 lines of code (exceeds 25 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

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

            Function getChatFsm has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const getChatFsm = (chatFasade: ChatFasade, handler: QueueHandler): StateMachine => {
                const startTime = Date.now();
                const fsm = new StateMachine({
                    init: states.init,
                    transitions: [
            Severity: Minor
            Found in src/fsm/index.ts - About 1 hr to fix

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

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

                    async run({ issue, projectKey, milestoneId }: CreateRoomData): Promise<boolean> {
                        try {
                            const keyOrId = issue.key || issue.id;
                            if (issue && keyOrId) {
                                const issueBody = await this.taskTracker.getIssueSafety(keyOrId);
                Severity: Minor
                Found in src/bot/actions/create-room.ts - About 1 hr to fix

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

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

                        async run({ bodyText, roomId, roomName }: CommandOptions) {
                            if (!roomName) {
                                throw new Error('Not issue room');
                            }
                            if (!bodyText) {
                    Severity: Minor
                    Found in src/bot/commands/command-list/speci.ts - About 1 hr to fix

                      Function run has a Cognitive Complexity of 12 (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/autoinvite.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 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async run({ bodyText, roomId, roomName }: CommandOptions) {
                              if (!roomName) {
                                  throw new Error('Not issue room');
                              }
                              if (!bodyText) {
                      Severity: Minor
                      Found in src/bot/commands/command-list/speci.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 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async run({ bodyText, sender, roomData }: CommandOptions) {
                              if (!roomData.alias) {
                                  throw new Error('Not issue room');
                              }
                              try {
                      Severity: Minor
                      Found in src/bot/commands/command-list/assign.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 getMessageByStatus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          async getMessageByStatus(
                              status: MilestoneUpdateStatus,
                              milestone: { key: string },
                              issue: { key: string; summary: string; user: string },
                          ): Promise<MessageWithSendStatus> {
                      Severity: Minor
                      Found in src/bot/actions/post-milestone-updates.ts - About 1 hr to fix

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

                          Function createIssueRoom has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              async createIssueRoom({
                                  key,
                                  summary,
                                  projectKey,
                                  descriptionFields,
                          Severity: Minor
                          Found in src/bot/actions/create-room.ts - About 1 hr to fix

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

                                async run({ bodyText, sender, roomData }: CommandOptions) {
                                    if (!roomData.alias) {
                                        throw new Error('Not issue room');
                                    }
                                    try {
                            Severity: Minor
                            Found in src/bot/commands/command-list/assign.ts - About 1 hr to fix

                              Function getPostIssueUpdatesData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  getPostIssueUpdatesData(body): PostIssueUpdatesData {
                                      const author = this.selectors.getDisplayName(body)!;
                                      const changes = this.selectors.getIssueChanges(body)!;
                                      const hookLabels = this.selectors.getIssueLabels(body);
                                      const newTitleData = changes.find(data => data.field === 'title');
                              Severity: Minor
                              Found in src/task-trackers/gitlab/parser.gtilab.ts - About 1 hr to fix

                                Function archiveAndForget has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    async archiveAndForget({
                                        client,
                                        roomData,
                                        keepTimestamp,
                                    }: {
                                Severity: Minor
                                Found in src/bot/actions/archive-project.ts - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language