Showing 10 of 10 total issues
Function plain
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const plain = (ast, path = []) => {
const plained = ast.map((item) => {
const {
key,
newValue,
- 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 getAst
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const getAst = (tree1, tree2) => {
const keys = union(Object.keys(tree1), Object.keys(tree2));
const result = keys.reduce((acc, key) => {
if (tree1[key] && tree2[key]) {
if (isPlainObject(tree1[key]) && isPlainObject(tree2[key])) {
- 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 getAst
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getAst = (tree1, tree2) => {
const keys = union(Object.keys(tree1), Object.keys(tree2));
const result = keys.reduce((acc, key) => {
if (tree1[key] && tree2[key]) {
if (isPlainObject(tree1[key]) && isPlainObject(tree2[key])) {
Function result
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const result = keys.reduce((acc, key) => {
if (tree1[key] && tree2[key]) {
if (isPlainObject(tree1[key]) && isPlainObject(tree2[key])) {
return [...acc, {
type: 'complex',
Function plain
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const plain = (ast, path = []) => {
const plained = ast.map((item) => {
const {
key,
newValue,
Function tree
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const tree = (ast, l = 0) => {
const diff = ast.reduce((acc, item) => {
const {
key,
type,
Function tree
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const tree = (ast, l = 0) => {
const diff = ast.reduce((acc, item) => {
const {
key,
type,
- 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
return [...acc, {
type: 'deleted',
key,
oldValue: tree1[key],
}];
Avoid too many return
statements within this function. Open
return [...acc, ` + ${key}: ${stringify(newValue, l + 1)}`];
Avoid too many return
statements within this function. Open
return plain(children, newPath);