rsn/rsnUtil.ts
Function checkDiffs
has 66 lines of code (exceeds 30 allowed). Consider refactoring. Open
Open
const checkDiffs = async (keys: string[]) => {
const data: CacheData = keys.reduce((prev, curr) => {
return {
...prev,
[curr]: {
Function checkData
has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring. Open
Open
function checkData (data: CacheData, fileData: CacheData) {
const filesWithDiff = []
for (const key in data) {
const fileDataValueAdded = fileData[key].added.sort((a, b) => a - b)
const dataValueAdded = data[key].added.sort((a, b) => a - b)
- 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 seePatch
has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring. Open
Open
async function seePatch (file: string) {
const fileData = fs.readFileSync(fixesPath + '/' + file).toString()
const snippet = await retrieveCodeSnippet(file.split('_')[0])
if (snippet == null) return
const patch = Diff.structuredPatch(file, file, filterString(snippet.snippet), filterString(fileData))
- 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"