vincent-ledu/vscode-adr-tools-extension

View on GitHub
ui/commands.js

Summary

Maintainability
C
1 day
Test Coverage

Function adrNew has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function adrNew () {
  let adrAttr = {}
  const rootPath = vscode.workspace.rootPath
  let adrFolder = path.join(
    rootPath,
Severity: Major
Found in ui/commands.js - About 2 hrs to fix

    Function adrInit has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function adrInit () {
      let configuredAdrProjectDirectory = path.normalize(vscode.workspace.getConfiguration().get('adr.project.directory'))
      const adrProjectDirectory = await vscode.window
        .showInputBox({
          value: configuredAdrProjectDirectory,
    Severity: Minor
    Found in ui/commands.js - About 1 hr to fix

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

      function adrLink () {
        let adrFolder = path.join(vscode.workspace.rootPath, vscode.workspace.getConfiguration().get('adr.project.directory'))
        vscode.window
          .showQuickPick(adrUtils.getAllAdr(adrFolder), {
            prompt: 'Enter source ADR name',
      Severity: Minor
      Found in ui/commands.js - About 1 hr to fix

        Function adrGenerateDocs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function adrGenerateDocs () {
          logger.vsLog('entering generate docs')
          let adrFolder = path.join(vscode.workspace.rootPath, vscode.workspace.getConfiguration().get('adr.project.directory'))
          let adrs = adrUtils.getAllAdr(adrFolder)
          graph.deleteGraph(adrFolder)
        Severity: Minor
        Found in ui/commands.js - About 1 hr to fix

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

          async function adrNew () {
            let adrAttr = {}
            const rootPath = vscode.workspace.rootPath
            let adrFolder = path.join(
              rootPath,
          Severity: Minor
          Found in ui/commands.js - 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

          Avoid too many return statements within this function.
          Open

              if (!tgtAdrName) return
          Severity: Major
          Found in ui/commands.js - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status