mahaplatform/reframe

View on GitHub

Showing 76 of 358 total issues

Function componentDidUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  componentDidUpdate(prevProps) {
    const { cacheKey, exclude_ids, filter, records, selected, sort, status, onUpdateSelected } = this.props
    if(this.timeout && status !== prevProps.status && prevProps.status === 'loading') {
      clearTimeout(this.timeout)
    }
Severity: Minor
Found in src/components/infinite/infinite.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { alt, component, content, empty, extra, format, handler, icon, label, link, tasks, units } = this.props
    if(this.props.if === false) return null
    return (
      <div className={ this._getClass() } onClick={ this._handleClick.bind(this) }>
Severity: Minor
Found in src/components/list/item.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 _getStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  _getStatus(index) {
    const { slideFirst } = this.props
    const mountedIndexes = this.state.mounted - 1
    const cardIndexes = this.state.cards.length - 1
    if(!slideFirst && mountedIndexes === -1) return 'active'
Severity: Minor
Found in src/components/stack/stack.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  render(){
    const { columns, link, records, recordTasks, selectable, selected, selectAll, sort } = this.props
    return (
      <div className="reframe-table">
        <table className="reframe-table-pinned">
Severity: Minor
Found in src/components/table/index.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 _handleFetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  _handleFetch(skip = null, reload = false) {
    const { endpoint, exclude_ids, filter, next, records, sort, total, onFetch } = this.props
    const loaded = records ? records.length : 0
    const query = {
      $page: this._getPagination(skip),
Severity: Minor
Found in src/components/infinite/infinite.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 files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  (files) => files.sort((fileA, fileB) => {
    const aIsImage = (fileA.contentType || fileA.asset.content_type).match(/image/) !== null
    const bIsImage = (fileB.contentType || fileB.asset.content_type).match(/image/) !== null
    if (aIsImage && !bIsImage) return -1
    if (bIsImage && !aIsImage) return 1
Severity: Minor
Found in src/controls/filefield/selectors.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 Check(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 0
    Severity: Major
    Found in src/components/collection/selectors.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

                return Default(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 { $eq: value }
          Severity: Major
          Found in src/components/filters/selectors.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return Email(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 Link(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 'file-text-o'
                Severity: Major
                Found in src/controls/filefield/plain_file_token.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return Raw(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

                        if(index < cardIndexes ) return 'covered'
                    Severity: Major
                    Found in src/components/stack/stack.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return Element(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 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 format(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 Default(this.props)
                            Severity: Major
                            Found in src/utils/format/index.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language