greybutton/project-lvl2-s221

View on GitHub

Showing 4 of 11 total issues

Function makeAst has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const makeAst = (first, second) => {
  const properties = union(Object.keys(first), Object.keys(second));

  const handlers = [
    {
Severity: Minor
Found in src/index.js - About 1 hr to fix

    Function makeString has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const makeString = (ast, deep = 1) => {
      const padding = n => ' '.repeat(2 * n);
    
      const stringify = (obj) => {
        const keys = Object.keys(obj);
    Severity: Minor
    Found in src/renderers/diff.js - About 1 hr to fix

      Function makePlain has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      const makePlain = (ast, path) => {
        const stringifyValue = (value) => {
          if (value instanceof Object) {
            return 'with complex value';
          }
      Severity: Minor
      Found in src/renderers/plain.js - About 1 hr 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 makeString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const makeString = (ast, deep = 1) => {
        const padding = n => ' '.repeat(2 * n);
      
        const stringify = (obj) => {
          const keys = Object.keys(obj);
      Severity: Minor
      Found in src/renderers/diff.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