exivity/proton

View on GitHub

Showing 10 of 36 total issues

Function withState has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const withState = (WrappedComponent) => {
  class StateWrapper extends PureComponent {
    constructor (props) {
      super(props)

Severity: Major
Found in src/Crud/wrappers/withState.js - About 3 hrs to fix

    Function getDerivedStateFromProps has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static getDerivedStateFromProps (props, state) {
        const newIdProp = !!props.id && props.id !== state.idReference
        const buildRecord = !props.id && props.id !== state.idReference
        const newRecord = !!props.moon && (props.moon !== state.recordReference)
        const recordNotFoundInCache = props.id && !props.moon
    Severity: Minor
    Found in .storybook/orbitStories/Moon.js - About 1 hr to fix

      Function getDerivedStateFromProps has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static getDerivedStateFromProps (props, state) {
          const newIdProp = !!props.id && props.id !== state.idReference
          const buildRecord = !props.id && props.id !== state.idReference
          const newRecord = !!props.planet && (props.planet !== state.recordReference)
          const recordNotFoundInCache = props.id && !props.planet
      Severity: Minor
      Found in .storybook/orbitStories/Planet.js - About 1 hr to fix

        Function getDerivedStateFromProps has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static getDerivedStateFromProps (props, state) {
            const newIdProp = !!props.id && props.id !== state.idReference
            const buildRecord = !props.id && props.id !== state.idReference
            const newRecord = !!props._entity && (props._entity !== state.recordReference)
            const recordNotFoundInCache = props.id && !props._entity
        Severity: Minor
        Found in src/OrbitClient/utils/templates/entity.js - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

              return null
          Severity: Major
          Found in .storybook/orbitStories/Moon.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return null
            Severity: Major
            Found in .storybook/orbitStories/Planet.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return null
              Severity: Major
              Found in src/OrbitClient/utils/templates/entity.js - About 30 mins to fix

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

                  static getDerivedStateFromProps (props, state) {
                    const newIdProp = !!props.id && props.id !== state.idReference
                    const buildRecord = !props.id && props.id !== state.idReference
                    const newRecord = !!props.moon && (props.moon !== state.recordReference)
                    const recordNotFoundInCache = props.id && !props.moon
                Severity: Minor
                Found in .storybook/orbitStories/Moon.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 getDerivedStateFromProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  static getDerivedStateFromProps (props, state) {
                    const newIdProp = !!props.id && props.id !== state.idReference
                    const buildRecord = !props.id && props.id !== state.idReference
                    const newRecord = !!props.planet && (props.planet !== state.recordReference)
                    const recordNotFoundInCache = props.id && !props.planet
                Severity: Minor
                Found in .storybook/orbitStories/Planet.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 getDerivedStateFromProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  static getDerivedStateFromProps (props, state) {
                    const newIdProp = !!props.id && props.id !== state.idReference
                    const buildRecord = !props.id && props.id !== state.idReference
                    const newRecord = !!props._entity && (props._entity !== state.recordReference)
                    const recordNotFoundInCache = props.id && !props._entity
                Severity: Minor
                Found in src/OrbitClient/utils/templates/entity.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