mahaplatform/reframe

View on GitHub

Showing 358 of 358 total issues

Avoid too many return statements within this function.
Open

        return Date(this.props, template)
Severity: Major
Found in src/utils/format/index.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return YesNo(this.props, true)
    Severity: Major
    Found in src/utils/format/index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return Capitalize(this.props)
      Severity: Major
      Found in src/utils/format/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return Empty(this.props)
        Severity: Major
        Found in src/utils/format/index.js - About 30 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export const fetchItems = (endpoint) => ({
            type: 'API_REQUEST',
            method: 'GET',
            endpoint,
            request: 'FETCH_ITEMS_REQUEST',
          Severity: Minor
          Found in src/controls/select/actions.js and 1 other location - About 30 mins to fix
          src/components/form/actions.js on lines 11..18

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid too many return statements within this function.
          Open

                return this._handleFailure()
          Severity: Major
          Found in src/components/form/form.js - About 30 mins to fix

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              render() {
                return (
                  <div className="ui field">
                    <input { ...this._getInput() }/>
                  </div>
            Severity: Minor
            Found in src/controls/numberfield/index.js and 2 other locations - About 30 mins to fix
            src/controls/emailfield/index.js on lines 20..26
            src/controls/phonefield/index.js on lines 26..32

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            const previous = (state, action) => ({
              ...state,
              month: state.month !== null ? (state.month === 0 ? 11 : state.month - 1) : null,
              year: state.year !== null ? (state.month === 0 ? state.year - 1 : state.year) : null
            })
            Severity: Minor
            Found in src/controls/datefield/reducer.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 _scrollListener has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _scrollListener() {
                const { signpost } = this.state
                const { notificationPercent, onReachBottom } = this.props
                const bottomPosition = this.scrollpane.scrollHeight - (this.scrollpane.scrollTop + this.scrollpane.offsetHeight)
                const percentRemaining = (bottomPosition / this.scrollpane.scrollHeight) * 100
            Severity: Minor
            Found in src/components/scrollpane/index.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 _getClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _getClass() {
                const { component, basic, className, color, disabled, mobile, status } = this.props
                if(component) return ''
                const classes = className ? className.split(' ') : ['ui', color, 'fluid', 'button']
                classes.push('reframe-button')
            Severity: Minor
            Found in src/components/button/button.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                const { active, infinite, slides, total } = this.props
                return (
                  <div className="reframe-carousel">
                    { total > 0 &&
            Severity: Minor
            Found in src/components/carousel/carousel.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 _getBodyClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _getBodyClass(column) {
                let classes = []
                if(column.primary === true) classes.push('mobile')
                if(column.format === 'check' || column.collapsing === true) classes.push('collapsing')
                if(column.format === 'check' || column.centered === true) classes.push('centered')
            Severity: Minor
            Found in src/components/table/index.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 _getMenuClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _getMenuClass() {
                const { active, animating } = this.state
                const classes = ['menu','transition']
                if(!animating && !active) classes.push('hidden')
                if(animating || active) classes.push('visible')
            Severity: Minor
            Found in src/controls/dropdown/index.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 next has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const next = (state, action) => ({
              ...state,
              month: state.month !== null ? (state.month === 11 ? 0 : state.month + 1) : null,
              year: state.year !== null ? (state.month === 11 ? state.year + 1 : state.year) : null
            })
            Severity: Minor
            Found in src/controls/datefield/reducer.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                const { component, content, empty, items, title } = this.props
                return (
                  <div className="reframe-list-section">
                    { title &&
            Severity: Minor
            Found in src/components/list/section.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 _handleSubmit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _handleSubmit() {
                const { action, filtered, isBusy, isValid, method, onSubmit, onSubmitForm, onValidateForm, validateResults } = this.props
                if(isBusy) return
                if(!isValid) return onValidateForm(validateResults)
                if(action) return onSubmitForm(method, action, filtered)
            Severity: Minor
            Found in src/components/form/form.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 _handleTasks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _handleTasks(id) {
                const { recordTasks } = this.props
                const tasks = recordTasks.map(task => ({
                  ...task,
                  handler: task.handler ? () => task.handler(id) : null,
            Severity: Minor
            Found in src/components/table/index.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 _getConfirmChildContext has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              _getConfirmChildContext() {
                const { onOpen, onClose } = this.props
                return {
                  open: (message, yes = null, no = null) => onOpen(message, null, [
                    {
            Severity: Minor
            Found in src/components/prompt/prompt.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