grigori-gru/jira-to-matrix

View on GitHub
src/bot/actions/archive-project.ts

Summary

Maintainability
B
6 hrs
Test Coverage

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

    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 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 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 handleKnownRoom has a Cognitive Complexity of 8 (exceeds 5 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 45 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

        Avoid too many return statements within this function.
        Open

                return state;
        Severity: Major
        Found in src/bot/actions/archive-project.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return StateEnum.ERROR_ARCHIVING;
          Severity: Major
          Found in src/bot/actions/archive-project.ts - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status