expertiza/expertiza

View on GitHub
app/assets/javascripts/tree_display.jsx

Summary

Maintainability
F
1 wk
Test Coverage

File tree_display.jsx has 1392 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// initialize a global object available throughout the application
// can be useful on different pages
let app_variables = {

  currentUserId: null,
Severity: Major
Found in app/assets/javascripts/tree_display.jsx - About 3 days to fix

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

        render: function() {
          var _rows = []
          var _this = this
          var colWidthArray = [ '30%', '0%', '0%', '0%', '25%', '25%', '20%' ]
          var colDisplayStyle = {
    Severity: Major
    Found in app/assets/javascripts/tree_display.jsx - About 1 day to fix

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

          render: function() {
            var _rows = []
            var _this = this
            var colWidthArray = [ '30%', '0%', '0%', '0%', '25%', '25%', '20%' ]
            var colDisplayStyle = {
      Severity: Major
      Found in app/assets/javascripts/tree_display.jsx - About 4 hrs to fix

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

            render: function() {
              var creation_date
              var updated_date
              var colWidthArray = [ '30%', '0%', '0%', '0%', '25%', '25%', '20%' ]
              var colDisplayStyle = {
        Severity: Major
        Found in app/assets/javascripts/tree_display.jsx - About 4 hrs to fix

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

              render: function() {
                var creation_date
                var updated_date
                var colWidthArray = [ '30%', '0%', '0%', '0%', '25%', '25%', '20%' ]
                var colDisplayStyle = {
          Severity: Major
          Found in app/assets/javascripts/tree_display.jsx - About 3 hrs to fix

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

                render: function() {
                  var moreContent = []
                  var moreButtonStyle = {
                    display: '',
                    padding: '0 2px'
            Severity: Major
            Found in app/assets/javascripts/tree_display.jsx - About 3 hrs to fix

              Function componentWillMount has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  componentWillMount: function() {
                    var _this = this
                    preloadImages(
                      '/assets/tree_view/edit-icon-24.png',
                      '/assets/tree_view/delete-icon-24.png',
              Severity: Major
              Found in app/assets/javascripts/tree_display.jsx - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                          if (
                            ((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
                              (entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
                              (entry.institution && entry.institution.indexOf(_this.props.filterText) !== -1) ||
                              (entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
                Severity: Critical
                Found in app/assets/javascripts/tree_display.jsx - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                                if (
                                  ((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
                                    (entry.creation_date &&
                                      entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
                                    (entry.institution && entry.institution.indexOf(_this.props.filterText) !== -1) ||
                  Severity: Critical
                  Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

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

                        getActions: function(props) {
                          if (props.is_available) {
                            return node_attributes.assignment.actions.filter((i) => i(props)).map((val, i, arr) => {
                              let ret = val(props)
                              /** every five provide a break */
                    Severity: Minor
                    Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

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

                          render: function() {
                            var colSpan = '5'
                            var colDisplayStyle = {
                              display: ''
                            }
                      Severity: Minor
                      Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

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

                            render: function() {
                              var renderContent = []
                              var formStyle = {
                                margin: 0,
                                padding: 0,
                        Severity: Minor
                        Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

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

                              handleUserClick: function(colName, order) {
                                var tmpData = this.state.tableData
                                tmpData.sort(function(a, b) {
                                  var a_val = eval('a.' + colName)
                                  var b_val = eval('b.' + colName)
                          Severity: Minor
                          Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

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

                                handleExpandClick: function(id, expanded, newParams) {
                                  this.state.expandedRow.concat([ id ])
                                  if (expanded) {
                                    this.setState({
                                      expandedRow: this.state.expandedRow.concat([ id ])
                            Severity: Minor
                            Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                            if (
                                              ((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
                                                (entry.creation_date &&
                                                  entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
                                                (entry.updated_date &&
                              Severity: Major
                              Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

                                Avoid deeply nested control flow statements.
                                Open

                                              if (
                                                ((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
                                                  (entry.creation_date &&
                                                    entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
                                                  (entry.updated_date &&
                                Severity: Major
                                Found in app/assets/javascripts/tree_display.jsx - About 45 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return 0
                                  Severity: Major
                                  Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                              return a_val.localeCompare(b_val)
                                    Severity: Major
                                    Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                  return 1
                                      Severity: Major
                                      Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return -1
                                        Severity: Major
                                        Found in app/assets/javascripts/tree_display.jsx - About 30 mins to fix

                                          There are no issues that match your filters.

                                          Category
                                          Status