oglimmer/linky

View on GitHub

Showing 142 of 142 total issues

Function getNextIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getNextIndex = (tagHierarchy, parent = 'root') => {
  const sortedRootElements = tagHierarchy
    .filter(e => e.parent === parent)
    .sort((a, b) => (a.index < b.index ? 1 : (a.index === b.index ? 0 : -1)));
  // Immutable classes don't have length. We expect a POJO [] here.
Severity: Minor
Found in server/logic/Link.js - About 25 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 getNextIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const getNextIndex = (state, parentTagName = 'root') => {
  const sortedRootElements = state.tagHierarchy
    .filter(e => e.parent === parentTagName)
    .sort((a, b) => (a.index < b.index ? 1 : (a.index === b.index ? 0 : -1)));
  if (sortedRootElements.size > 0) {
Severity: Minor
Found in src/redux/reducers/tagHierarchyData.js - About 25 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