mahaplatform/reframe

View on GitHub

Showing 76 of 358 total issues

Function Select has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Select = (multiple) => {

  class Control extends React.Component {

    static propTypes = {
Severity: Major
Found in src/controls/select/select.js - About 4 hrs to fix

    Function Select has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    const Select = (multiple) => {
    
      class Control extends React.Component {
    
        static propTypes = {
    Severity: Minor
    Found in src/controls/select/select.js - About 3 hrs 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 22 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const { format } = this.props
        if(_.isString(format)) {
          const [,style,details] = format.match(/([^|]*)\|?(.*)/)
          if(style === 'status') {
    Severity: Minor
    Found in src/utils/format/index.js - About 3 hrs 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 75 lines of code (exceeds 25 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: Major
    Found in src/components/table/index.js - About 3 hrs to fix

      Function _getOptions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        _getOptions(include) {
          const options = []
          if(_.includes(include, 'this')) options.push({ value: 'this_week', description: this.description(0, 'week'), text: 'This Week' })
          if(_.includes(include, 'last')) options.push({ value: 'last_week', description: this.description(-1, 'week'), text: 'Last Week' })
          if(_.includes(include, 'next')) options.push({ value: 'next_week', description: this.description(1, 'week'), text: 'Next Week' })
      Severity: Minor
      Found in src/components/filters/daterange.js - About 2 hrs 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 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const { leftItems, position, rightItems, title } = this.props
          return (
            <div className={ this._getClass() }>
              { position === 'top' &&
      Severity: Major
      Found in src/components/modal_panel/index.js - About 2 hrs to fix

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

          render() {
            const { editorState, linking } = this.state
            return (
              <div className="reframe-wysiwyg">
                <div className="reframe-wysiwyg-header">
        Severity: Major
        Found in src/controls/wysiwyg/index.js - About 2 hrs to fix

          Form has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Form extends React.Component {
          
            static childContextTypes = {
              form: PropTypes.object
            }
          Severity: Minor
          Found in src/components/form/form.js - About 2 hrs to fix

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

              render() {
                const { month, value, year } = this.props
                const current = { month, year, day: '01'}
                const start = moment(current).startOf('month')
                const end = moment(current).endOf('month')
            Severity: Minor
            Found in src/controls/datefield/chooser.js - About 2 hrs to fix

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

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

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

                  render() {
                    const { format } = this.props
                    if(_.isString(format)) {
                      const [,style,details] = format.match(/([^|]*)\|?(.*)/)
                      if(style === 'status') {
                Severity: Minor
                Found in src/utils/format/index.js - About 1 hr to fix

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

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

                    Function fetchSuccess has a Cognitive Complexity of 14 (exceeds 5 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

                    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 42 lines of code (exceeds 25 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 1 hr to fix

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

                        render() {
                          const saved = [
                            { name: 'Saved Filter 1', results: { } }
                          ]
                          return (
                      Severity: Minor
                      Found in src/components/filters/saved.js - About 1 hr to fix

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

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

                            render() {
                              const { after, before, config, instructions, panels, status } = this.props
                              const configuring = _.includes(['pending', 'loading_sections','sections_loaded', 'loading_data'], status)
                              return (
                                <div className="reframe-form">
                          Severity: Minor
                          Found in src/components/form/form.js - About 1 hr to fix

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

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

                              Function _handleClick has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                _handleClick() {
                                  const { confirm, disabled, drawer, handler, location, modal, request, route, onDone } = this.props
                                  if(disabled) return
                                  const yesHandler = () => {
                                    if(route) this._handleRoute(route)
                              Severity: Minor
                              Found in src/components/button/button.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 33 lines of code (exceeds 25 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 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language