Showing 9 of 21 total issues

Function setStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function setStatus (filePath, status) {
  let fileData
  let fileExt = Config.getDocExtension()
  try {
    fileData = fs.readFileSync(filePath, 'utf8')
Severity: Minor
Found in src/lib/StatusHelper.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 getAllStatus has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getAllStatus (filePath): string[] {
  let fileData
  let statusSections
  let status
  let fileExt = Config.getDocExtension()
Severity: Minor
Found in src/lib/StatusHelper.ts - About 1 hr to fix

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

    function updateNameByTitle (): void {
      let files = getAdrFiles()
    
      files.forEach(function (file) {
        let fileName = file.relativePath
    Severity: Minor
    Found in src/lib/update.ts - About 1 hr to fix

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

      export function compress () {
        let assetsPath = Config.getAssetsPath()
      
        if (!fs.existsSync(assetsPath)) {
          // TODO notify the user that no assets were found
      Severity: Minor
      Found in src/lib/compress.ts - About 1 hr to fix

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

        function getStatusSection (tree: any) {
          let statusFlag = false
          let statusSection: string[] = []
          for (let i = 0; i < tree.length; i++) {
            let node = tree[i]
        Severity: Minor
        Found in src/lib/StatusHelper.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

        Consider simplifying this complex logical expression.
        Open

              if ((fileName === 'README.md' || fileName.indexOf('.md') === -1)
                && (fileName === 'README.adoc' || fileName.indexOf('.adoc') === -1)
                && (fileName === 'README.asciidoc' || fileName.indexOf('.asciidoc') === -1)) {
                return
              }
        Severity: Major
        Found in src/lib/output/HtmlBuilder.ts - About 40 mins to fix

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

          function buildGraphBuildFun (index, decision, file, bodyString, filesLength): string[] {
          Severity: Minor
          Found in src/lib/generate.ts - About 35 mins to fix

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

              build () {
                if (typeof this.startString === 'string') {
                  return this.startString + this.bodyString.join('') + this.endString
                }
                if (typeof this.startString === 'object') {
            Severity: Minor
            Found in src/lib/base/GenerateBuilder.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 getAllStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function getAllStatus (filePath): string[] {
              let fileData
              let statusSections
              let status
              let fileExt = Config.getDocExtension()
            Severity: Minor
            Found in src/lib/StatusHelper.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