vincent-ledu/vscode-adr-tools-extension

View on GitHub

Showing 10 of 12 total issues

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

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

          function createNewAdr (adrAttr, adrPath, adrTemplatePath, useTimestampPrefix) {
            logger.vsLog(
              `create new adr ${adrAttr.srcAdrName}  in  ${adrPath} from templatepath  ${adrTemplatePath} useTimstampForFilePrefix: ${useTimestampPrefix} `
            )
            const prefix = getPrefix(adrPath, useTimestampPrefix)
          Severity: Minor
          Found in adrfunc/adr-utils.js - About 1 hr to fix

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

            function createNode (adrDir, index, filename, title, date, status) {
            Severity: Minor
            Found in reports/graph.js - About 45 mins to fix

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

              function addLink (adrDir, indexSrc, indexDst, link, date) {
              Severity: Minor
              Found in reports/graph.js - About 35 mins to fix

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

                function getGraph (adrDir) {
                  let data
                  try {
                    data = fs.readFileSync(path.join(adrDir, graphFile))
                  } catch (err) {
                Severity: Minor
                Found in reports/graph.js - 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

                Avoid too many return statements within this function.
                Open

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