pivotal/projectmonitor

View on GitHub

Showing 31 of 31 total issues

Class Project has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

class Project < ActiveRecord::Base

  RECENT_STATUS_COUNT = 8
  DEFAULT_POLLING_INTERVAL = 30
  MAX_STATUS = 15
Severity: Minor
Found in app/models/project.rb - About 4 hrs to fix

    Function validateTrackerSetup has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      o.validateTrackerSetup = function () {
        var authToken = $('input#project_tracker_auth_token').val();
        var projectId = $('input#project_tracker_project_id').val();
    
        clearTrackerSetupValidations();
    Severity: Major
    Found in app/assets/javascripts/projectEdit.js - About 2 hrs to fix

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

      var Refresher = (function (options) {
        for (var key in options) {
          if (options.hasOwnProperty(key)) {
            this[key] = options[key];
          }
      Severity: Minor
      Found in app/assets/javascripts/refreshers/refresher.js - About 2 hrs to fix

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

          this.markAsUnreachable = function () {
            $tile.find('a').text(this.name + " IS UNREACHABLE");
            this.clearStatuses();
            $tile.addClass('unreachable');
            $tile.slideDown();
        Severity: Major
        Found in app/assets/javascripts/refreshers/refresher.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/refreshers/refresher.js on lines 37..42

        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 74.

        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

          this.markAsImpaired = function () {
            $tile.find('a').text(this.name + " IS IMPAIRED");
            this.clearStatuses();
            $tile.addClass('impaired');
            $tile.slideDown();
        Severity: Major
        Found in app/assets/javascripts/refreshers/refresher.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/refreshers/refresher.js on lines 44..49

        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 74.

        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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            if params[:password_changed] != 'true'
              params[:project].delete(:auth_password)
            else
              params[:project][:auth_password] = nil unless params[:project][:auth_password].present?
        Severity: Minor
        Found in app/controllers/projects_controller.rb - 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 RubyGemsRefresh has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        var RubyGemsRefresh = (function () {
          var refresher;
          var failureThreshold = 4, failureCount = 0;
        
          return {
        Severity: Minor
        Found in app/assets/javascripts/refreshers/rubygemsRefresh.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 HerokuRefresh has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        var HerokuRefresh = (function () {
          var refresher;
          var failureThreshold = 4, failureCount = 0;
        
          return {
        Severity: Minor
        Found in app/assets/javascripts/refreshers/herokuRefresh.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 GithubRefresh has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        var GithubRefresh = (function () {
          var refresher;
          var failureThreshold = 4, failureCount = 0;
        
          return {
        Severity: Minor
        Found in app/assets/javascripts/refreshers/githubRefresh.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 validateFeedUrl has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          o.validateFeedUrl = function () {
            $('.success, .failure, .unconfigured, .empty_fields', '#polling').addClass('hide');
        
            if ($('#project_type').val() === "") {
              $('#build_status .unconfigured').removeClass('hide');
        Severity: Minor
        Found in app/assets/javascripts/projectEdit.js - About 1 hr to fix

          Function HerokuRefresh has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var HerokuRefresh = (function () {
            var refresher;
            var failureThreshold = 4, failureCount = 0;
          
            return {
          Severity: Minor
          Found in app/assets/javascripts/refreshers/herokuRefresh.js - About 1 hr to fix

            Function RubyGemsRefresh has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var RubyGemsRefresh = (function () {
              var refresher;
              var failureThreshold = 4, failureCount = 0;
            
              return {
            Severity: Minor
            Found in app/assets/javascripts/refreshers/rubygemsRefresh.js - About 1 hr to fix

              Function ProjectCheck has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var ProjectCheck = function() {
                var projectCheckTimeout = 30 * 1000;
              
                var currentTimeout;
              
              
              Severity: Minor
              Found in app/assets/javascripts/projectCheck.js - About 1 hr to fix

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

                  var humanReadableErrorHTML = function(error) {
                    var string = "";
                    var error_text = error.error_text;
                    var project_type = $("#project_type").val();
                    var url = "";
                Severity: Minor
                Found in app/assets/javascripts/projectEdit.js - About 1 hr to fix

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

                  var VersionCheck = function() {
                    var versionCheckTimeout = 30 * 1000;
                  
                    var currentTimeout;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/versionCheck.js - About 1 hr to fix

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

                    var GithubRefresh = (function () {
                      var refresher;
                      var failureThreshold = 4, failureCount = 0;
                    
                      return {
                    Severity: Minor
                    Found in app/assets/javascripts/refreshers/githubRefresh.js - About 1 hr to fix

                      Method static_status_messages_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def static_status_messages_for(project)
                          messages = []
                          if project.online?
                            messages << (project.status.published_at.present? ? "Last built #{project.status.published_at}": 'Last build date unknown')
                            if project.failure?
                      Severity: Minor
                      Found in app/helpers/project_monitor_helper.rb - 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 autocomplete has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function autocomplete(selector, item_list) {
                        $(function() {
                          function split( val ) {
                            return val.split( /,\s*/ );
                          }
                      Severity: Minor
                      Found in app/assets/javascripts/autocomplete.js - About 1 hr to fix

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

                              if (error_text.indexOf("404") > -1) {
                                url = error_text.match(/Got 404 response status from ([\w:\/.?=]+),/)[1];
                                string += "<p>Error 404: Could not find a project with the specified information</p> <p>URL: " + url + "</p>";
                              }
                        Severity: Major
                        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/projectEdit.js on lines 145..148

                        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 55.

                        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

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

                              if (error_text.indexOf("404") > -1) {
                                url = error_text.match(/Got 404 response status from ([\w:\/.?=]+),/)[1];
                                string += "<p>Error 404: Could not find a project with the specified information</p> <p>URL: " + url + "</p>";
                              }
                        Severity: Major
                        Found in app/assets/javascripts/projectEdit.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/projectEdit.js on lines 158..161

                        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 55.

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language