MaximilianMeister/nailed

View on GitHub

Showing 21 of 30 total issues

Function index has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function index(colors, product_query, org_query){
  $.getJSON("/json/changes/donut/allchanges", function (json) {
    function set_col() {
      var cols = new Array();
      for ( var x in json) {
Severity: Major
Found in assets/javascript/nailed/index.js - About 4 hrs to fix

    Function bugzilla has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function bugzilla(colors, product, bugzilla_url){
      // BugZilla
      product_ = product.replace(/_/g, " ");
      $.getJSON("/json/bugzilla/" + product + "/trend/open", function (json) {
        new Morris.Line({
    Severity: Major
    Found in assets/javascript/nailed/bugzilla.js - About 4 hrs to fix

      File app.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "sinatra/base"
      require "sprockets"
      require "haml"
      require "json"
      require "time"
      Severity: Minor
      Found in app.rb - About 4 hrs to fix

        Method get_change_requests has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_change_requests(state: 'open')
              Nailed.logger.info("#{@origin}: #{__method__}")
              Nailed::Config.all_repositories[@origin].each do |repo|
                updated_changerequests = []
                full_repo_name = "#{repo.organization.name}/#{repo.name}"
        Severity: Minor
        Found in lib/nailed/changes.rb - 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

        Method get_bugs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_bugs
              time = Time.now
              @products.each do |product|
                Nailed.logger.info("#{__method__}: Fetching bugs for #{product}")
                components = Nailed::Config.components[product]
        Severity: Minor
        Found in lib/nailed/bugzilla.rb - About 2 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

        Method get_trends has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def get_trends(action, item)
              call = "#{__method__}-#{action}-#{item})".to_sym
              json = Nailed::Cache.get_cache(call)
        
              return json unless json.nil?
        Severity: Major
        Found in app.rb - About 2 hrs to fix

          Method get_change_requests has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get_change_requests(state: 'open')
                Nailed.logger.info("#{@origin}: #{__method__}")
                Nailed::Config.all_repositories[@origin].each do |repo|
                  updated_changerequests = []
                  full_repo_name = "#{repo.organization.name}/#{repo.name}"
          Severity: Major
          Found in lib/nailed/changes.rb - About 2 hrs to fix

            Method get_bugs has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def get_bugs
                  time = Time.now
                  @products.each do |product|
                    Nailed.logger.info("#{__method__}: Fetching bugs for #{product}")
                    components = Nailed::Config.components[product]
            Severity: Minor
            Found in lib/nailed/bugzilla.rb - About 1 hr to fix

              Method initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def initialize
                    logname = Nailed::Config.content["logfile"]
                    logfile = nil
                    case logname
                    when "stderr", "STDERR", "", nil
              Severity: Minor
              Found in lib/nailed/logger.rb - About 1 hr to fix

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

                    def filter(data, datapoints = 40)
                        filtered = Hash.new
                        num = data.length/datapoints
                        data.first.keys.each do |key|
                          filtered[key] = data.each_slice(num.zero? ? num.succ : num)
                Severity: Minor
                Found in app.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

                Method get_jenkins_view_object has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def get_jenkins_view_object(job, parameter)
                
                      call = "#{__method__}-#{job}-#{parameter})".to_sym
                      view_object = Nailed::Cache.get_cache(call, 3600)
                
                
                Severity: Minor
                Found in app.rb - About 1 hr to fix

                  Method update_parameter_values has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def update_parameter_values
                        Nailed::Config.jobs.each do |job|
                          builds = get_builds(job)
                          builds.each do |build|
                            build_number = build["number"]
                  Severity: Minor
                  Found in lib/nailed/jenkins.rb - About 1 hr to fix

                    Method update_parameters has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def update_parameters
                          Nailed::Config.jobs.each do |job|
                    
                            # first delete all old parameters
                            db_parameters = Jenkinsparameter.select(:name).where(job: job).map(&:name)
                    Severity: Minor
                    Found in lib/nailed/jenkins.rb - About 1 hr to fix

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

                            def products
                              @@components = Hash.new
                              @@combined = Hash.new
                              products = load_content['products'].clone
                              products.each_with_index do |product, x|
                      Severity: Minor
                      Found in lib/nailed/config.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 get_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_label(product)
                            components = Nailed::Config.components[product]
                            label = components.nil? ? product : product + "/#{components.length > 1 ? 'subset' : components.fetch(0)}"
                          end
                      Severity: Minor
                      Found in app.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def initialize
                            logname = Nailed::Config.content["logfile"]
                            logfile = nil
                            case logname
                            when "stderr", "STDERR", "", nil
                      Severity: Minor
                      Found in lib/nailed/logger.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

                      Avoid too many return statements within this function.
                      Open

                          return '<span class="label label-info">' + priority + '</span>' ;
                      Severity: Major
                      Found in assets/javascript/nailed/nailed.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return row.p5;
                        Severity: Major
                        Found in assets/javascript/nailed/bugzilla.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return '<span class="label label-success">' + priority + '</span>' ;
                          Severity: Major
                          Found in assets/javascript/nailed/nailed.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                      return row.p4;
                            Severity: Major
                            Found in assets/javascript/nailed/bugzilla.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language