Showing 10 of 12 total issues
Function adrNew
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function adrNew () {
let adrAttr = {}
const rootPath = vscode.workspace.rootPath
let adrFolder = path.join(
rootPath,
Function adrInit
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function adrInit () {
let configuredAdrProjectDirectory = path.normalize(vscode.workspace.getConfiguration().get('adr.project.directory'))
const adrProjectDirectory = await vscode.window
.showInputBox({
value: configuredAdrProjectDirectory,
Function adrLink
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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',
Function adrGenerateDocs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Function adrNew
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
async function adrNew () {
let adrAttr = {}
const rootPath = vscode.workspace.rootPath
let adrFolder = path.join(
rootPath,
- 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 createNewAdr
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
Function createNode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function createNode (adrDir, index, filename, title, date, status) {
Function addLink
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function addLink (adrDir, indexSrc, indexDst, link, date) {
Function getGraph
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function getGraph (adrDir) {
let data
try {
data = fs.readFileSync(path.join(adrDir, graphFile))
} catch (err) {
- 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
Avoid too many return
statements within this function. Open
Open
if (!tgtAdrName) return