mahaplatform/reframe

View on GitHub

Showing 76 of 358 total issues

Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { alert, buttons, empty, footer, header, items, sections } = this.props
    return (
      <div className={ this._getClasses() }>
        { header &&
Severity: Minor
Found in src/components/list/index.js - About 1 hr to fix

    Function render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { filters, onDone } = this.props
        return (
          <div className="reframe-filters-panel">
            <div className="reframe-filters-header">
    Severity: Minor
    Found in src/components/filters/overview.js - About 1 hr to fix

      Function render has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const { chosen, endpoint, filters, multiple, options, text } = this.props
          return (
            <div className={ this._getClass() }>
              <div className="reframe-toggle-list-overlay" onClick={ this._handleToggleFilter.bind(this) } />
      Severity: Minor
      Found in src/controls/toggle_list/toggle_list.js - About 1 hr to fix

        Function records has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          (records, sort) => {
            if(!records) return null
            return records.sort((a, b) => {
              const aValue = a[sort.key]
              const bValue = b[sort.key]
        Severity: Minor
        Found in src/components/collection/selectors.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 componentDidUpdate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          componentDidUpdate(prevProps) {
            const { data, sections, status } = this.props
            if(!_.isEqual(prevProps.sections, sections)) {
              this._handleUpdateSections()
            }
        Severity: Minor
        Found in src/components/form/form.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 render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            const { format, label, multiple, name, options, results } = this.props
            const value = results[name]
            return (
              <div className="reframe-filters-panel">
        Severity: Minor
        Found in src/components/filters/lookup.js - About 1 hr to fix

          Function _scrollListener has 31 lines of code (exceeds 25 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 1 hr to fix

            Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const { columns } = this.props
                return (
                  <div className="reframe-tablefield">
                    <div className="reframe-tablefield-header">
            Severity: Minor
            Found in src/controls/tablefield/tablefield.js - About 1 hr to fix

              Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
              
                  const dpis = [1,2]
              
                  const { file } = this.props
              Severity: Minor
              Found in src/controls/filefield/preview.js - About 1 hr to fix

                Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const { items } = this.props
                    return (
                      <div className="reframe-collection-tasks-panel">
                        <div className="reframe-collection-tasks-panel-header">
                Severity: Minor
                Found in src/components/collection/export.js - About 1 hr to fix

                  Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const { cancel, children, message, title, open, options } = this.props
                      return ([
                        children,
                        <CSSTransition key="reframe-prompt-overlay" in={ open } classNames="expanded" timeout={ 250 } mountOnEnter={ true } unmountOnExit={ true }>
                  Severity: Minor
                  Found in src/components/prompt/prompt.js - About 1 hr to fix

                    Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const { header, items } = this.props
                        return (
                          <div className="reframe-tabs">
                            <div className="reframe-tabs-header">
                    Severity: Minor
                    Found in src/components/tabs/tabs.js - About 1 hr to fix

                      Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render() {
                          const { panels } = this.state
                          const { children } = this.props
                          return ([
                            children,
                      Severity: Minor
                      Found in src/containers/modal/modal.js - About 1 hr to fix

                        Function reducer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const reducer = (state = INITIAL_STATE, action)=> {
                        
                          switch (action.type) {
                        
                          case 'SET_PARAMS':
                        Severity: Minor
                        Found in src/components/collection/reducer.js - About 1 hr to fix

                          Function fetchSuccess has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const fetchSuccess = (state: State, action: FetchSuccess): State => {
                            if(action.request_id !== state.request_id) return state
                            if(!_.includes(['loading','refreshing','delayed'], state.status)) return state
                            const loaded = state.records ? state.records.length : 0
                            if(action.result.pagination.all !== undefined) {
                          Severity: Minor
                          Found in src/components/infinite/reducer.js - About 1 hr to fix

                            Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render() {
                                const { all, delayed, empty, failure, footer, header, layout, loading, notFound, records, status, timeout, total } = this.props
                                return (
                                  <div className="reframe-infinite">
                                    { header &&
                            Severity: Minor
                            Found in src/components/infinite/infinite.js - About 1 hr to fix

                              Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                render() {
                                  const { status } = this.props
                                  return (
                                    <ModalPanel { ...this._getPanel() }>
                                      <div className="reframe-videofield-picker">
                              Severity: Minor
                              Found in src/controls/videofield/picker.js - About 1 hr to fix

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

                                  componentDidUpdate(prevProps) {
                                    const { files, multiple, status, value, onChange, onReady } = this.props
                                    if(status !== prevProps.status) {
                                      if(prevProps.status === 'pending') {
                                        onReady()
                                Severity: Minor
                                Found in src/controls/filefield/filefield.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 componentDidUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  componentDidUpdate(prevProps) {
                                    const { active, value, onChange } = this.props
                                    const { form } = this.context
                                    if(prevProps.value !== value) {
                                      if(value) {
                                Severity: Minor
                                Found in src/controls/datefield/datefield.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

                                Function _getSlideClass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  _getSlideClass(index) {
                                    const curr = this.state.active
                                    const next = this.props.active
                                    const { direction } = this.props
                                    const { transitioning } = this.state
                                Severity: Minor
                                Found in src/components/carousel/carousel.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

                                Severity
                                Category
                                Status
                                Source
                                Language