robvanderleek/create-issue-branch

View on GitHub

Showing 33 of 53 total issues

File github.ts has 432 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
    getAssignee,
    getDefaultBranch as getDefaultBranchFromContext,
    getIssueDescription,
    getIssueLabels,
Severity: Minor
Found in src/github.ts - About 6 hrs to fix

    Function getConventionalPrTitlePrefix has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getConventionalPrTitlePrefix(config: Config, labels: Array<string>) {
        const mapping = getConventionalLabelMapping(config)
        const conventionalLabels = Object.keys(mapping).filter(k => labels.includes(k)).map(k => mapping[k]);
        const featureLabels = conventionalLabels.filter(cl => cl.prefix === 'feat')
        if (featureLabels.length > 0) {
    Severity: Minor
    Found in src/config.ts - About 4 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 setupEventHandlers has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function setupEventHandlers(app: Probot) {
        app.on('issues.assigned', async ctx => {
            await issueAssigned(app, ctx);
        });
        app.on('issue_comment.created', async ctx => {
    Severity: Minor
    Found in src/probot.ts - About 1 hr to fix

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

      export function getConventionalPrTitlePrefix(config: Config, labels: Array<string>) {
          const mapping = getConventionalLabelMapping(config)
          const conventionalLabels = Object.keys(mapping).filter(k => labels.includes(k)).map(k => mapping[k]);
          const featureLabels = conventionalLabels.filter(cl => cl.prefix === 'feat')
          if (featureLabels.length > 0) {
      Severity: Minor
      Found in src/config.ts - About 1 hr to fix

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

        export function getConventionalLabelMapping(config: Config) {
            const mapping: ConventionalLabelMapping = {
                bug: {prefix: 'fix', emoji: '🐛', breaking: false},
                dependencies: {prefix: 'fix', emoji: '⬆️', breaking: false},
                security: {prefix: 'fix', emoji: '🔒', breaking: false},
        Severity: Minor
        Found in src/config.ts - About 1 hr to fix

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

          async function queryProjectIdsForIssue(ctx: Context<any>) {
              const queryProjectIds = `
            query ($owner: String!, $repo: String!, $number: Int!) {
              repository(owner: $owner, name: $repo) {
                issue(number: $number) {
          Severity: Minor
          Found in src/github.ts - About 1 hr to fix

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

            export async function chatOpsCommandGiven(app: Probot, ctx: Context<any>, config: Config, comment: string) {
                app.log.debug('ChatOps command received');
                if (!isModeChatOps(config)) {
                    app.log.info('Received ChatOps command but current mode is not `chatops`');
                }
            Severity: Minor
            Found in src/webhooks/comment-created.ts - About 1 hr to fix

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

              async function handle(app: Probot, ctx: Context<any>, config: Config) {
                  if (skipForIssue(ctx, config)) {
                      app.log.info(`Skipping run for issue: ${getIssueTitle(ctx)}`)
                      return
                  }
              Severity: Minor
              Found in src/webhooks/issue-opened.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 handle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              async function handle(app: Probot, ctx: Context<any>, config: Config) {
                  if (skipForIssue(ctx, config)) {
                      app.log.info(`Skipping run for issue: ${getIssueTitle(ctx)}`)
                      return
                  }
              Severity: Minor
              Found in src/webhooks/issue-assigned.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 getIssueBranchConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getIssueBranchConfig(ctx: Context<any>, config: Config) {
                  if (config.branches.length > 0) {
                      const issueLabels = getIssueLabelsForMatching(ctx)
                      for (const branchConfig of config.branches) {
                          const labels = branchConfig.label instanceof Array ? branchConfig.label : [branchConfig.label];
              Severity: Minor
              Found in src/github.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 slice has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function slice(tokens: Array<Token>, value: string) {
                  const startOperator = tokens.findIndex(t => t.value === '[')
                  const endOperator = tokens.findIndex(t => t.value === ']')
                  if (startOperator === -1 || endOperator === -1 || endOperator <= startOperator) {
                      return value
              Severity: Minor
              Found in src/interpolate.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

              Function updatePrTitle has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export async function updatePrTitle(app: Probot, ctx: Context<any>, config: Config, pr: any, issueTitle: string, labels: Array<string>) {
              Severity: Minor
              Found in src/github.ts - About 45 mins to fix

                Function updatePullRequestBody has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                async function updatePullRequestBody(ctx: Context<any>, issueNumber: number, pr: any, app: Probot, config: Config) {
                Severity: Minor
                Found in src/webhooks/pull-request.ts - About 35 mins to fix

                  Function updatePrBody has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  export async function updatePrBody(app: Probot, ctx: Context<any>, config: Config, pr: any, body: any) {
                  Severity: Minor
                  Found in src/github.ts - About 35 mins to fix

                    Function updatePullRequestTitle has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    async function updatePullRequestTitle(ctx: Context<any>, issueNumber: number, pr: any, app: Probot, config: Config) {
                    Severity: Minor
                    Found in src/webhooks/pull-request.ts - About 35 mins to fix

                      Function createPr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      export async function createPr(app: Probot, ctx: Context<any>, config: Config, username: string, branchName: string) {
                      Severity: Minor
                      Found in src/github.ts - About 35 mins to fix

                        Function createBranch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        export async function createBranch(app: Probot, ctx: Context<any>, config: Config, branchName: string, sha: string) {
                        Severity: Minor
                        Found in src/github.ts - About 35 mins to fix

                          Function pullRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export async function pullRequest(app: Probot, ctx: Context<any>) {
                              const action = ctx.payload.action
                              app.log.debug(`Pull-Request was ${action}`)
                              const config = await loadConfig(ctx);
                              if (!config) {
                          Severity: Minor
                          Found in src/webhooks/pull-request.ts - About 35 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 getBranchName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export async function getBranchName(ctx: Context<any>, config: Config, title: string) {
                              const number = getIssueNumber(ctx)
                              let result
                              if (config.branchName) {
                                  if (config.branchName === 'tiny') {
                          Severity: Minor
                          Found in src/github.ts - About 35 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 pullRequestClosed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export async function pullRequestClosed(_: Probot, ctx: Context<any>) {
                              if (ctx.payload.pull_request.merged === true) {
                                  const config = await loadConfig(ctx);
                                  if (config && config.autoCloseIssue) {
                                      const branchName = ctx.payload.pull_request.head.ref
                          Severity: Minor
                          Found in src/webhooks/pull-request-closed.ts - About 35 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