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')
- Read upRead up
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()
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
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
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]
- Read upRead up
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
}
Function buildGraphBuildFun
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function buildGraphBuildFun (index, decision, file, bodyString, filesLength): string[] {
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') {
- Read upRead up
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()
- Read upRead up
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"