pivotal/projectmonitor

View on GitHub

Showing 23 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

        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

                        Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          def initialize(stdin, stdout, org, space, env, cf_authenticator = CF_authenticator.new(), cf_git_tagger = CF_git_tagger.new())
                        Severity: Major
                        Found in lib/cf_deploy.rb - About 50 mins to fix

                          Method import has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def import(config)
                                config = YAML.load(config)
                          
                                Project.transaction do
                                  cached_agg = {}
                          Severity: Minor
                          Found in lib/config_export.rb - About 45 mins 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

                          Method convert_xml_content! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def convert_xml_content!(raw_content, preserve_case = false)
                              raw_content = raw_content.downcase unless preserve_case
                              parsed_xml = Nokogiri::XML.parse(raw_content)
                              raise Payload::InvalidContentException, "Error converting content for project #{@project_name}" unless parsed_xml.root
                              parsed_xml
                          Severity: Minor
                          Found in lib/payload.rb - About 35 mins 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

                          Method fetch_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def fetch_status(project, url)
                              @concourse_authenticator.authenticate(project.auth_url, project.auth_username, project.auth_password) do |auth_poll_state, auth_status_code, auth_response|
                                if auth_poll_state != PollState::SUCCEEDED
                                  yield auth_poll_state, auth_response, auth_status_code
                                else
                          Severity: Minor
                          Found in lib/concourse_project_strategy.rb - About 35 mins 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

                          Severity
                          Category
                          Status
                          Source
                          Language