ece517-p3/expertiza

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

Summary

Maintainability
F
1 wk
Test Coverage

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

jQuery(document).ready(function() {
  // This preloadedImages function is refered from http://jsfiddle.net/slashingweapon/8jAeu/
  // Actually I am not using the values in preloadedImages, but image loading speed is indeed getting faster
  var preloadedImages = []
  function preloadImages() {
Severity: Major
Found in app/assets/javascripts/tree_display.jsx - About 2 days to fix

    Function render has 223 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 190 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render: function() {
            var moreContent = []
            var buttonContent = ""
            var moreButtonStyle = {
              "display": "",
      Severity: Major
      Found in app/assets/javascripts/tree_display.jsx - About 7 hrs 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 83 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 78 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 componentWillMount has 65 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',
                                  '/assets/tree_view/lock-off-disabled-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)) &&
                                  (entry.private == true || entry.type == 'FolderNode')) {
                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) ||
                                            (entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
                                            (entry.private == false)) {
                  Severity: Critical
                  Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

                    Function render has 33 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 handleUserClick has 31 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 render has 28 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 render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              render: function() {
                                return (
                                  <div className="filterable_table">
                                    <SearchBar
                                      filterText={this.state.filterText}
                          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 && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
                                                      (entry.private == false)) {
                                                      _rows.push(<ContentTableRow
                            Severity: Major
                            Found in app/assets/javascripts/tree_display.jsx - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if(this.props.is_intelligent) {
                                            moreContent.push(
                                              <a title="Intelligent Assignment" href={"/lottery/run_intelligent_assignment/"+(parseInt(this.props.id)/2).toString()}>
                                                <img src="/assets/tree_view/run-lottery.png" />
                                              </a>
                              Severity: Major
                              Found in app/assets/javascripts/tree_display.jsx - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                            if (this.props.require_quiz) {
                                              moreContent.push(
                                                <span>
                                                  <a title="View quiz questions" href={"/student_quizzes/review_questions?id="+(parseInt(this.props.id)/2).toString()+"&type=Assignment"}>
                                                    <img src="/assets/tree_view/view-survey-24.png" />
                                Severity: Major
                                Found in app/assets/javascripts/tree_display.jsx - About 45 mins 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 && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
                                                            (entry.private == false)) {
                                                            _rows.push(<ContentTableRow
                                  Severity: Major
                                  Found in app/assets/javascripts/tree_display.jsx - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                if (parseInt(this.props.max_team_size) > 1) {
                                                  moreContent.push(
                                                    <span>
                                                      <a title="Create teams" href={"/teams/list?id="+(parseInt(this.props.id)/2).toString()+"&type=Assignment"}>
                                                        <img src="/assets/tree_view/create-teams-24.png" />
                                    Severity: Major
                                    Found in app/assets/javascripts/tree_display.jsx - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                  if (this.props.allow_suggestions) {
                                                    moreContent.push(
                                                      <span>
                                                        <a title="View suggestions" href={"/suggestion/list?id="+(parseInt(this.props.id)/2).toString()+"&type=Assignment"}>
                                                          <img src="/assets/tree_view/view-suggestion-24.png" />
                                      Severity: Major
                                      Found in app/assets/javascripts/tree_display.jsx - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                    if (this.props.has_topic) {
                                                        // Moved content out of this to the block outside this containing "if" statement
                                                    }
                                        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 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 (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

                                                  There are no issues that match your filters.

                                                  Category
                                                  Status