toggle-corp/faram

View on GitHub

Showing 8 of 14 total issues

Function accumulateValues has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring.
Open

export const accumulateValues = (obj, schema = {}, settings = {}) => {
    const {
        noFalsyValues = false,
        falsyValue = undefined,
    } = settings;
Severity: Minor
Found in src/Faram/validator.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 accumulateDifferentialErrors has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

export const accumulateDifferentialErrors = (
    oldObj, newObj, oldError, schema = {},
) => {
    if (oldObj === newObj) {
        return oldError;
Severity: Minor
Found in src/Faram/validator.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 accumulateErrors has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
Open

export const accumulateErrors = (obj, schema = {}) => {
    const {
        member,
        fields,
        validation,
Severity: Minor
Found in src/Faram/validator.js - About 55 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 exclusiveInBetweenCondition has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
Open

export const exclusiveInBetweenCondition = (min, max) => (value) => {
    const ok = isFalsy(value)
        || (isFalsy(min) && isFalsy(max))
        || (isFalsy(min) && value < max)
        || (isFalsy(max) && value > min)
Severity: Minor
Found in src/validations.js - About 55 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 getHandler has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

    getHandler() {
        return {
            ...super.getHandler(),
            input: {
                getPropsFromApi: ({ faramElementName, faramInfo, ...otherProps }) => ({
Severity: Minor
Found in src/FaramGroup/FaramGroupApi.js - About 35 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 inclusiveInBetweenCondition has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

export const inclusiveInBetweenCondition = (min, max) => (value) => {
    const ok = isFalsy(value)
        || (isFalsy(min) && isFalsy(max))
        || (isFalsy(min) && value <= max)
        || (isFalsy(max) && value >= min)
Severity: Minor
Found in src/validations.js - About 35 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 values;
Severity: Major
Found in src/Faram/validator.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return undefined;
    Severity: Major
    Found in src/Faram/validator.js - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language