Showing 370 of 370 total issues

Function token has 139 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function token(stream, state) {
      var ch = stream.peek();

      // Errors are terminal!
      if(state.error) {
Severity: Major
Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 5 hrs to fix

    File app.js has 377 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    define(function(require) {
        var $ = require('jquery'),
            _ = require('underscore'),
            Backbone = require('backbone'),
    Severity: Minor
    Found in htdocs/assets/js/app.js - About 5 hrs to fix

      File alert.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      "use strict";
      define(function(require) {
          var _ = require('underscore'),
              View = require('view'),
              ModelView = require('views/model'),
      Severity: Minor
      Found in htdocs/assets/js/views/alerts/alert.js - About 4 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    var project_search = function(q) {
                        var results = [];
                        for(var k in projects) {
                            var project = projects[k];
                            if(project.name.toLowerCase().indexOf(q.term) !== -1) {
        Severity: Major
        Found in htdocs/assets/js/views/target/jira.js and 1 other location - About 4 hrs to fix
        htdocs/assets/js/views/target/jira.js on lines 49..59

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 124.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    var issuetype_search = function(q) {
                        var results = [];
                        for(var k in issuetypes) {
                            var issuetype = issuetypes[k];
                            if(issuetype.name.toLowerCase().indexOf(q.term) !== -1) {
        Severity: Major
        Found in htdocs/assets/js/views/target/jira.js and 1 other location - About 4 hrs to fix
        htdocs/assets/js/views/target/jira.js on lines 30..40

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 124.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method search has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function search($date, $settings, $query_list, $fields, $date_field, $date_type, $result_type, $filter_range) {
                // If we're looking for no results, set filter to (< 1)
                if($result_type == self::R_NO_RESULTS) {
                    $filter_range = [0, 0];
                }
        Severity: Major
        Found in phplib/Search/Elasticsearch.php - About 4 hrs to fix

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          define(function(require) {
              var Collection = require('collection'),
                  ReportTarget = require('models/reporttarget'),
                  Config = require('config');
          
          
          Severity: Major
          Found in htdocs/assets/js/collections/reporttarget.js and 2 other locations - About 4 hrs to fix
          htdocs/assets/js/collections/filter.js on lines 2..22
          htdocs/assets/js/collections/searchlog.js on lines 2..22

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 119.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          define(function(require) {
              var Collection = require('collection'),
                  Filter = require('models/filter'),
                  Config = require('config');
          
          
          Severity: Major
          Found in htdocs/assets/js/collections/filter.js and 2 other locations - About 4 hrs to fix
          htdocs/assets/js/collections/reporttarget.js on lines 2..22
          htdocs/assets/js/collections/searchlog.js on lines 2..22

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 119.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          define(function(require) {
              var Collection = require('collection'),
                  SearchLog = require('models/searchlog'),
                  Config = require('config');
          
          
          Severity: Major
          Found in htdocs/assets/js/collections/searchlog.js and 2 other locations - About 4 hrs to fix
          htdocs/assets/js/collections/filter.js on lines 2..22
          htdocs/assets/js/collections/reporttarget.js on lines 2..22

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 119.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  getPreviewNotif: function(data, options) {
                      data = _.extend(this.toJSON(), data);
          
                      options = options || {};
                      options.url = this.urlRoot + '/preview';
          Severity: Major
          Found in htdocs/assets/js/models/search.js and 1 other location - About 4 hrs to fix
          htdocs/assets/js/models/search.js on lines 36..45

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 118.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  test: function(data, options) {
                      data = _.extend(this.toJSON(), data);
          
                      options = options || {};
                      options.url = this.urlRoot + '/test';
          Severity: Major
          Found in htdocs/assets/js/models/search.js and 1 other location - About 4 hrs to fix
          htdocs/assets/js/models/search.js on lines 26..35

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 118.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          define(function(require) {
              var Collection = require('collection'),
                  Target = require('models/target'),
                  Config = require('config');
          
          
          Severity: Major
          Found in htdocs/assets/js/collections/target.js and 1 other location - About 3 hrs to fix
          htdocs/assets/js/collections/grouptarget.js on lines 2..21

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          define(function(require) {
              var Collection = require('collection'),
                  GroupTarget = require('models/grouptarget'),
                  Config = require('config');
          
          
          Severity: Major
          Found in htdocs/assets/js/collections/grouptarget.js and 1 other location - About 3 hrs to fix
          htdocs/assets/js/collections/target.js on lines 2..21

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              private function setAlertFields($data, $fields, $alog_action, $slog_action, $a=0, $b=0) {
                  if(!$this->allowUpdate()) {
                      throw new ForbiddenException;
                  }
          
          
          Severity: Minor
          Found in phplib/REST/Alerts.php - 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 _parse has 96 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              QueryParser.prototype._parse = function(tokens) {
                  var ret = {};
                  var stk = 0;
                  var node = ret;
                  var node = {};
          Severity: Major
          Found in htdocs/assets/js/queryparser.js - About 3 hrs to fix

            Function _run has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                public function _run($commit, Search $search, $disable_search_commit=false) {
                    $alerts = [];
                    $errors = [];
            
                    // Don't allow saving Alerts if the Search isn't in the DB.
            Severity: Minor
            Found in phplib/Job/Search.php - 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

            File searches.js has 319 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            "use strict";
            define(function(require) {
                var $ = require('jquery'),
                    _ = require('underscore'),
                    View = require('view'),
            Severity: Minor
            Found in htdocs/assets/js/views/searches/searches.js - About 3 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              define(function(require) {
                  var View = require('view'),
                      Templates = require('templates');
              
              
              
              Severity: Major
              Found in htdocs/assets/js/views/forbidden.js and 1 other location - About 3 hrs to fix
              htdocs/assets/js/views/notfound.js on lines 2..21

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 108.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              define(function(require) {
                  var View = require('view'),
                      Templates = require('templates');
              
              
              
              Severity: Major
              Found in htdocs/assets/js/views/notfound.js and 1 other location - About 3 hrs to fix
              htdocs/assets/js/views/forbidden.js on lines 2..21

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 108.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Method update has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function update($get, $data, $set_fields=[]) {
                      if(!$this->allowUpdate()) {
                          throw new ForbiddenException;
                      }
                      $id = Util::get($get, 'id');
              Severity: Major
              Found in phplib/REST/Models.php - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language