vaziliybober/operlib

View on GitHub

Showing 10 of 20 total issues

Function transformAtomic has 154 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const transformAtomic = (aOper1, aOper2) => {
  const useSymmetry = () => {
    const [aOper2Transformed, aOper1Transformed] = transformAtomic(
      aOper2,
      aOper1,
Severity: Major
Found in src/operation.js - About 6 hrs to fix

    Function transformAtomic has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    export const transformAtomic = (aOper1, aOper2) => {
      const useSymmetry = () => {
        const [aOper2Transformed, aOper1Transformed] = transformAtomic(
          aOper2,
          aOper1,
    Severity: Minor
    Found in src/operation.js - About 3 hrs 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 transformOperations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const transformOperations = (oper1, oper2) => {
      const operations1 = oper1.map((aOper1) => makeOperation(aOper1));
      const operations2 = oper2.map((aOper2) => makeOperation(aOper2));
    
      for (let i1 = 0; i1 < operations1.length; i1 += 1) {
    Severity: Minor
    Found in src/operation.js - About 45 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

    Avoid too many return statements within this function.
    Open

          return [
            makeOperation(
              makeAtomic('remove', {
                pos: left1,
                length: length1 - length2,
    Severity: Major
    Found in src/operation.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return useSymmetry();
      Severity: Major
      Found in src/operation.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return [
                makeOperation(
                  makeAtomic('insert', {
                    pos: left,
                    content,
        Severity: Major
        Found in src/operation.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return [
                  makeOperation(
                    makeAtomic('insert', {
                      pos,
                      content,
          Severity: Major
          Found in src/operation.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return [
                    makeOperation(
                      makeAtomic('insert', {
                        pos: pos - length,
                        content,
            Severity: Major
            Found in src/operation.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return useSymmetry();
              Severity: Major
              Found in src/operation.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return useSymmetry();
                Severity: Major
                Found in src/operation.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language